From c8075f06e081b0fe6a4b37339c22e921b0107a72 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 22 Jul 2024 22:53:56 +0300 Subject: feat(neovim): lazy loaded and refactored a bunch --- .config/nvim/after/ftplugin/c.lua | 0 .config/nvim/after/ftplugin/go.lua | 0 .config/nvim/after/ftplugin/java.lua | 0 .config/nvim/after/ftplugin/lua.lua | 0 .config/nvim/after/ftplugin/markdown.lua | 7 ++ .config/nvim/after/ftplugin/rust.lua | 0 .config/nvim/init.lua | 3 +- .config/nvim/lazy-lock.json | 18 +---- .../nvim/lua/custom/configs/language-servers.lua | 27 ++++--- .config/nvim/lua/custom/configs/statusline.lua | 92 ++++++++++++++++++++++ .config/nvim/lua/custom/configs/telescope.lua | 40 ++++++++++ .config/nvim/lua/custom/plugins/alpha.lua | 14 ++-- .config/nvim/lua/custom/plugins/colorschemes.lua | 30 +++---- .config/nvim/lua/custom/plugins/edgy.lua | 9 --- .config/nvim/lua/custom/plugins/motions.lua | 68 ---------------- .config/nvim/lua/custom/plugins/neotree.lua | 1 + .config/nvim/lua/custom/plugins/oil.lua | 53 +++++++------ .config/nvim/lua/custom/plugins/overseer.lua | 41 +++++----- .config/nvim/lua/custom/plugins/statusline.lua | 4 +- .config/nvim/lua/custom/plugins/telescope.lua | 11 ++- .config/nvim/lua/custom/plugins/treesitter.lua | 1 + .config/nvim/lua/custom/plugins/ui.lua | 2 - .config/nvim/lua/custom/plugins/utility.lua | 31 ++++++-- .config/nvim/lua/custom/statusline.lua | 92 ---------------------- .config/nvim/lua/custom/telescope.lua | 40 ---------- 25 files changed, 267 insertions(+), 317 deletions(-) delete mode 100644 .config/nvim/after/ftplugin/c.lua delete mode 100644 .config/nvim/after/ftplugin/go.lua delete mode 100644 .config/nvim/after/ftplugin/java.lua delete mode 100644 .config/nvim/after/ftplugin/lua.lua create mode 100644 .config/nvim/after/ftplugin/markdown.lua delete mode 100644 .config/nvim/after/ftplugin/rust.lua create mode 100644 .config/nvim/lua/custom/configs/statusline.lua create mode 100644 .config/nvim/lua/custom/configs/telescope.lua delete mode 100644 .config/nvim/lua/custom/plugins/motions.lua delete mode 100644 .config/nvim/lua/custom/plugins/ui.lua delete mode 100644 .config/nvim/lua/custom/statusline.lua delete mode 100644 .config/nvim/lua/custom/telescope.lua (limited to '.config/nvim') diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua deleted file mode 100644 index e69de29..0000000 diff --git a/.config/nvim/after/ftplugin/go.lua b/.config/nvim/after/ftplugin/go.lua deleted file mode 100644 index e69de29..0000000 diff --git a/.config/nvim/after/ftplugin/java.lua b/.config/nvim/after/ftplugin/java.lua deleted file mode 100644 index e69de29..0000000 diff --git a/.config/nvim/after/ftplugin/lua.lua b/.config/nvim/after/ftplugin/lua.lua deleted file mode 100644 index e69de29..0000000 diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..792a1ae --- /dev/null +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,7 @@ +vim.opt.wrap = true +vim.opt.breakindent = true +vim.opt.linebreak = true +vim.opt.spelllang = 'en_us' +vim.opt.spell = true +vim.keymap.set('n', 'j', 'gj') +vim.keymap.set('n', 'k', 'gk') diff --git a/.config/nvim/after/ftplugin/rust.lua b/.config/nvim/after/ftplugin/rust.lua deleted file mode 100644 index e69de29..0000000 diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 92b028a..36b3116 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,4 +1,5 @@ -vim.loader.enable() -- WARNING: potentially sppeds up loading, it's experimental so I added the warning +vim.loader.enable() + vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index bad9a6e..d2c16ff 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -4,24 +4,18 @@ "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, "auto-save.nvim": { "branch": "main", "commit": "5fe9ab0c42f0457f2a973e814a6352b8eeb04730" }, "auto-session": { "branch": "main", "commit": "08c279882d4117a3e6ade1a014f7cf4af7c34fec" }, - "awesome-vim-colorschemes": { "branch": "master", "commit": "ae5e02298c8de6a5aa98fe4d29a21874cfcc3619" }, - "bluloco.nvim": { "branch": "main", "commit": "07f4b5cca8cfe31aad69ab5c1be0f6a0715a8d2e" }, + "buffer_manager.nvim": { "branch": "main", "commit": "fd36131b2b3e0f03fd6353ae2ffc88cf920b3bbb" }, "ccc.nvim": { "branch": "main", "commit": "4fb5abaef2f2e0540fe22d4d74a9841205fff9e4" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "darcula": { "branch": "master", "commit": "faf8dbab27bee0f27e4f1c3ca7e9695af9b1242b" }, - "darcula-solid.nvim": { "branch": "main", "commit": "d950b9ca20096313c435a93e57af7815766f3d3d" }, - "darkstorm.nvim": { "branch": "master", "commit": "bab84a698e5a7bec92bd9d24acbd54554502e35e" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "edgy.nvim": { "branch": "main", "commit": "0e8bbab4eba9dab6c237e4a2e146dc0466897be6" }, - "github-nvim-theme": { "branch": "main", "commit": "5fa5e70aad19643c97f90decf4d0a3ac58f4e95f" }, "gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, "indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" }, - "kanagawa.nvim": { "branch": "master", "commit": "e5f7b8a804360f0a48e40d0083a97193ee4fcc87" }, "lazy.nvim": { "branch": "main", "commit": "9a374a0fb4d3ac42dac4a129d4bead7252473c77" }, - "lazydev.nvim": { "branch": "main", "commit": "02f1055a777264d4b65896051ec28d0f322f7932" }, + "lazydev.nvim": { "branch": "main", "commit": "399299ca570aa82c13ee4fb1bd1304ce6baf7f05" }, "leap.nvim": { "branch": "main", "commit": "a9a9faee45066f2796c9a0e0ef52bf571d144492" }, "lsp-progress.nvim": { "branch": "main", "commit": "d5f4d28efe75ce636bfbe271eb45f39689765aab" }, "lsp_lines.nvim": { "branch": "main", "commit": "7d9e2748b61bff6ebba6e30adbc7173ccf21c055" }, @@ -29,20 +23,14 @@ "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lspsaga.nvim": { "branch": "main", "commit": "6f920cfabddb9b7de5a3a4d0b7cd4f0774ae23e2" }, "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, - "lush.nvim": { "branch": "main", "commit": "1b66ab197b177aabc2270a2c9cb8019fa5a367df" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "material.nvim": { "branch": "main", "commit": "b5d0ff3ad37ba00cea3dc3dce0b0f555b481c6f4" }, - "min-theme.nvim": { "branch": "main", "commit": "23ea3e1dd9e281973b4732cea0968f6d2ab72c47" }, "mini.nvim": { "branch": "main", "commit": "eee6fb8efbeb5d792215de9a0bc9282603aa9fcc" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, "neogit": { "branch": "master", "commit": "af1d8d88f426a4da63c913f3b81a37350dbe8d02" }, - "neovim": { "branch": "main", "commit": "9e4320d0bab7f261921d6af7d1c1bbc1a1e3dc67" }, - "nightfox.nvim": { "branch": "main", "commit": "df75a6a94910ae47854341d6b5a6fd483192c0eb" }, "none-ls.nvim": { "branch": "main", "commit": "2cde745aadc2c36f6860a77a556494870675771a" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, - "nvim": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" }, "nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" }, "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" }, @@ -54,10 +42,8 @@ "nvim-web-devicons": { "branch": "master", "commit": "e612de3d3a41a6b7be47f51e956dddabcbf419d9" }, "octo.nvim": { "branch": "master", "commit": "aa5dfa573220a0a511a25ee14ce1570b6c23e56a" }, "oil.nvim": { "branch": "master", "commit": "9e5eb2fcd1dfee2ff30c89273ffff179e42034b9" }, - "okai": { "branch": "main", "commit": "b028c2916c39b1c4ad53756d262f9d0576edac87" }, "overseer.nvim": { "branch": "master", "commit": "87526babdb563b9e2f0646b420359389732326dc" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "spaceduck": { "branch": "main", "commit": "350491f19343b24fa85809242089caa02d4dadce" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, diff --git a/.config/nvim/lua/custom/configs/language-servers.lua b/.config/nvim/lua/custom/configs/language-servers.lua index 4fd3fff..1165994 100644 --- a/.config/nvim/lua/custom/configs/language-servers.lua +++ b/.config/nvim/lua/custom/configs/language-servers.lua @@ -1,19 +1,20 @@ -- NOTE: A list of language servers (and potentially their config) -- Accepts either true to enable, false to disable or a table with settings return { - lua_ls = { - settings = { - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.stdpath('config') .. '/lua'] = true, - }, - }, - }, - }, -- lua + -- lua_ls = { + -- settings = { + -- diagnostics = { + -- globals = { 'vim' }, + -- }, + -- workspace = { + -- library = { + -- [vim.fn.expand('$VIMRUNTIME/lua')] = true, + -- [vim.fn.stdpath('config') .. '/lua'] = true, + -- }, + -- }, + -- }, + -- }, -- lua + lua_ls = true, -- lua clangd = true, -- C/C++ gradle_ls = true, -- java package manager jdtls = true, -- java eclipse lsp diff --git a/.config/nvim/lua/custom/configs/statusline.lua b/.config/nvim/lua/custom/configs/statusline.lua new file mode 100644 index 0000000..ce581c4 --- /dev/null +++ b/.config/nvim/lua/custom/configs/statusline.lua @@ -0,0 +1,92 @@ +local lualine = require('lualine') +local lsp_progress = require('lsp-progress') + +local progress_filled = '█' +local progress_empty = '░' +local function progress_bar(percentage, width) + -- Ensure i is an integer between 0 and width (inclusive) + local i = math.max(0, math.min(math.floor(width * percentage), width)) + return string.rep(progress_filled, i) .. string.rep(progress_empty, width - i) +end + +local progress_bar_width = 10 +lsp_progress.setup({ + format = function(client_messages) -- global + local sign = ' LSP' + if #client_messages > 0 then + return sign .. ' ' .. table.concat(client_messages, ' ') + end + if #require('lsp-progress.api').lsp_clients() > 0 then + return sign + end + return '' + end, + client_format = function(_, _, series_messages) -- per lsp + return #series_messages > 0 and table.concat(series_messages, ', ') or nil + end, + series_format = function(title, message, percentage, done) -- per progress + local builder = {} + local has_title = false + local has_message = false + if type(title) == 'string' and string.len(title) > 0 then + table.insert(builder, title .. ':') + has_title = true + end + if percentage then + table.insert(builder, string.format('%.0f%%', percentage)) + table.insert(builder, 1, progress_bar(percentage / 100, progress_bar_width)) + end + if type(message) == 'string' and string.len(message) > 0 then + table.insert(builder, string.format('(%s)', message)) + has_message = true + end + if done and (has_title or has_message) then + table.insert(builder, ' ') + end + return table.concat(builder, ' ') + end, +}) + +lualine.setup({ + options = { + globalstatus = true, + theme = 'auto', + }, + sections = { + lualine_a = { { 'mode', icon = '' } }, + lualine_b = { + require('auto-session.lib').current_session_name, + { 'branch', icon = '' }, + { + 'diagnostics', + symbols = { + error = '󰅙 ', + warn = '󰀦 ', + info = '󰋼 ', + hint = '󰌵 ', + }, + }, + }, + lualine_c = { + function() + return lsp_progress.progress() + end, + }, + lualine_x = { + 'searchcount', + 'encoding', + 'fileformat', + 'filetype', + }, + lualine_y = { 'progress' }, + lualine_z = { 'location' }, + }, + extensions = { 'oil', 'trouble' }, +}) + +-- Refresh lualine when lsp progress is updated +vim.api.nvim_create_autocmd('User', { + group = vim.api.nvim_create_augroup('lualine_augroup', { clear = true }), + pattern = 'LspProgressStatusUpdated', + callback = require('lualine').refresh, +}) diff --git a/.config/nvim/lua/custom/configs/telescope.lua b/.config/nvim/lua/custom/configs/telescope.lua new file mode 100644 index 0000000..b554a33 --- /dev/null +++ b/.config/nvim/lua/custom/configs/telescope.lua @@ -0,0 +1,40 @@ +local telescope = require('telescope') +telescope.setup({ + pickers = { + find_files = { follow = true }, + grep_string = { additional_args = '--follow' }, + live_grep = { additional_args = '--follow' }, + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case', -- default "smart_case" or "ignore_case" or "respect_case" + }, + ['ui-select'] = { + require('telescope.themes').get_dropdown({}), + }, + }, +}) + +pcall(telescope.load_extension('ui-select')) +pcall(telescope.load_extension('fzf')) + +local builtin = require('telescope.builtin') +local function find_all() + builtin.find_files({ + cwd = '~', + hidden = true, + no_ignore = true, + no_ignore_parent = true, + }) +end + +vim.keymap.set('n', 'fs', builtin.find_files, { desc = '[F]ile [S]ystem' }) +vim.keymap.set('n', 'fa', find_all, { desc = '[F]ind [A]ll files' }) +vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) +vim.keymap.set('n', 'fm', builtin.man_pages, { desc = '[F]ind [M]an Pages' }) +vim.keymap.set('n', 'lv', builtin.live_grep, { desc = '[L]ive [G]rep' }) +vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files' }) +vim.keymap.set('n', 'th', builtin.colorscheme, { desc = 'List [Th]eme' }) diff --git a/.config/nvim/lua/custom/plugins/alpha.lua b/.config/nvim/lua/custom/plugins/alpha.lua index 72af0a5..fa0740c 100644 --- a/.config/nvim/lua/custom/plugins/alpha.lua +++ b/.config/nvim/lua/custom/plugins/alpha.lua @@ -53,14 +53,16 @@ return { dashboard.section.buttons.opts.spacing = 0 dashboard.section.buttons.val = { dashboard.button('e', ' > New file', 'ene startinsert'), - dashboard.button('w', ' > Find file', 'cd ' .. find_file_path .. ' | Telescope find_files'), + dashboard.button('f', ' > Find file', 'cd ' .. find_file_path .. ' | Telescope find_files'), dashboard.button('r', ' > Recent', 'Telescope oldfiles'), dashboard.button('c', ' > Configuration', 'e $MYVIMRC | cd %:p:h'), - dashboard.button( - 's', - '󱎠 > Last Session', - 'lua require("auto-session.session-lens.actions").alternate_session()' - ), + -- FIX: doesn't seem to work so great, probably just use a project manager + -- will most likely make my own project manager plugin + -- dashboard.button( + -- 's', + -- '󱎠 > Last Session', + -- 'lua require("auto-session.session-lens.actions").alternate_session()' + -- ), dashboard.button('q', '󰈆 > Quit NVIM', 'qa'), } diff --git a/.config/nvim/lua/custom/plugins/colorschemes.lua b/.config/nvim/lua/custom/plugins/colorschemes.lua index 8fa17af..e3dc5bd 100644 --- a/.config/nvim/lua/custom/plugins/colorschemes.lua +++ b/.config/nvim/lua/custom/plugins/colorschemes.lua @@ -8,19 +8,19 @@ return { require('colorschemes.dapui').set() end, }, - 'rktjmp/lush.nvim', - 'catppuccin/nvim', - 'marko-cerovac/material.nvim', - 'rebelot/kanagawa.nvim', - 'projekt0n/github-nvim-theme', - 'EdenEast/nightfox.nvim', - 'rose-pine/neovim', - 'rafi/awesome-vim-colorschemes', - 'datsfilipe/min-theme.nvim', - 'nechaev/darkstorm.nvim', - 'briones-gabriel/darcula-solid.nvim', - 'okaihe/okai', - 'uloco/bluloco.nvim', - 'doums/darcula', - 'pineapplegiant/spaceduck', + -- 'rktjmp/lush.nvim', + -- 'catppuccin/nvim', + -- 'marko-cerovac/material.nvim', + -- 'rebelot/kanagawa.nvim', + -- 'projekt0n/github-nvim-theme', + -- 'EdenEast/nightfox.nvim', + -- 'rose-pine/neovim', + -- 'rafi/awesome-vim-colorschemes', + -- 'datsfilipe/min-theme.nvim', + -- 'nechaev/darkstorm.nvim', + -- 'briones-gabriel/darcula-solid.nvim', + -- 'okaihe/okai', + -- 'uloco/bluloco.nvim', + -- 'doums/darcula', + -- 'pineapplegiant/spaceduck', } diff --git a/.config/nvim/lua/custom/plugins/edgy.lua b/.config/nvim/lua/custom/plugins/edgy.lua index 7f01245..872247f 100644 --- a/.config/nvim/lua/custom/plugins/edgy.lua +++ b/.config/nvim/lua/custom/plugins/edgy.lua @@ -23,15 +23,6 @@ return { end, size = { height = 0.5 }, }, - { - title = 'Neo-Tree Git', - ft = 'neo-tree', - filter = function(buf) - return vim.b[buf].neo_tree_source == 'git_status' - end, - pinned = true, - open = 'Neotree position=right git_status', - }, }, }, } diff --git a/.config/nvim/lua/custom/plugins/motions.lua b/.config/nvim/lua/custom/plugins/motions.lua deleted file mode 100644 index 9ab3fed..0000000 --- a/.config/nvim/lua/custom/plugins/motions.lua +++ /dev/null @@ -1,68 +0,0 @@ -return { - { - 'christoomey/vim-tmux-navigator', - config = function() - vim.keymap.set('n', '', 'TmuxNavigateLeft') - vim.keymap.set('n', '', 'TmuxNavigateDown') - vim.keymap.set('n', '', 'TmuxNavigateUp') - vim.keymap.set('n', '', 'TmuxNavigateRight') - end, - }, - { - 'ggandor/leap.nvim', - dependencies = { 'tpope/vim-repeat' }, - config = function() - -- vim.keymap.set({ 'n', 'x', 'o' }, 's', '(leap-forward)') - -- vim.keymap.set({ 'n', 'x', 'o' }, 'S', '(leap-backward)') - -- vim.keymap.set({ 'n', 'x', 'o' }, 'gs', '(leap-from-window)') - - vim.keymap.set('n', 's', '(leap)') - vim.keymap.set('n', 'S', '(leap-from-window)') - vim.keymap.set({ 'x', 'o' }, 's', '(leap-forward)') - vim.keymap.set({ 'x', 'o' }, 'S', '(leap-backward)') - vim.keymap.set({ 'n', 'o' }, 'gs', function() - require('leap.remote').action() - end) - - -- Define equivalence classes for brackets and quotes, in addition to - -- the default whitespace group. - require('leap').opts.equivalence_classes = { ' \t\r\n', '([{', ')]}', '\'"`' } - - -- Set background to gray in searchable area - vim.api.nvim_set_hl(0, 'LeapBackdrop', { fg = '#777777' }) - end, - }, - { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - config = true, - }, - { - 'numToStr/Comment.nvim', - opts = { - padding = true, - ignore = nil, - - toggler = { line = 'gcc', block = 'gbc' }, - opleader = { line = 'gc', block = 'gb' }, - extra = { above = 'gcO', below = 'gco', eol = 'gcA' }, - - mappings = { - basic = true, -- `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` - extra = false, -- `gco`, `gcO`, `gcA` - }, - }, - config = function() - local api = require('Comment.api') - local esc = vim.api.nvim_replace_termcodes('', true, false, true) - local toggole_linewise_selection = function() - vim.api.nvim_feedkeys(esc, 'nx', false) - api.toggle.linewise(vim.fn.visualmode()) - end - - -- means Ctrl slash, `_` is a `/` - vim.keymap.set('n', '', api.toggle.linewise.current, { noremap = true, silent = true }) - vim.keymap.set('v', '', toggole_linewise_selection, { noremap = true, silent = true }) - end, - }, -} diff --git a/.config/nvim/lua/custom/plugins/neotree.lua b/.config/nvim/lua/custom/plugins/neotree.lua index 72f8b36..d008b69 100644 --- a/.config/nvim/lua/custom/plugins/neotree.lua +++ b/.config/nvim/lua/custom/plugins/neotree.lua @@ -9,6 +9,7 @@ return { 'nvim-tree/nvim-web-devicons', 'MunifTanjim/nui.nvim', }, + cmd = 'Neotree', config = function() require('neo-tree').setup({ open_files_do_not_replace_types = { 'terminal', 'Trouble', 'qf', 'edgy' }, diff --git a/.config/nvim/lua/custom/plugins/oil.lua b/.config/nvim/lua/custom/plugins/oil.lua index 0c193a9..0d81fca 100644 --- a/.config/nvim/lua/custom/plugins/oil.lua +++ b/.config/nvim/lua/custom/plugins/oil.lua @@ -1,29 +1,34 @@ return { 'stevearc/oil.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - local oil = require('oil') - oil.setup({ - default_file_explorer = true, - skip_confirm_for_simple_edits = true, - keymaps = { - ['gs'] = false, - [''] = false, - [''] = false, - [''] = false, - [''] = false, - [''] = 'actions.select_split', - [''] = 'actions.select_vsplit', - [''] = 'actions.refresh', - [''] = 'actions.close', - ['gS'] = 'actions.change_sort', - }, - view_options = { - show_hidden = true, - natural_order = true, - }, - }) - vim.keymap.set('n', 'ob', 'Oil', { desc = '[O]il [B]uffer' }) - vim.keymap.set('n', 'of', oil.toggle_float, { desc = '[O]il [F]loat' }) + keys = { + { 'ob', 'Oil', desc = '[O]il [B]uffer' }, + { 'of', 'lua require("oil").toggle_float', desc = '[O]il [F]loat' }, + }, + opts = { + default_file_explorer = true, + skip_confirm_for_simple_edits = true, + keymaps = { + ['gs'] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = 'actions.select_split', + [''] = 'actions.select_vsplit', + [''] = 'actions.refresh', + [''] = 'actions.close', + ['gS'] = 'actions.change_sort', + }, + view_options = { + show_hidden = true, + natural_order = true, + }, + }, + cmd = 'Oil', + event = function() + if vim.fn.isdirectory(vim.fn.expand('%')) == 1 then + return 'VimEnter' + end end, } diff --git a/.config/nvim/lua/custom/plugins/overseer.lua b/.config/nvim/lua/custom/plugins/overseer.lua index f1015ba..38a9a85 100644 --- a/.config/nvim/lua/custom/plugins/overseer.lua +++ b/.config/nvim/lua/custom/plugins/overseer.lua @@ -1,25 +1,24 @@ return { 'stevearc/overseer.nvim', - opts = {}, - config = function() - require('overseer').setup({ - templates = { 'builtin', 'custom' }, - task_list = { - min_height = 0.5, - bindings = { - ['o'] = false, - [''] = false, - [''] = false, - [''] = false, - [''] = false, - [''] = false, - [''] = false, - [''] = 'ScrollOutputUp', - [''] = 'ScrollOutputDown', - }, + opts = { + templates = { 'builtin', 'custom' }, + task_list = { + min_height = 0.5, + bindings = { + ['o'] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = 'ScrollOutputUp', + [''] = 'ScrollOutputDown', }, - }) - vim.keymap.set('n', 'or', 'OverseerRun', { desc = '[O]verseer [R]un' }) - vim.keymap.set('n', 'ot', 'OverseerToggle', { desc = '[O]verseer [T]oggle' }) - end, + }, + }, + keys = { + { 'or', 'OverseerRun', desc = '[O]verseer [R]un' }, + { 'ot', 'OverseerToggle', desc = '[O]verseer [T]oggle' } + } } diff --git a/.config/nvim/lua/custom/plugins/statusline.lua b/.config/nvim/lua/custom/plugins/statusline.lua index 8c37eab..8dfe41f 100644 --- a/.config/nvim/lua/custom/plugins/statusline.lua +++ b/.config/nvim/lua/custom/plugins/statusline.lua @@ -1,8 +1,8 @@ return { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', 'linrongbin16/lsp-progress.nvim' }, + event = 'BufWinEnter', config = function() - require('custom.statusline') + require('custom.configs.statusline') end, - event = 'BufWinEnter', } diff --git a/.config/nvim/lua/custom/plugins/telescope.lua b/.config/nvim/lua/custom/plugins/telescope.lua index 1d8f49c..945dc2e 100644 --- a/.config/nvim/lua/custom/plugins/telescope.lua +++ b/.config/nvim/lua/custom/plugins/telescope.lua @@ -8,6 +8,15 @@ return { }, cmd = 'Telescope', config = function() - require('custom.telescope') + require('custom.configs.telescope') end, + keys = { + 'fs', + 'fa', + 'fh', + 'fm', + 'lv', + 'f.', + 'th', + }, } diff --git a/.config/nvim/lua/custom/plugins/treesitter.lua b/.config/nvim/lua/custom/plugins/treesitter.lua index ec3136c..a5fba2d 100644 --- a/.config/nvim/lua/custom/plugins/treesitter.lua +++ b/.config/nvim/lua/custom/plugins/treesitter.lua @@ -1,6 +1,7 @@ return { { 'nvim-treesitter/nvim-treesitter', + lazy = true, build = ':TSUpdate', config = function() ---@type userdata diff --git a/.config/nvim/lua/custom/plugins/ui.lua b/.config/nvim/lua/custom/plugins/ui.lua deleted file mode 100644 index 97aeadd..0000000 --- a/.config/nvim/lua/custom/plugins/ui.lua +++ /dev/null @@ -1,2 +0,0 @@ -return { -} diff --git a/.config/nvim/lua/custom/plugins/utility.lua b/.config/nvim/lua/custom/plugins/utility.lua index 5deee38..66e88a8 100644 --- a/.config/nvim/lua/custom/plugins/utility.lua +++ b/.config/nvim/lua/custom/plugins/utility.lua @@ -25,9 +25,18 @@ return { require('auto-session').setup({ log_level = 'error', auto_session_suppress_dirs = { '~/', '/' }, + session_lens = { load_on_setup = false }, }) - local session = require('auto-session.session-lens') - vim.keymap.set('n', '', session.search_session, { desc = '[S]ession Manager' }) + + local session_lens_setup_done = false + local function search_session() + if not session_lens_setup_done then + require('auto-session').setup_session_lens() + session_lens_setup_done = true + end + require('auto-session.session-lens').search_session() + end + vim.keymap.set('n', '', search_session, { desc = '[S]ession Manager' }) end, }, { 'wakatime/vim-wakatime', lazy = false }, @@ -144,11 +153,7 @@ return { vim.api.nvim_set_hl(0, 'LeapBackdrop', { fg = '#777777' }) end, }, - { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - config = true, - }, + { 'windwp/nvim-autopairs', event = 'InsertEnter', config = true }, { -- 'numToStr/Comment.nvim', 'os-mey/Comment.nvim', @@ -168,4 +173,16 @@ return { vim.keymap.set('v', '', toggle_linewise_selection, { noremap = true, silent = true }) end, }, + { + 'j-morano/buffer_manager.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + keys = { + { + 'e', + function() + require('buffer_manager.ui').toggle_quick_menu() + end, + }, + }, + }, } diff --git a/.config/nvim/lua/custom/statusline.lua b/.config/nvim/lua/custom/statusline.lua deleted file mode 100644 index ce581c4..0000000 --- a/.config/nvim/lua/custom/statusline.lua +++ /dev/null @@ -1,92 +0,0 @@ -local lualine = require('lualine') -local lsp_progress = require('lsp-progress') - -local progress_filled = '█' -local progress_empty = '░' -local function progress_bar(percentage, width) - -- Ensure i is an integer between 0 and width (inclusive) - local i = math.max(0, math.min(math.floor(width * percentage), width)) - return string.rep(progress_filled, i) .. string.rep(progress_empty, width - i) -end - -local progress_bar_width = 10 -lsp_progress.setup({ - format = function(client_messages) -- global - local sign = ' LSP' - if #client_messages > 0 then - return sign .. ' ' .. table.concat(client_messages, ' ') - end - if #require('lsp-progress.api').lsp_clients() > 0 then - return sign - end - return '' - end, - client_format = function(_, _, series_messages) -- per lsp - return #series_messages > 0 and table.concat(series_messages, ', ') or nil - end, - series_format = function(title, message, percentage, done) -- per progress - local builder = {} - local has_title = false - local has_message = false - if type(title) == 'string' and string.len(title) > 0 then - table.insert(builder, title .. ':') - has_title = true - end - if percentage then - table.insert(builder, string.format('%.0f%%', percentage)) - table.insert(builder, 1, progress_bar(percentage / 100, progress_bar_width)) - end - if type(message) == 'string' and string.len(message) > 0 then - table.insert(builder, string.format('(%s)', message)) - has_message = true - end - if done and (has_title or has_message) then - table.insert(builder, ' ') - end - return table.concat(builder, ' ') - end, -}) - -lualine.setup({ - options = { - globalstatus = true, - theme = 'auto', - }, - sections = { - lualine_a = { { 'mode', icon = '' } }, - lualine_b = { - require('auto-session.lib').current_session_name, - { 'branch', icon = '' }, - { - 'diagnostics', - symbols = { - error = '󰅙 ', - warn = '󰀦 ', - info = '󰋼 ', - hint = '󰌵 ', - }, - }, - }, - lualine_c = { - function() - return lsp_progress.progress() - end, - }, - lualine_x = { - 'searchcount', - 'encoding', - 'fileformat', - 'filetype', - }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, - }, - extensions = { 'oil', 'trouble' }, -}) - --- Refresh lualine when lsp progress is updated -vim.api.nvim_create_autocmd('User', { - group = vim.api.nvim_create_augroup('lualine_augroup', { clear = true }), - pattern = 'LspProgressStatusUpdated', - callback = require('lualine').refresh, -}) diff --git a/.config/nvim/lua/custom/telescope.lua b/.config/nvim/lua/custom/telescope.lua deleted file mode 100644 index b554a33..0000000 --- a/.config/nvim/lua/custom/telescope.lua +++ /dev/null @@ -1,40 +0,0 @@ -local telescope = require('telescope') -telescope.setup({ - pickers = { - find_files = { follow = true }, - grep_string = { additional_args = '--follow' }, - live_grep = { additional_args = '--follow' }, - }, - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, - override_file_sorter = true, - case_mode = 'smart_case', -- default "smart_case" or "ignore_case" or "respect_case" - }, - ['ui-select'] = { - require('telescope.themes').get_dropdown({}), - }, - }, -}) - -pcall(telescope.load_extension('ui-select')) -pcall(telescope.load_extension('fzf')) - -local builtin = require('telescope.builtin') -local function find_all() - builtin.find_files({ - cwd = '~', - hidden = true, - no_ignore = true, - no_ignore_parent = true, - }) -end - -vim.keymap.set('n', 'fs', builtin.find_files, { desc = '[F]ile [S]ystem' }) -vim.keymap.set('n', 'fa', find_all, { desc = '[F]ind [A]ll files' }) -vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) -vim.keymap.set('n', 'fm', builtin.man_pages, { desc = '[F]ind [M]an Pages' }) -vim.keymap.set('n', 'lv', builtin.live_grep, { desc = '[L]ive [G]rep' }) -vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files' }) -vim.keymap.set('n', 'th', builtin.colorscheme, { desc = 'List [Th]eme' }) -- cgit v1.3.1