From 4ceceff9bf5b5fd758faecb52799e7f8469c3674 Mon Sep 17 00:00:00 2001 From: iofq Date: Wed, 21 Aug 2024 00:30:13 -0500 Subject: [PATCH] bugfixes --- nix/neovim-overlay.nix | 6 ++++-- nvim/lua/config/init.lua | 3 +-- nvim/lua/plugins/completion.lua | 33 ++++++++++++--------------------- nvim/lua/plugins/lsp.lua | 1 - nvim/lua/plugins/mini.lua | 5 +++-- nvim/lua/plugins/misc.lua | 2 +- nvim/lua/plugins/treesitter.lua | 2 +- 7 files changed, 22 insertions(+), 30 deletions(-) diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index d4cb123..84f2153 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -17,7 +17,6 @@ with final.pkgs.lib; let mkNeovim = pkgs.callPackage ./mkNeovim.nix { inherit pkgs-wrapNeovim; }; all-plugins = with pkgs.vimPlugins; [ - aerial-nvim cmp-buffer cmp-cmdline cmp-nvim-lsp @@ -98,7 +97,6 @@ with final.pkgs.lib; let gopls lua-language-server nil - phpactor python312Packages.jedi-language-server # debuggers @@ -115,6 +113,10 @@ in { plugins = all-plugins; appName = "nvim"; extraPackages = basePackages; + ignoreConfigRegexes = [ + "*/lsp.lua" + "*/debug.lua" + ]; }; nvim-luarc-json = final.mk-luarc-json { diff --git a/nvim/lua/config/init.lua b/nvim/lua/config/init.lua index 71c116f..58ca894 100644 --- a/nvim/lua/config/init.lua +++ b/nvim/lua/config/init.lua @@ -1,9 +1,8 @@ vim.opt.backspace = 'indent,eol,start' vim.opt.clipboard = 'unnamedplus' -vim.opt.completeopt = 'menuone' +vim.opt.completeopt = {'menu', 'menuone', 'noselect'} vim.opt.expandtab = true -- insert tabs as spaces vim.opt.inccommand = 'split' -- incremental live completion -vim.opt.laststatus = 1 vim.opt.list = true vim.opt.nrformats:append('alpha') -- let Ctrl-a do letters as well vim.opt.path:append('**') -- enable fuzzy :find ing diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index fc4dcc7..beaf4e6 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -19,22 +19,21 @@ return { require('luasnip').lsp_expand(args.body) end, }, - experimental = { - native_menu = false, - ghost_text = true, - }, mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }, + [''] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }, + [''] = cmp.mapping.confirm { + select = true, + behavior = cmp.SelectBehavior.Insert + }, }, sources = cmp.config.sources({ - { name = 'nvim_lsp' }, + { name = 'nvim_lsp', keyword_length = 1 }, { name = 'luasnip' }, - }, { { name = 'buffer' }, + { name = 'path' }, }), } @@ -68,13 +67,13 @@ return { } require('luasnip.loaders.from_vscode').lazy_load() - vim.keymap.set({ 'i', 's' }, '', function() + vim.keymap.set({ 'i', 's' }, '', function() if ls.expand_or_jumpable() then ls.expand_or_jump() end end, { silent = true }) - vim.keymap.set({ 'i', 's' }, '', function() + vim.keymap.set({ 'i', 's' }, '', function() if ls.jumpable(-1) then ls.jump(-1) end @@ -85,14 +84,6 @@ return { ls.change_choice(1) end end, { silent = true }) - - -------------------- - -- Snippets -- - -------------------- - local fmta = require('luasnip.extras.fmt').fmta - ls.add_snippets('go', { - ls.snippet('ie', fmta('if err != nil {\n\treturn \n}', { err = ls.insert_node(1, 'err') })), - }) end, }, } diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index fbbdcf9..cd5f603 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -68,7 +68,6 @@ return { } lspconfig.jedi_language_server.setup {} lspconfig.nil_ls.setup {} - lspconfig.phpactor.setup {} lspconfig.lua_ls.setup { on_init = function(client) local path = client.workspace_folders[1].name diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua index ce58930..78be31d 100644 --- a/nvim/lua/plugins/mini.lua +++ b/nvim/lua/plugins/mini.lua @@ -1,7 +1,7 @@ return { { 'echasnovski/mini.nvim', - event = "VeryLazy", + lazy = false, config = function() require('mini.ai').setup() require('mini.comment').setup() @@ -28,6 +28,7 @@ return { return summary end local diagnostics = MiniStatusline.section_diagnostics { trunc_width = 75 } + local lsp = MiniStatusline.section_lsp { trunc_width = 75 } local filename = MiniStatusline.section_filename { trunc_width = 140 } local search = MiniStatusline.section_searchcount { trunc_width = 75 } @@ -36,7 +37,7 @@ return { '%<', -- Mark general truncate point { hl = 'MiniStatuslineFilename', strings = { filename } }, '%=', -- End left alignment - { hl = 'MiniStatusDevinfo', strings = { git(), diff(), diagnostics } }, + { hl = 'MiniStatusDevinfo', strings = { git(), diff(), diagnostics, lsp} }, { hl = mode_hl, strings = { search } }, } end, diff --git a/nvim/lua/plugins/misc.lua b/nvim/lua/plugins/misc.lua index 3edc23a..539b3df 100644 --- a/nvim/lua/plugins/misc.lua +++ b/nvim/lua/plugins/misc.lua @@ -24,7 +24,7 @@ return { }, { 'OXY2DEV/markview.nvim', - lazy = false, + event = 'VeryLazy', dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index 44c53e5..625df5d 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -1,7 +1,7 @@ return { { 'nvim-treesitter/nvim-treesitter', - event = 'VeryLazy', + lazy = false, dependencies = { 'nvim-treesitter/nvim-treesitter-context', 'nvim-treesitter/nvim-treesitter-textobjects',