From d8b74700c5798fc68d6954a1c110657dea6ddd89 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 27 Jun 2023 14:58:53 +0200 Subject: Add dart_format (null-ls) --- lua/plugins/lsp.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index ffa7837..2c0befb 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -315,6 +315,7 @@ null_ls.setup { builtins.formatting.prettierd, builtins.formatting.rustfmt, builtins.formatting.stylua, + builtins.formatting.dart_format, builtins.formatting.trim_whitespace, builtins.formatting.yapf, -- null_ls.builtins.formatting.black -- cgit v1.2.3 From 25818229402478eb811b68f75cb786542f2be994 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 27 Jun 2023 14:59:13 +0200 Subject: Include .vim in find_configs --- lua/plugins/telescope.lua | 401 +++++++++++++++++++++++----------------------- 1 file changed, 202 insertions(+), 199 deletions(-) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index d6d7233..eaf731c 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -11,7 +11,7 @@ local fb_actions = require("telescope").extensions.file_browser.actions --local pickers = require("telescope.pickers") require('telescope').setup({ - defaults = { + defaults = { vimgrep_arguments = { "rg", "--color=never", @@ -37,7 +37,7 @@ require('telescope').setup({ "%.spl", --"%.log", "%[No Name%]", -- new files / sometimes folders (netrw) - "/$", -- ignore folders (netrw) + "/$", -- ignore folders (netrw) "node_modules", "%.png", "%.zip", @@ -49,112 +49,112 @@ require('telescope').setup({ "^music/", --"^node_modules/", --"^undodir/", - }, - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - --[""] = actions.close, - [""] = actions.close, -- close w/ one esc - --[""] = "close", -- close w/ one esc - [""] = actions.which_key, -- keys from pressing - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = actions.complete_tag, - [""] = actions.which_key, -- keys from pressing - --[""] = function(prompt_bufnr) - -- local selection = require("telescope.actions.state").get_selected_entry() - -- local dir = vim.fn.fnamemodify(selection.path, ":p:h") - -- require("telescope.actions").close(prompt_bufnr) - -- -- Depending on what you want put `cd`, `lcd`, `tcd` - -- vim.cmd(string.format("silent lcd %s", dir)) - --end, - }, - - n = { - [""] = actions.close, + }, + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + --[""] = actions.close, + [""] = actions.close, -- close w/ one esc + --[""] = "close", -- close w/ one esc + [""] = actions.which_key, -- keys from pressing + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + [""] = actions.which_key, -- keys from pressing + --[""] = function(prompt_bufnr) + -- local selection = require("telescope.actions.state").get_selected_entry() + -- local dir = vim.fn.fnamemodify(selection.path, ":p:h") + -- require("telescope.actions").close(prompt_bufnr) + -- -- Depending on what you want put `cd`, `lcd`, `tcd` + -- vim.cmd(string.format("silent lcd %s", dir)) + --end, + }, + + n = { + [""] = actions.close, [""] = actions.close, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, - ["H"] = actions.move_to_top, - ["M"] = actions.move_to_middle, - ["L"] = actions.move_to_bottom, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - ["?"] = actions.which_key, - --[""] = function(prompt_bufnr) - -- local selection = require("telescope.actions.state").get_selected_entry() - -- local dir = vim.fn.fnamemodify(selection.path, ":p:h") - -- require("telescope.actions").close(prompt_bufnr) - -- -- Depending on what you want put `cd`, `lcd`, `tcd` - -- vim.cmd(string.format("silent lcd %s", dir)) - --end, - }, - }, - }, - preview = { - filesize_limit = 3, - timeout = 250, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + ["H"] = actions.move_to_top, + ["M"] = actions.move_to_middle, + ["L"] = actions.move_to_bottom, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + ["?"] = actions.which_key, + --[""] = function(prompt_bufnr) + -- local selection = require("telescope.actions.state").get_selected_entry() + -- local dir = vim.fn.fnamemodify(selection.path, ":p:h") + -- require("telescope.actions").close(prompt_bufnr) + -- -- Depending on what you want put `cd`, `lcd`, `tcd` + -- vim.cmd(string.format("silent lcd %s", dir)) + --end, + }, + }, + }, + preview = { + filesize_limit = 3, + timeout = 250, + }, + selection_strategy = "reset", + sorting_strategy = "ascending", + scroll_strategy = "limit", + color_devicons = true, + layout_strategy = 'horizontal', + layout_config = { + horizontal = { + height = 0.95, + preview_cutoff = 70, + width = 0.92, + preview_width = { 0.55, max = 50 } + }, + bottom_pane = { + height = 12, + preview_cutoff = 70, + prompt_position = "bottom", }, - selection_strategy = "reset", - sorting_strategy = "ascending", - scroll_strategy = "limit", - color_devicons = true, - layout_strategy = 'horizontal', - layout_config = { - horizontal = { - height = 0.95, - preview_cutoff = 70, - width = 0.92, - preview_width = {0.55, max = 50} - }, - bottom_pane = { - height = 12, - preview_cutoff = 70, - prompt_position = "bottom", - }, - }, + }, --pickers = { -- live_grep = { -- disable_coordinates = true, @@ -165,89 +165,89 @@ require('telescope').setup({ -- }, -- }, --}, - --pickers = { - --lsp_references = { - -- prompt_prefix='⬅️', - -- show_line=false, - -- trim_text=true, - -- include_declaration=false, - -- initial_mode = "normal", - --}, - --lsp_definitions = { - -- prompt_prefix='➡️', - -- show_line=false, - -- trim_text=true, - -- initial_mode = "normal", - --}, - --lsp_document_symbols = { - -- prompt_prefix='* ', - -- show_line = false, - --}, - --treesitter = { - -- prompt_prefix=' ', - -- show_line = false, - --}, - --find_files = { - -- cwd='%:p:h', - -- prompt_prefix=' ', - -- hidden = true, - -- follow = true, - --}, - --keymaps = { prompt_prefix='? ' }, - --oldfiles = { prompt_prefix=' ' }, - --highlights = { prompt_prefix=' ' }, - --git_files = { - -- prompt_prefix=' ', - -- show_untracked = true, - -- path_display = { "tail" }, - --}, - --buffers = { - -- prompt_prefix=' ', - -- ignore_current_buffer = true, - -- initial_mode = "normal", - -- sort_mru = true, - --}, - --live_grep = { - -- cwd='%:p:h', - -- disable_coordinates=true, - -- prompt_title='Search in Folder', - -- prompt_prefix=' ', - --}, - --spell_suggest = { - -- initial_mode = "normal", - -- prompt_prefix = "暈", - -- theme = "cursor", - -- layout_config = { cursor = { width = 0.3 } } - --}, - --colorscheme = { - -- enable_preview = true, - -- prompt_prefix = '', - -- results_title = '', - -- layout_strategy = "bottom_pane", - --}, - --}, - - extensions = { - file_browser = { - theme = "dropdown", - -- disables netrw and use telescope-file-browser in its place - hijack_netrw = true, - mappings = { - -- your custom insert mode mappings - ["i"] = { - [""] = function() - vim.cmd("normal vbd") - end, + --pickers = { + --lsp_references = { + -- prompt_prefix='⬅️', + -- show_line=false, + -- trim_text=true, + -- include_declaration=false, + -- initial_mode = "normal", + --}, + --lsp_definitions = { + -- prompt_prefix='➡️', + -- show_line=false, + -- trim_text=true, + -- initial_mode = "normal", + --}, + --lsp_document_symbols = { + -- prompt_prefix='* ', + -- show_line = false, + --}, + --treesitter = { + -- prompt_prefix=' ', + -- show_line = false, + --}, + --find_files = { + -- cwd='%:p:h', + -- prompt_prefix=' ', + -- hidden = true, + -- follow = true, + --}, + --keymaps = { prompt_prefix='? ' }, + --oldfiles = { prompt_prefix=' ' }, + --highlights = { prompt_prefix=' ' }, + --git_files = { + -- prompt_prefix=' ', + -- show_untracked = true, + -- path_display = { "tail" }, + --}, + --buffers = { + -- prompt_prefix=' ', + -- ignore_current_buffer = true, + -- initial_mode = "normal", + -- sort_mru = true, + --}, + --live_grep = { + -- cwd='%:p:h', + -- disable_coordinates=true, + -- prompt_title='Search in Folder', + -- prompt_prefix=' ', + --}, + --spell_suggest = { + -- initial_mode = "normal", + -- prompt_prefix = "暈", + -- theme = "cursor", + -- layout_config = { cursor = { width = 0.3 } } + --}, + --colorscheme = { + -- enable_preview = true, + -- prompt_prefix = '', + -- results_title = '', + -- layout_strategy = "bottom_pane", + --}, + --}, + + extensions = { + file_browser = { + theme = "dropdown", + -- disables netrw and use telescope-file-browser in its place + hijack_netrw = true, + mappings = { + -- your custom insert mode mappings + ["i"] = { + [""] = function() + vim.cmd("normal vbd") + end, --[""] = fb_actions.goto_parent_dir, - }, - ["n"] = { - -- your custom normal mode mappings - ["N"] = fb_actions.create, - --[""] = fb_actions.goto_parent_dir, - --["/"] = function() - -- vim.cmd("startinsert") - --end, - }, + }, + ["n"] = { + -- your custom normal mode mappings + ["N"] = fb_actions.create, + --[""] = fb_actions.goto_parent_dir, + --["/"] = function() + -- vim.cmd("startinsert") + --end, + }, }, }, }, @@ -285,8 +285,9 @@ function M.find_configs() "~/.config/bspwm", "~/.config/sxhkd", "~/.config/picom", - "~/.ssh", "~/.bashrc", + "~/.ssh", + "~/.vim", }, -- cwd = "~/.config/nvim/", file_ignore_patterns = { @@ -297,6 +298,8 @@ function M.find_configs() --"^~/.config/tmux/plugins", "%.txt", ".git", + "autoload/plugged", + "plug.vim", }, layout_strategy = "horizontal", layout_config = { preview_width = 0.65, width = 0.75 }, @@ -378,16 +381,16 @@ end -------------------------------------------------------------------------------- local dropdown = require('telescope.themes').get_dropdown({ - hidden = true, - no_ignore = true, - previewer = false, - prompt_title = '', - preview_title = '', - results_title = '', - layout_config = { - --anchor = "S", - prompt_position = 'top' - }, + hidden = true, + no_ignore = true, + previewer = false, + prompt_title = '', + preview_title = '', + results_title = '', + layout_config = { + --anchor = "S", + prompt_position = 'top' + }, }) -- File browser always relative to buffer -- cgit v1.2.3 From 3b55026e71889c8b4dba6c61abb73ddb01e7d205 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 27 Jun 2023 21:39:24 +0200 Subject: Add telescope extension "flutter" --- lua/plugins/telescope.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index eaf731c..95c2381 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -266,6 +266,7 @@ require('telescope').load_extension('media_files') require('telescope').load_extension('notify') require('telescope').load_extension('dap') require("telescope").load_extension("session-lens") +require("telescope").load_extension("flutter") function M.find_configs() require("telescope.builtin").find_files { -- cgit v1.2.3 From f10a15743d5ad38ac7dd9fa37b50fc3cdadf64d0 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 27 Jun 2023 23:02:29 +0200 Subject: Add zcompdump to ignore --- lua/plugins/telescope.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 95c2381..1d9dd6b 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -32,6 +32,7 @@ require('telescope').setup({ --path_display = { "smart" }, file_ignore_patterns = { "packer_compiled.lua", + "zcompdump", "%.DS_Store", "%.git/", "%.spl", @@ -59,7 +60,7 @@ require('telescope').setup({ [""] = actions.move_selection_previous, --[""] = actions.close, - [""] = actions.close, -- close w/ one esc + [""] = actions.close, -- close w/ one esc --[""] = "close", -- close w/ one esc [""] = actions.which_key, -- keys from pressing @@ -187,12 +188,12 @@ require('telescope').setup({ -- prompt_prefix=' ', -- show_line = false, --}, - --find_files = { - -- cwd='%:p:h', - -- prompt_prefix=' ', - -- hidden = true, - -- follow = true, - --}, + find_files = { + cwd = '%:p:h', + prompt_prefix = ' ', + hidden = true, + follow = true, + }, --keymaps = { prompt_prefix='? ' }, --oldfiles = { prompt_prefix=' ' }, --highlights = { prompt_prefix=' ' }, @@ -301,6 +302,7 @@ function M.find_configs() ".git", "autoload/plugged", "plug.vim", + "zcompdump", }, layout_strategy = "horizontal", layout_config = { preview_width = 0.65, width = 0.75 }, -- cgit v1.2.3 From f191627cbfcdf481fc17c4422e4513a410a845fa Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 28 Jun 2023 23:53:07 +0200 Subject: Made colorscheme fallback --- lua/plugins/colorscheme.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 10f0432..14edbdf 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,11 +1,17 @@ -- Colorscheme -- Available colorschemes: -- [[ nightfly ayu onedark doom-one nvimgelion github_dark tokyonight ]] -local colorscheme = "tokyonight-night" -local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) + +-- Define default color scheme +local default_colorscheme = "tokyonight-night" +local fallback_colorscheme = "desert" + +-- Attempt to set the default color scheme +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. default_colorscheme) + +-- If the default color scheme is not found, use the fallback color scheme if not status_ok then - vim.notify("colorscheme " .. colorscheme .. " not found!") - return + vim.cmd("colorscheme " .. fallback_colorscheme) end --local function MyHighlights() @@ -26,7 +32,7 @@ end vim.api.nvim_command("syntax on") -vim.api.nvim_command("highlight Normal guibg=none") +vim.api.nvim_command("highlight Normal guibg=NONE") vim.api.nvim_command("highlight NormalNC guibg=none") vim.api.nvim_command("highlight SignColumn guibg=none") --vim.api.nvim_command("highlight FoldColumn guibg=none") -- cgit v1.2.3 From 28eeec6a448d837685bac7952442d37cee18a867 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 28 Jun 2023 23:53:47 +0200 Subject: Telescope find_files no_ignore = false --- lua/user/keys.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index e5e7099..208b9d7 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -291,7 +291,7 @@ map("n", "gm", ":Gmove") --end -- Telescope -map("n", "ff", function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end) -- find all files +map("n", "ff", function() require("telescope.builtin").find_files { hidden = true, no_ignore = false } end) -- find all files map("n", "fF", "lua require('telescope.builtin').find_files()") -- find files with hidden option map("n", "fg", "lua require('telescope.builtin').live_grep()") map("n", "fb", "lua require('telescope.builtin').buffers()") -- cgit v1.2.3 From a5978b5f380092313cc15c19a202b2bbe5a82a0c Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 28 Jun 2023 23:54:21 +0200 Subject: Install flutter-tools --- lua/user/pack.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index e416baf..6d613e2 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -328,6 +328,21 @@ return packer.startup(function(use) require("crates").setup() end, }) + use({ + "akinsho/flutter-tools.nvim", + requires = { + "nvim-lua/plenary.nvim", + "stevearc/dressing.nvim", -- optional for vim.ui.select + }, + config = function() + require('flutter-tools').setup({ + debugger = { + enabled = true, + run_via_dap = true, + }, + }) + end, + }) use({ "iamcco/markdown-preview.nvim", -- Markdown Preview run = function() vim.fn["mkdp#util#install"]() end, -- cgit v1.2.3 From 249fdc9204c5d9223e7910d1751595ed389f2596 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 28 Jun 2023 23:55:17 +0200 Subject: Add OpenEmulatorList --- lua/user/mods.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/user/mods.lua b/lua/user/mods.lua index 725ca6e..0b8eddc 100644 --- a/lua/user/mods.lua +++ b/lua/user/mods.lua @@ -263,4 +263,19 @@ vim.cmd([[ --autocmd FocusLost * lua require("user.mods").update_tmux_status() --autocmd CmdwinEnter,CmdwinLeave * lua require("user.mods").update_tmux_status() -------------------------------------------------- + +function OpenEmulatorList() + local emulatorsBuffer = vim.api.nvim_create_buf(false, true) + vim.api.nvim_buf_set_lines(emulatorsBuffer, 0, 0, true, {"Some text"}) + vim.api.nvim_open_win( + emulatorsBuffer, + false, + { + relative='win', row=3, col=3, width=12, height=3 + } + ) +end + +vim.api.nvim_create_user_command('OpenEmulators', OpenEmulatorList, {}) + return M -- cgit v1.2.3 From 4a60ee995a6324837533cd756884d76858133215 Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 29 Jun 2023 02:55:54 +0200 Subject: Add .profile and .zprofile to find_configs --- lua/plugins/telescope.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 1d9dd6b..6ee1408 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -290,6 +290,8 @@ function M.find_configs() "~/.bashrc", "~/.ssh", "~/.vim", + "~/.profile", + "~/.zprofile", }, -- cwd = "~/.config/nvim/", file_ignore_patterns = { -- cgit v1.2.3 From a573b865c919256f54c9232dbdba9f75ac4bf573 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 1 Jul 2023 02:41:17 +0200 Subject: Update nvim via nvim --- lua/user/mods.lua | 105 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 12 deletions(-) diff --git a/lua/user/mods.lua b/lua/user/mods.lua index 0b8eddc..91f7fa6 100644 --- a/lua/user/mods.lua +++ b/lua/user/mods.lua @@ -40,7 +40,8 @@ require("null-ls").setup({ buffer = bufnr, callback = function() -- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead - vim.lsp.buf.formatting_seq_sync() + --vim.lsp.buf.formatting_seq_sync() + vim.lsp.buf.format({ bufnr = bufnr }) end, }) end @@ -264,18 +265,98 @@ vim.cmd([[ --autocmd CmdwinEnter,CmdwinLeave * lua require("user.mods").update_tmux_status() -------------------------------------------------- -function OpenEmulatorList() - local emulatorsBuffer = vim.api.nvim_create_buf(false, true) - vim.api.nvim_buf_set_lines(emulatorsBuffer, 0, 0, true, {"Some text"}) - vim.api.nvim_open_win( - emulatorsBuffer, - false, - { - relative='win', row=3, col=3, width=12, height=3 - } - ) +-- function OpenEmulatorList() +-- local emulatorsBuffer = vim.api.nvim_create_buf(false, true) +-- vim.api.nvim_buf_set_lines(emulatorsBuffer, 0, 0, true, {"Some text"}) +-- vim.api.nvim_open_win( +-- emulatorsBuffer, +-- false, +-- { +-- relative='win', row=3, col=3, width=12, height=3 +-- } +-- ) +-- end +-- +-- vim.api.nvim_create_user_command('OpenEmulators', OpenEmulatorList, {}) + + + +--local api = vim.api +--local fn = vim.fn +--local cmd = vim.cmd +-- +--local function bufremove(opts) +-- local target_buf_id = api.nvim_get_current_buf() +-- +-- -- Do nothing if buffer is in modified state. +-- if not opts.force and api.nvim_buf_get_option(target_buf_id, 'modified') then +-- return false +-- end +-- +-- -- Hide target buffer from all windows. +-- vim.tbl_map(function(win_id) +-- win_id = win_id or 0 +-- +-- local current_buf_id = api.nvim_win_get_buf(win_id) +-- +-- api.nvim_win_call(win_id, function() +-- -- Try using alternate buffer +-- local alt_buf_id = fn.bufnr('#') +-- if alt_buf_id ~= current_buf_id and fn.buflisted(alt_buf_id) == 1 then +-- api.nvim_win_set_buf(win_id, alt_buf_id) +-- return +-- end +-- +-- -- Try using previous buffer +-- cmd('bprevious') +-- if current_buf_id ~= api.nvim_win_get_buf(win_id) then +-- return +-- end +-- +-- -- Create new listed scratch buffer +-- local new_buf = api.nvim_create_buf(true, true) +-- api.nvim_win_set_buf(win_id, new_buf) +-- end) +-- +-- return true +-- end, fn.win_findbuf(target_buf_id)) +-- +-- cmd(string.format('bdelete%s %d', opts.force and '!' or '', target_buf_id)) +--end +-- +---- Assign bufremove to a global variable +--_G.bufremove = bufremove + +--vim.cmd([[ +-- augroup NvimTreeDelete +-- autocmd! +-- autocmd FileType NvimTree lua require('user.mods').enew_on_delete() +-- augroup END +--]]) +-- +--function M.enew_on_delete() +-- if vim.bo.buftype == 'nofile' then +-- vim.cmd('enew') +-- end +--end + +-- Update Neovim +function M.Update_neovim() + -- Run the commands to download and extract the latest version + os.execute("curl -L -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz") + os.execute("tar xzvf nvim-linux64.tar.gz") + -- Replace the existing Neovim installation with the new version + os.execute("rm -rf $HOME/.local/bin/nvim") + os.execute("mv nvim-linux64 $HOME/.local/bin/nvim") + + -- Clean up the downloaded file + os.execute("rm nvim-linux64.tar.gz") + + -- Print a message to indicate the update is complete + print("Neovim has been updated to the latest version.") end -vim.api.nvim_create_user_command('OpenEmulators', OpenEmulatorList, {}) +-- Bind a keymap to the update_neovim function (optional) +vim.api.nvim_set_keymap('n', 'u', ' lua require("user.mods").Update_neovim()', { noremap = true, silent = true }) return M -- cgit v1.2.3 From 08b09c3f2044b095271e2e1c1d1e58e09dda3ab3 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 1 Jul 2023 18:53:06 +0200 Subject: Removed prettier.nvim --- lua/user/pack.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 6d613e2..5f5cb1e 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -63,8 +63,8 @@ return packer.startup(function(use) -- lsp use("williamboman/mason.nvim") -- Package manager to install and manage LSP servers, DAP servers, linters and formatters - use("williamboman/mason-lspconfig.nvim") -- Bridges mason.nvim with nvim-lspconfig to help use them together use("neovim/nvim-lspconfig") -- Collection of LSP configs + use("williamboman/mason-lspconfig.nvim") -- Bridges mason.nvim with nvim-lspconfig to help use them together use({ "https://git.sr.ht/~whynothugo/lsp_lines.nvim", config = function() @@ -276,7 +276,7 @@ return packer.startup(function(use) }) use("rcarriga/nvim-notify") -- Notification plugin use("karb94/neoscroll.nvim") -- Faster/smooth scrolling - use("MunifTanjim/prettier.nvim") -- Prettier plugin for Neovim's built-in LSP client + --use("MunifTanjim/prettier.nvim") -- Prettier plugin for Neovim's built-in LSP client use({ 'norcalli/nvim-colorizer.lua', -- colorize hexa and rgb strings cmd = { 'ColorizerToggle', 'ColorizerAttachToBuffer' }, -- cgit v1.2.3 From 7716a5d72dfcd74635c5e36aab3c1c035cb71dc8 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 1 Jul 2023 18:56:22 +0200 Subject: Install princejoogie/dir-telescope.nvim --- lua/user/pack.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 5f5cb1e..30632c0 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -155,6 +155,7 @@ return packer.startup(function(use) use({ "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }) -- Search emoji(s) and other symbols use("nvim-telescope/telescope-dap.nvim") use("axkirillov/telescope-changed-files") -- + use("princejoogie/dir-telescope.nvim") -- UX use("folke/neodev.nvim") -- cgit v1.2.3 From ca7e8d87ba7a80f5dee35d4ca146d1334ce97d4c Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 1 Jul 2023 23:52:18 +0200 Subject: Removed princejoogie/dir-telescope.nvim --- lua/user/pack.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 30632c0..30ccbfe 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -155,7 +155,6 @@ return packer.startup(function(use) use({ "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }) -- Search emoji(s) and other symbols use("nvim-telescope/telescope-dap.nvim") use("axkirillov/telescope-changed-files") -- - use("princejoogie/dir-telescope.nvim") -- UX use("folke/neodev.nvim") @@ -201,7 +200,11 @@ return packer.startup(function(use) "folke/trouble.nvim", requires = "nvim-tree/nvim-web-devicons", }) - use("airblade/vim-rooter") -- + use({ "airblade/vim-rooter", -- + --vim.cmd("let g:rooter_change_directory_for_non_project_files = ''"), + vim.cmd("let g:rooter_change_directory_for_non_project_files = 'current'") + }) + --use("vim-test/vim-test") -- --use({ -- "rcarriga/vim-ultest", -- -- cgit v1.2.3 From a459a3bdba87cec9d18347f70ede9b6f5a735e99 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 1 Jul 2023 23:53:03 +0200 Subject: Add Toggle_executable function --- lua/user/mods.lua | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 5 deletions(-) diff --git a/lua/user/mods.lua b/lua/user/mods.lua index 91f7fa6..e4fe494 100644 --- a/lua/user/mods.lua +++ b/lua/user/mods.lua @@ -159,6 +159,27 @@ end --]]) +-------------------------------------------------- + +-- Toggle the executable permission +function M.Toggle_executable() + local current_file = vim.fn.expand('%:p') + local executable = vim.fn.executable(current_file) == 1 + + if executable then + -- File is executable, unset the executable permission + vim.fn.system('chmod -x ' .. current_file) + --print(current_file .. ' is no longer executable.') + print("No longer executable") + else + -- File is not executable, set the executable permission + vim.fn.system('chmod +x ' .. current_file) + --print(current_file .. ' is now executable.') + print("Now executable") + end +end + + -------------------------------------------------- -- Set bare dotfiles repository git environment variables dynamically @@ -341,22 +362,74 @@ vim.cmd([[ --end -- Update Neovim +--function M.Update_neovim() +-- -- Run the commands to download and extract the latest version +-- os.execute("curl -L -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz") +-- os.execute("tar xzvf nvim-linux64.tar.gz") +-- -- Replace the existing Neovim installation with the new version +-- os.execute("rm -rf $HOME/.local/bin/nvim") +-- os.execute("mv nvim-linux64 $HOME/.local/bin/nvim") +-- +-- -- Clean up the downloaded file +-- os.execute("rm nvim-linux64.tar.gz") +-- +-- -- Print a message to indicate the update is complete +-- print("Neovim has been updated to the latest version.") +--end +-- +---- Bind a keymap to the update_neovim function (optional) +--vim.api.nvim_set_keymap('n', 'u', ' lua require("user.mods").Update_neovim()', { noremap = true, silent = true }) + +-- Define a function to create a floating window and run the update process inside it function M.Update_neovim() - -- Run the commands to download and extract the latest version + -- Create a new floating window + local bufnr, winid = vim.api.nvim_create_buf(false, true) + vim.api.nvim_open_win(bufnr, true, { + relative = "editor", + width = 80, + height = 20, + row = 2, + col = 2, + style = "minimal", + border = "single", + }) + + -- Function to append a line to the buffer in the floating window + local function append_line(line) + vim.api.nvim_buf_set_option(bufnr, "modifiable", true) + vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, { line }) + vim.api.nvim_buf_set_option(bufnr, "modifiable", false) + end + + -- Download the latest version of Neovim + append_line("Downloading the latest version of Neovim...") os.execute("curl -L -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz") + append_line("Download complete.") + + -- Extract the downloaded archive + append_line("Extracting the downloaded archive...") os.execute("tar xzvf nvim-linux64.tar.gz") + append_line("Extraction complete.") + -- Replace the existing Neovim installation with the new version - os.execute("rm -rf $HOME/.local/bin/nvim") - os.execute("mv nvim-linux64 $HOME/.local/bin/nvim") + append_line("Replacing the existing Neovim installation...") + os.execute("rm -rf $HOME/nvim") + os.execute("mv nvim-linux64 $HOME/nvim") + append_line("Update complete.") -- Clean up the downloaded file + append_line("Cleaning up the downloaded file...") os.execute("rm nvim-linux64.tar.gz") + append_line("Cleanup complete.") - -- Print a message to indicate the update is complete - print("Neovim has been updated to the latest version.") + -- Close the floating window after a delay + vim.defer_fn(function() + vim.api.nvim_win_close(winid, true) + end, 5000) -- Adjust the delay as needed end -- Bind a keymap to the update_neovim function (optional) vim.api.nvim_set_keymap('n', 'u', ' lua require("user.mods").Update_neovim()', { noremap = true, silent = true }) + return M -- cgit v1.2.3 From 648367c39c636adc069410a1e26c2074a283d46c Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 1 Jul 2023 23:53:35 +0200 Subject: Made Change file to an executable conditional --- lua/user/keys.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 208b9d7..f049957 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -170,7 +170,8 @@ map("i", "", "") map("n", "", "!clear") -- Change file to an executable -map("n", "x", ":!chmod +x %") +map("n", "x", ":lua require('user.mods').Toggle_executable() | :echom ('Toggle executable') | :sl! | echo ('')") +--map("n", "x", ":!chmod +x %") -- Paste without replace clipboard map("v", "p", '"_dP') @@ -292,7 +293,7 @@ map("n", "gm", ":Gmove") -- Telescope map("n", "ff", function() require("telescope.builtin").find_files { hidden = true, no_ignore = false } end) -- find all files -map("n", "fF", "lua require('telescope.builtin').find_files()") -- find files with hidden option +--map("n", "fF", "lua require('telescope.builtin').find_files()") -- find files with hidden option map("n", "fg", "lua require('telescope.builtin').live_grep()") map("n", "fb", "lua require('telescope.builtin').buffers()") map("n", "fh", "lua require('telescope.builtin').help_tags()") @@ -310,6 +311,12 @@ map("n", "fs", [[lua require'plugins.telescope'.find_scripts()] map("n", "fw", [[lua require'plugins.telescope'.find_projects()]]) -- find projects map("n", "fm", "lua require('telescope').extensions.media_files.media_files({})") -- find media files map("n", "fi", "lua require('telescope').extensions.notify.notify({})") -- find notifications +map("n", "f/", "lua require('plugins.telescope').curbuf()") -- find files with hidden option + +local builtin = require("telescope.builtin") +local utils = require("telescope.utils") + +map("n", "fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, { desc = "Find files in cwd" }) -- FZF map("n", "fz", "lua require('fzf-lua').files()") @@ -396,7 +403,7 @@ map("n", "dq", function() require("nvim-dap-virtual-text").refresh() end, { desc = "Terminate Debug" }) map("n", "dc", function() - require("telescope").extensions.dap.commands() + require("telescope").extensions.dap.commands() end, { desc = "DAP-Telescope: Commands" }) --vim.keymap.set("n", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("v", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") -- cgit v1.2.3 From 8ba3f2fe567783493f70ed503f11b8aea01e2622 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 1 Jul 2023 23:54:00 +0200 Subject: Fixed ensured_installed not working --- lua/plugins/lsp.lua | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 2c0befb..ba577bc 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,8 +1,8 @@ require('mason').setup() -local lspconfig = require 'lspconfig' -local mason_lspconfig = require 'mason-lspconfig' -local null_ls = require 'null-ls' ---local lsp_lines = require 'lsp_lines' +local lspconfig = require('lspconfig') +local mason_lspconfig = require('mason-lspconfig') +local null_ls = require('null-ls') +--local lsp_lines = require('lsp_lines') local keymap = vim.keymap local cmd = vim.cmd @@ -179,6 +179,26 @@ local servers = { }, }, }, + dartls = ({ + cmd = { "dart", "language-server", "--protocol=lsp" }, + filetypes = { "dart" }, + init_options = { + closingLabels = true, + flutterOutline = true, + onlyAnalyzeProjectsWithOpenFiles = true, + outline = true, + suggestFromUnimportedLibraries = true, + }, + -- root_dir = root_pattern("pubspec.yaml"), + settings = { + dart = { + completeFunctionCalls = true, + showTodos = true, + }, + }, + on_attach = function(client, bufnr) + end, + }), lua_ls = ({ on_attach = on_attach, capabilities = capabilities, @@ -226,6 +246,19 @@ mason_lspconfig.setup({ automatic_installation = true, }) +-- Linters/Formatters ensure installed +local registry = require("mason-registry") +for _, pkg_name in ipairs { "dart-debug-Adaptor", "stylua", "prettier", "prettierd" } do + local ok, pkg = pcall(registry.get_package, pkg_name) + if ok then + if not pkg:is_installed() then + pkg:install() + end + end +end + +require("lspconfig").dartls.setup {capabilities = capabilities,} + for server, config in pairs(servers) do if config.prefer_null_ls then if config.on_attach then @@ -307,12 +340,12 @@ null_ls.setup { builtins.formatting.isort, builtins.formatting.htmlbeautifier, -- null_ls.builtins.formatting.prettier, + builtins.formatting.prettierd, builtins.formatting.prettier.with({ filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "json", "yaml", "markdown", "html", "css", "scss", "less", "graphql", "vue", "svelte" }, extra_args = { "--single-quote", "--tab-width 4", "--print-width 200" }, }), - builtins.formatting.prettierd, builtins.formatting.rustfmt, builtins.formatting.stylua, builtins.formatting.dart_format, -- cgit v1.2.3 From 2a41364eb4d164b245b7ec345a3c9a103adea625 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 2 Jul 2023 14:24:40 +0200 Subject: Add findFilesInCwd function --- lua/user/mods.lua | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/lua/user/mods.lua b/lua/user/mods.lua index e4fe494..f00621d 100644 --- a/lua/user/mods.lua +++ b/lua/user/mods.lua @@ -158,6 +158,18 @@ end --autocmd User RooterChDir :sleep! | call LogTrigger(timer) | call ConfigureChDir() --]]) +function M.findFilesInCwd() + vim.cmd("let g:rooter_manual_only = 1") -- Toggle the rooter plugin + require("plugins.telescope").findhere() + vim.defer_fn(function() + vim.cmd("let g:rooter_manual_only = 0") -- Change back to automatic rooter + end, 100) +end +--function M.findFilesInCwd() +-- vim.cmd("let g:rooter_manual_only = 1") -- Toggle the rooter plugin +-- require("plugins.telescope").findhere() +-- --vim.cmd("let g:rooter_manual_only = 0") -- Change back to automatic rooter +--end -------------------------------------------------- @@ -179,7 +191,6 @@ function M.Toggle_executable() end end - -------------------------------------------------- -- Set bare dotfiles repository git environment variables dynamically @@ -255,7 +266,7 @@ function M.update_tmux_status() file:close() if nvim_running then -- Neovim is running, update the mode file and refresh tmux - VI_MODE = "" -- Clear VI_MODE to show Neovim mode + VI_MODE = "" -- Clear VI_MODE to show Neovim mode vim.cmd("silent !tmux refresh-client -S") end ---- Force tmux to update the status @@ -275,15 +286,15 @@ vim.cmd([[ -- Add autocmd for -- Add autocmd to check when tmux switches panes/windows - --autocmd InsertLeave,InsertEnter * lua require("user.mods").update_tmux_status() - --autocmd BufEnter * lua require("user.mods").update_tmux_status() - --autocmd WinEnter,WinLeave * lua require("user.mods").update_tmux_status() - - --autocmd WinEnter,WinLeave * lua require("user.mods").update_tmux_status() - --autocmd VimResized * lua require("user.mods").update_tmux_status() - --autocmd FocusGained * lua require("user.mods").update_tmux_status() - --autocmd FocusLost * lua require("user.mods").update_tmux_status() - --autocmd CmdwinEnter,CmdwinLeave * lua require("user.mods").update_tmux_status() +--autocmd InsertLeave,InsertEnter * lua require("user.mods").update_tmux_status() +--autocmd BufEnter * lua require("user.mods").update_tmux_status() +--autocmd WinEnter,WinLeave * lua require("user.mods").update_tmux_status() + +--autocmd WinEnter,WinLeave * lua require("user.mods").update_tmux_status() +--autocmd VimResized * lua require("user.mods").update_tmux_status() +--autocmd FocusGained * lua require("user.mods").update_tmux_status() +--autocmd FocusLost * lua require("user.mods").update_tmux_status() +--autocmd CmdwinEnter,CmdwinLeave * lua require("user.mods").update_tmux_status() -------------------------------------------------- -- function OpenEmulatorList() @@ -297,7 +308,7 @@ vim.cmd([[ -- } -- ) -- end --- +-- -- vim.api.nvim_create_user_command('OpenEmulators', OpenEmulatorList, {}) @@ -403,7 +414,8 @@ function M.Update_neovim() -- Download the latest version of Neovim append_line("Downloading the latest version of Neovim...") - os.execute("curl -L -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz") + os.execute( + "curl -L -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz") append_line("Download complete.") -- Extract the downloaded archive @@ -429,7 +441,8 @@ function M.Update_neovim() end -- Bind a keymap to the update_neovim function (optional) -vim.api.nvim_set_keymap('n', 'u', ' lua require("user.mods").Update_neovim()', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'u', ' lua require("user.mods").Update_neovim()', + { noremap = true, silent = true }) return M -- cgit v1.2.3 From 562f574eb5f9ea88090aa6c2213586b61bddf9ab Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 2 Jul 2023 14:25:05 +0200 Subject: Keybinding for findFilesInCwd function --- lua/user/keys.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index f049957..0c5697d 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -316,7 +316,9 @@ map("n", "f/", "lua require('plugins.telescope').curbuf()") local builtin = require("telescope.builtin") local utils = require("telescope.utils") -map("n", "fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, { desc = "Find files in cwd" }) + +--map("n", "fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, { desc = "Find files in cwd" }) +map("n", "fF", ":cd %:p:h:pwdlua require('user.mods').findFilesInCwd()", { noremap = true, silent = true, desc = "Find files in cwd" }) -- FZF map("n", "fz", "lua require('fzf-lua').files()") -- cgit v1.2.3 From ae6916cbd8ed1b36336ab59c337197172b7bf8ce Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 2 Jul 2023 14:25:38 +0200 Subject: Fixed findhere function --- lua/plugins/telescope.lua | 95 +++++++++++++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 32 deletions(-) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 6ee1408..d37c807 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -9,6 +9,8 @@ local fb_actions = require("telescope").extensions.file_browser.actions --local action_state = require("telescope.actions.state") --local layout_actions = require("telescope.actions.layout") --local pickers = require("telescope.pickers") +local themes = require("telescope.themes") + require('telescope').setup({ defaults = { @@ -92,8 +94,14 @@ require('telescope').setup({ -- vim.cmd(string.format("silent lcd %s", dir)) --end, }, - n = { + ["cd"] = function(prompt_bufnr) + local selection = require("telescope.actions.state").get_selected_entry() + local dir = vim.fn.fnamemodify(selection.path, ":p:h") + require("telescope.actions").close(prompt_bufnr) + -- Depending on what you want put `cd`, `lcd`, `tcd` + vim.cmd(string.format("silent lcd %s", dir)) + end, [""] = actions.close, [""] = actions.close, [""] = actions.select_default, @@ -166,6 +174,18 @@ require('telescope').setup({ -- }, -- }, --}, + pickers = { + live_grep = { + mappings = { + i = { + [""] = ts_select_dir_for_grep, + }, + n = { + [""] = ts_select_dir_for_grep, + }, + }, + }, + }, --pickers = { --lsp_references = { -- prompt_prefix='⬅️', @@ -190,6 +210,7 @@ require('telescope').setup({ --}, find_files = { cwd = '%:p:h', + --cwd = vim.fn.getcwd(), prompt_prefix = ' ', hidden = true, follow = true, @@ -269,6 +290,16 @@ require('telescope').load_extension('dap') require("telescope").load_extension("session-lens") require("telescope").load_extension("flutter") +M.curbuf = function(opts) + opts = opts + or themes.get_dropdown({ + previewer = false, + shorten_path = false, + border = true, + }) + require("telescope.builtin").current_buffer_fuzzy_find(opts) +end + function M.find_configs() require("telescope.builtin").find_files { hidden = true, @@ -292,6 +323,7 @@ function M.find_configs() "~/.vim", "~/.profile", "~/.zprofile", + "~/README.md", }, -- cwd = "~/.config/nvim/", file_ignore_patterns = { @@ -421,37 +453,36 @@ local with_title = function(opts, extra) }, extra or {}) end -----vim.api.nvim_create_augroup('startup', { clear = true }) -----vim.api.nvim_command('augroup startup') -----vim.api.nvim_command('autocmd!') -----vim.api.nvim_command('autocmd VimEnter * lua require("plugins/telescope").startup()') -----vim.api.nvim_command('augroup END') --- --- +--vim.api.nvim_create_augroup('findhere', { clear = true }) +--vim.api.nvim_command('augroup findhere') +--vim.api.nvim_command('autocmd!') +--vim.api.nvim_command('autocmd VimEnter * lua require("plugins/telescope").findhere()') +--vim.api.nvim_command('augroup END') + + --local startup = function() --- -- Open file browser if argument is a folder --- local arg = vim.api.nvim_eval('argv(0)') --- if arg and (vim.fn.isdirectory(arg) ~= 0 or arg == "") then --- vim.defer_fn(function() --- require('telescope.builtin').find_files(with_title(dropdown)) ----- require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ ----- hidden = true, ----- results_title = '', ----- layout_config = { prompt_position = 'top' }, ----- })) --- end, 10) --- end ---end --- --- --- ----- Define the custom command startup/findhere ---vim.cmd('command! Startup lua require("plugins.telescope").startup()') ---vim.cmd('command! Findhere lua require("plugins.telescope").startup()') --- -----vim.api.nvim_command('autocmd VimEnter * lua require("plugins/telescope").startup()') --- ----- Merge the existing M table with the startup function table ---M = vim.tbl_extend('force', M, { startup = startup }) +function M.findhere() + -- Open file browser if argument is a folder + local arg = vim.api.nvim_eval('argv(0)') + if arg and (vim.fn.isdirectory(arg) ~= 0 or arg == "") then + vim.defer_fn(function() + require('telescope.builtin').find_files(with_title(dropdown)) +-- require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ +-- hidden = true, +-- results_title = '', +-- layout_config = { prompt_position = 'top' }, +-- })) + end, 10) + end +end + +-- Define the custom command findhere/startup +vim.cmd('command! Findhere lua require("plugins.telescope").startup()') +vim.cmd('command! Startup lua require("plugins.telescope").startup()') + +--vim.api.nvim_command('autocmd VimEnter * lua require("plugins/telescope").findhere()') + +-- Merge the existing M table with the startup function table +--M = vim.tbl_extend('force', M, { findhere = findhere }) return M -- cgit v1.2.3 From 60b84c6bd1fe30ce97245928ac3ef421a245e88d Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 3 Jul 2023 23:10:40 +0200 Subject: Install tpope/vim-unimpaired --- lua/user/pack.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 30ccbfe..d2fad3c 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -167,7 +167,7 @@ return packer.startup(function(use) use({ "tpope/vim-eunuch", cmd = { "Rename", "Delete" } }) -- Handy unix commands inside Vim (Rename, Move etc.) --use("tpope/vim-surround") -- --use("tpope/vim-obsession") -- - --use("tpope/vim-unimpaired") -- + use("tpope/vim-unimpaired") -- --use("vimpostor/vim-tpipeline") -- --use("nathom/filetype.nvim") -- use({ "myusuf3/numbers.vim", -- @@ -202,7 +202,7 @@ return packer.startup(function(use) }) use({ "airblade/vim-rooter", -- --vim.cmd("let g:rooter_change_directory_for_non_project_files = ''"), - vim.cmd("let g:rooter_change_directory_for_non_project_files = 'current'") + --vim.cmd("let g:rooter_change_directory_for_non_project_files = 'current'") }) --use("vim-test/vim-test") -- -- cgit v1.2.3 From a650cc3671583333fd0e932360c2e2e9bf32673c Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 3 Jul 2023 23:50:45 +0200 Subject: Clean config --- lua/user/keys.lua | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 0c5697d..a20b0ea 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -311,13 +311,7 @@ map("n", "fs", [[lua require'plugins.telescope'.find_scripts()] map("n", "fw", [[lua require'plugins.telescope'.find_projects()]]) -- find projects map("n", "fm", "lua require('telescope').extensions.media_files.media_files({})") -- find media files map("n", "fi", "lua require('telescope').extensions.notify.notify({})") -- find notifications -map("n", "f/", "lua require('plugins.telescope').curbuf()") -- find files with hidden option - -local builtin = require("telescope.builtin") -local utils = require("telescope.utils") - - ---map("n", "fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, { desc = "Find files in cwd" }) +--map("n", "f/", "lua require('plugins.telescope').curbuf()") -- find files with hidden option map("n", "fF", ":cd %:p:h:pwdlua require('user.mods').findFilesInCwd()", { noremap = true, silent = true, desc = "Find files in cwd" }) -- FZF -- cgit v1.2.3 From 9bbeb0b7f16b2a825712033155978080d7d7ff08 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 4 Jul 2023 22:20:37 +0200 Subject: Add TODOS --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 630b8e5..2659734 100644 --- a/README.md +++ b/README.md @@ -1 +1,7 @@ ## Neovim + +#### TODOS: +- [ ] Markdown filetype plugin or autocommand to add two spaces each line. +- [ ] Markdown filetype plugin or autocommand to make backtick auto-correct properly. +- [ ] Check history or telescope history of last files edited or opened. + -- cgit v1.2.3 From 0d9ee32a9921bcc67261a340d593d005dea55f54 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 4 Jul 2023 22:21:31 +0200 Subject: Troubleshooting config messing up with floating windows --- lua/plugins/telescope.lua | 68 +++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index d37c807..9efdf32 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -95,13 +95,13 @@ require('telescope').setup({ --end, }, n = { - ["cd"] = function(prompt_bufnr) - local selection = require("telescope.actions.state").get_selected_entry() - local dir = vim.fn.fnamemodify(selection.path, ":p:h") - require("telescope.actions").close(prompt_bufnr) - -- Depending on what you want put `cd`, `lcd`, `tcd` - vim.cmd(string.format("silent lcd %s", dir)) - end, + --["cd"] = function(prompt_bufnr) + -- local selection = require("telescope.actions.state").get_selected_entry() + -- local dir = vim.fn.fnamemodify(selection.path, ":p:h") + -- require("telescope.actions").close(prompt_bufnr) + -- -- Depending on what you want put `cd`, `lcd`, `tcd` + -- vim.cmd(string.format("silent lcd %s", dir)) + --end, [""] = actions.close, [""] = actions.close, [""] = actions.select_default, @@ -174,18 +174,18 @@ require('telescope').setup({ -- }, -- }, --}, - pickers = { - live_grep = { - mappings = { - i = { - [""] = ts_select_dir_for_grep, - }, - n = { - [""] = ts_select_dir_for_grep, - }, - }, - }, - }, + --pickers = { + -- live_grep = { + -- mappings = { + -- i = { + -- [""] = ts_select_dir_for_grep, + -- }, + -- n = { + -- [""] = ts_select_dir_for_grep, + -- }, + -- }, + -- }, + --}, --pickers = { --lsp_references = { -- prompt_prefix='⬅️', @@ -290,15 +290,15 @@ require('telescope').load_extension('dap') require("telescope").load_extension("session-lens") require("telescope").load_extension("flutter") -M.curbuf = function(opts) - opts = opts - or themes.get_dropdown({ - previewer = false, - shorten_path = false, - border = true, - }) - require("telescope.builtin").current_buffer_fuzzy_find(opts) -end +--M.curbuf = function(opts) +-- opts = opts +-- or themes.get_dropdown({ +-- previewer = false, +-- shorten_path = false, +-- border = true, +-- }) +-- require("telescope.builtin").current_buffer_fuzzy_find(opts) +--end function M.find_configs() require("telescope.builtin").find_files { @@ -431,9 +431,9 @@ local dropdown = require('telescope.themes').get_dropdown({ }) -- File browser always relative to buffer -local opts_file_browser = vim.tbl_extend('force', dropdown, { - path_display = { '%:p:h' }, -}) +--local opts_file_browser = vim.tbl_extend('force', dropdown, { +-- path_display = { '%:p:h' }, +--}) -- Set current folder as prompt title local with_title = function(opts, extra) @@ -460,7 +460,7 @@ end --vim.api.nvim_command('augroup END') ---local startup = function() +--local findhere = function() function M.findhere() -- Open file browser if argument is a folder local arg = vim.api.nvim_eval('argv(0)') @@ -477,8 +477,8 @@ function M.findhere() end -- Define the custom command findhere/startup -vim.cmd('command! Findhere lua require("plugins.telescope").startup()') -vim.cmd('command! Startup lua require("plugins.telescope").startup()') +vim.cmd('command! Findhere lua require("plugins.telescope").findhere()') +--vim.cmd('command! Startup lua require("plugins.telescope").findhere()') --vim.api.nvim_command('autocmd VimEnter * lua require("plugins/telescope").findhere()') -- cgit v1.2.3 From 9bfc5e3388005851963924ce317dd50bdea2e4eb Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 4 Jul 2023 22:23:19 +0200 Subject: Disabled prettier.nvim --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index bd05b8a..b3f7a93 100644 --- a/init.lua +++ b/init.lua @@ -31,7 +31,7 @@ -- Download nvim-linux64.tar.gz: --$ curl -L -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz -- Extract: ---$ tar xzvf nvim-linux64.tar.gz +--$ tar xzvf nvim-linux64.tar.gz --install-dir=/bin -- Run: --$ ./nvim-linux64/bin/nvim @@ -75,7 +75,7 @@ local modules = { "plugins.quickfix", --"plugins.snippets", --"plugins.colorizer", - "plugins.prettier", + --"plugins.prettier", --"plugins.git", "plugins.lsp", "plugins.gitsigns", -- cgit v1.2.3 From 1a64b340ffad0e0c06aec99dd8702d467ec41efe Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 8 Jul 2023 12:26:52 +0200 Subject: Add polybar to M.find_configs() --- lua/plugins/telescope.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 9efdf32..079f88b 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -318,6 +318,7 @@ function M.find_configs() "~/.config/bspwm", "~/.config/sxhkd", "~/.config/picom", + "~/.config/polybar", "~/.bashrc", "~/.ssh", "~/.vim", -- cgit v1.2.3 From 5433213e765a08043b8b6c6a257b537231c9bb91 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 11 Jul 2023 23:57:23 +0200 Subject: Changed colorscheme to doom-one --- lua/plugins/colorscheme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 14edbdf..c852bb0 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -3,7 +3,7 @@ -- [[ nightfly ayu onedark doom-one nvimgelion github_dark tokyonight ]] -- Define default color scheme -local default_colorscheme = "tokyonight-night" +local default_colorscheme = "doom-one" local fallback_colorscheme = "desert" -- Attempt to set the default color scheme -- cgit v1.2.3 From d72187703f539920b879439c73ebf4849cc3dbdd Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 13 Jul 2023 23:03:39 +0200 Subject: Changed colorscheme to tokyonight-night --- lua/plugins/colorscheme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index c852bb0..14edbdf 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -3,7 +3,7 @@ -- [[ nightfly ayu onedark doom-one nvimgelion github_dark tokyonight ]] -- Define default color scheme -local default_colorscheme = "doom-one" +local default_colorscheme = "tokyonight-night" local fallback_colorscheme = "desert" -- Attempt to set the default color scheme -- cgit v1.2.3