From 21107f040b1579c1139ef0ca2ce993603d24826f Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sun, 27 Apr 2025 14:12:18 +0300 Subject: Massive nvim refactor, migrated from nvim-lspconfig to NVIM 0.11 lsp/* also migrated most LSP clients to nix rather than mason --- .config/nvim/lua/plugins/auto-save.lua | 5 ++++ .config/nvim/lua/plugins/blink-cmp.lua | 44 +++++++++++++++++++++++++++++ .config/nvim/lua/plugins/noice.lua | 2 +- .config/nvim/lua/plugins/nvim-cmp.lua | 24 ++++++++-------- .config/nvim/lua/plugins/nvim-lspconfig.lua | 22 +-------------- .config/nvim/lua/plugins/snacks.lua | 2 +- 6 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 .config/nvim/lua/plugins/blink-cmp.lua (limited to '.config/nvim/lua/plugins') diff --git a/.config/nvim/lua/plugins/auto-save.lua b/.config/nvim/lua/plugins/auto-save.lua index 5da836b..99ff70e 100644 --- a/.config/nvim/lua/plugins/auto-save.lua +++ b/.config/nvim/lua/plugins/auto-save.lua @@ -25,6 +25,11 @@ return { return { -- execution_message = { enabled = false }, removed condition = function(buf) + -- TODO: oil issues might be bcz of autosaving? + -- Maybe I should exclude Oil ft? + -- Might be unrelated tho + -- Oil error is "cannot save, action already in progress" + -- Save only if the buffer is not a "special buffer" return vim.fn.getbufvar(buf, '&buftype') == '' end, diff --git a/.config/nvim/lua/plugins/blink-cmp.lua b/.config/nvim/lua/plugins/blink-cmp.lua new file mode 100644 index 0000000..51d910b --- /dev/null +++ b/.config/nvim/lua/plugins/blink-cmp.lua @@ -0,0 +1,44 @@ +return { + 'saghen/blink.cmp', + version = '1.*', + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'default' }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = 'prefer_rust_with_warning' }, + }, + opts_extend = { 'sources.default' }, +} diff --git a/.config/nvim/lua/plugins/noice.lua b/.config/nvim/lua/plugins/noice.lua index 6634f48..1420ab5 100644 --- a/.config/nvim/lua/plugins/noice.lua +++ b/.config/nvim/lua/plugins/noice.lua @@ -12,7 +12,7 @@ return { -- override the lsp markdown formatter with Noice ['vim.lsp.util.stylize_markdown'] = true, -- override cmp documentation with Noice (needs the other options to work) - ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp + -- ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp }, hover = { enabled = true, diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua index 221c756..16b3612 100644 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -1,14 +1,14 @@ return { - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', - dependencies = { - 'onsails/lspkind.nvim', -- icons for completion type - 'hrsh7th/cmp-path', -- complete filepaths - 'hrsh7th/cmp-nvim-lsp', -- lsp source for nvim-cmp - 'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp - { 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, -- snippets plugin - }, - config = function() - require('cmp_helper') - end, + -- 'hrsh7th/nvim-cmp', + -- event = 'InsertEnter', + -- dependencies = { + -- 'onsails/lspkind.nvim', -- icons for completion type + -- 'hrsh7th/cmp-path', -- complete filepaths + -- 'hrsh7th/cmp-nvim-lsp', -- lsp source for nvim-cmp + -- 'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp + -- { 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, -- snippets plugin + -- }, + -- config = function() + -- require('cmp_helper') + -- end, } diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua index 1dd0a77..169f339 100644 --- a/.config/nvim/lua/plugins/nvim-lspconfig.lua +++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua @@ -4,29 +4,9 @@ return { 'neovim/nvim-lspconfig', event = { 'BufReadPre', 'BufNewFile' }, dependencies = { - 'hrsh7th/cmp-nvim-lsp', + -- 'hrsh7th/cmp-nvim-lsp', { 'antosha417/nvim-lsp-file-operations', conifg = true }, - { - 'williamboman/mason-lspconfig.nvim', - build = ':MasonUpdate', - config = function() - local language_servers = require('language-servers') - local ensure_installed = vim.tbl_filter(function(key) - local server = language_servers[key] - if type(server) == 'table' then - if server.mason ~= nil then - return server.mason - end - return true - else - return server - end - end, vim.tbl_keys(language_servers)) - require('mason-lspconfig').setup({ ensure_installed = ensure_installed, auto_install = true }) - end, - }, }, config = function() - require('lsp') end, } diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua index add7435..6095e19 100644 --- a/.config/nvim/lua/plugins/snacks.lua +++ b/.config/nvim/lua/plugins/snacks.lua @@ -21,7 +21,7 @@ return { style = 'compact', filter = function(notif) local exact_filter = { 'No information available', 'No code actions available' } - local contains_filter = { 'fewer lines', 'lines indented', 'lines yanked', 'more lines' } + local contains_filter = { 'fewer lines', 'lines indented', 'lines yanked', 'more lines', 'E486:' } for _, msg in ipairs(exact_filter) do if notif.msg == msg then return false -- cgit v1.3.1