From 56ccb7c136ec0dd376f1ca146d0b777c9848eae5 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Wed, 22 Jan 2025 19:47:54 +0200 Subject: [PATCH] chore(nvim): plugin tweaks, config tweaks --- config/nvim/lua/autogroups.lua | 5 +- config/nvim/lua/plugins/blink.lua | 7 +- config/nvim/lua/plugins/lsp.lua | 119 +++++++++++++----------------- docs/nvim-keybindings.md | 52 +++++++------ 4 files changed, 83 insertions(+), 100 deletions(-) diff --git a/config/nvim/lua/autogroups.lua b/config/nvim/lua/autogroups.lua index add83eb..1052214 100644 --- a/config/nvim/lua/autogroups.lua +++ b/config/nvim/lua/autogroups.lua @@ -93,11 +93,12 @@ autocmd({ 'FileType' }, { -- Set filetype for SSH config directory -- Pattern handles directories with files like: --- .dotfiles/ssh/config.d/*, .ssh/config.local, .ssh/config.work +-- .dotfiles/ssh/config.d/*, .ssh/config.local, .ssh/config.work, +-- .ssh/shared.d/*, .ssh/local.d/* autocmd({ 'BufRead', 'BufNewFile' }, { desc = 'Set filetype for SSH config directory', pattern = { - '*/?.ssh/{config|shared}.d/*', + '*/?.ssh/{config|shared|local}.d/*', '*/?.ssh/config.local', '*/?.ssh/config.work', }, diff --git a/config/nvim/lua/plugins/blink.lua b/config/nvim/lua/plugins/blink.lua index 20ad129..63ee59b 100644 --- a/config/nvim/lua/plugins/blink.lua +++ b/config/nvim/lua/plugins/blink.lua @@ -18,11 +18,14 @@ return { }, }, - { 'L3MON4D3/LuaSnip', version = 'v2.*' }, + { 'L3MON4D3/LuaSnip', version = 'v2.*', build = 'make install_jsregexp' }, -- Set of preconfigured snippets for different languages. -- https://github.com/rafamadriz/friendly-snippets - { 'rafamadriz/friendly-snippets' }, + { + 'rafamadriz/friendly-snippets', + config = function() require('luasnip.loaders.from_vscode').lazy_load() end, + }, -- Lua plugin to turn github copilot into a cmp source -- https://github.com/giuxtaposition/blink-cmp-copilot diff --git a/config/nvim/lua/plugins/lsp.lua b/config/nvim/lua/plugins/lsp.lua index 881f8e9..84a3349 100644 --- a/config/nvim/lua/plugins/lsp.lua +++ b/config/nvim/lua/plugins/lsp.lua @@ -148,70 +148,61 @@ return { -- https://github.com/Bilal2453/luvit-meta { 'Bilal2453/luvit-meta', lazy = true }, + -- Quickstart configs for Nvim LSP + -- https://github.com/neovim/nvim-lspconfig + { 'neovim/nvim-lspconfig' }, + + -- Portable package manager for Neovim that runs everywhere Neovim runs. + -- Easily install and manage LSP servers, DAP servers, linters, and formatters. + -- https://github.com/williamboman/mason.nvim + { + 'williamboman/mason.nvim', + version = '*', + cmd = 'Mason', + run = ':MasonUpdate', + opts = {}, + }, + + -- Extensible UI for Neovim notifications and LSP progress messages. + -- https://github.com/j-hui/fidget.nvim + { + 'j-hui/fidget.nvim', + version = '*', + opts = {}, + }, + + -- Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim. + -- https://github.com/williamboman/mason-lspconfig.nvim + { 'williamboman/mason-lspconfig.nvim' }, + + -- Install and upgrade third party tools automatically + -- https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim + { + 'WhoIsSethDaniel/mason-tool-installer.nvim', + version = '*', + opts = { + auto_install = true, + auto_update = true, + ensure_installed = mason_tools, + }, + }, + + -- JSON schemas for Neovim + -- https://github.com/b0o/SchemaStore.nvim + { 'b0o/schemastore.nvim' }, + + -- Performant, batteries-included completion plugin for Neovim + -- https://github.com/saghen/blink.cmp + -- See lua/plugins/blink.lua for configs + { 'saghen/blink.cmp' }, + -- A simple wrapper for nvim-lspconfig and mason-lspconfig -- to easily setup LSP servers. -- https://github.com/junnplus/lsp-setup.nvim { 'junnplus/lsp-setup.nvim', - dependencies = { - -- Quickstart configs for Nvim LSP - -- https://github.com/neovim/nvim-lspconfig - { 'neovim/nvim-lspconfig' }, - - -- Portable package manager for Neovim that runs everywhere Neovim runs. - -- Easily install and manage LSP servers, DAP servers, linters, and formatters. - -- https://github.com/williamboman/mason.nvim - { - 'williamboman/mason.nvim', - version = '*', - cmd = 'Mason', - run = ':MasonUpdate', - opts = {}, - }, - - -- Extensible UI for Neovim notifications and LSP progress messages. - -- https://github.com/j-hui/fidget.nvim - { - 'j-hui/fidget.nvim', - version = '*', - opts = {}, - }, - - -- Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim. - -- https://github.com/williamboman/mason-lspconfig.nvim - { 'williamboman/mason-lspconfig.nvim' }, - - -- Install and upgrade third party tools automatically - -- https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim - { - 'WhoIsSethDaniel/mason-tool-installer.nvim', - version = '*', - opts = { - auto_install = true, - auto_update = true, - ensure_installed = mason_tools, - }, - }, - - -- JSON schemas for Neovim - -- https://github.com/b0o/SchemaStore.nvim - { 'b0o/schemastore.nvim' }, - - -- Performant, batteries-included completion plugin for Neovim - -- https://github.com/saghen/blink.cmp - -- See lua/plugins/blink.lua for configs - { 'saghen/blink.cmp' }, - }, opts = { default_mappings = false, - mappings = { - gd = 'lua require"telescope.builtin".lsp_definitions()', - gi = 'lua require"telescope.builtin".lsp_implementations()', - gr = 'lua require"telescope.builtin".lsp_references()', - }, - inlay_hints = { - enabled = true, - }, servers = lsp_servers, }, config = function(_, opts) @@ -315,16 +306,6 @@ return { 'stevearc/conform.nvim', event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, - keys = { - { - 'cf', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = 'Format buffer', - }, - }, opts = { notify_on_error = false, ---@type nil|conform.FormatOpts|fun(bufnr: integer): nil|conform.FormatOpts @@ -340,9 +321,9 @@ return { lsp_format_opt = 'fallback' end - -- Disable autoformat for files in a certain path + -- Disable autoformat for files in a certain paths local bufname = vim.api.nvim_buf_get_name(bufnr) - if bufname:match '/node_modules/' then return end + if bufname:match '/node_modules|vendor/' then return end return { timeout_ms = 500, diff --git a/docs/nvim-keybindings.md b/docs/nvim-keybindings.md index 98b40a2..e3cec77 100644 --- a/docs/nvim-keybindings.md +++ b/docs/nvim-keybindings.md @@ -180,8 +180,6 @@ n tmc * setlocal cursorline! cursorline? Toggle 'cursorline' n tmb * lua vim.o.bg = vim.o.bg == "dark" and "light" or "dark"; print(vim.o.bg) Toggle 'background' -os cf * ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua - Format buffer x # * vim/_defaults.lua :help v_#-default o % (MatchitOperationForward) @@ -190,9 +188,9 @@ n % (MatchitNormalForward) n & * :&& :help &-default n '? & :echo ":Start" dispatch#start_focus(v:count > 1 ? 0 : v:count ? line(".") : -1) -n '! & 10_:.Start! -n ' & 10_:.Start -n ' & 10_:.Start +n '! & 28_:.Start! +n ' & 28_:.Start +n ' & 28_:.Start x * * vim/_defaults.lua :help v_star-default v < * lua MiniDiff.goto_hunk('next') Next hunk n ]d * vim/_defaults.lua Jump to the next diagnostic -n `? & 10_:.FocusDispatch -n `! & 10_:.Dispatch! -n ` & 10_:.Dispatch -n ` & 10_:.Dispatch +n `? & 28_:.FocusDispatch +n `! & 28_:.Dispatch! +n ` & 28_:.Dispatch +n ` & 28_:.Dispatch x a% (MatchitVisualTextObject) o ax (textobj-xmlattr-attr-a) x ax (textobj-xmlattr-attr-a) @@ -284,13 +282,13 @@ o g% (MatchitOperationBackward) x g% (MatchitVisualBackward) n g% (MatchitNormalBackward) n g`? & :echo ":Spawn" dispatch#spawn_focus(v:count > 1 ? 0 : v:count ? line(".") : -1) -n g`! & 10_:.Spawn! -n g` & 10_:.Spawn -n g` & 10_:.Spawn +n g`! & 28_:.Spawn! +n g` & 28_:.Spawn +n g` & 28_:.Spawn n g'? & :echo ":Spawn" dispatch#spawn_focus(v:count > 1 ? 0 : v:count ? line(".") : -1) -n g'! & 10_:.Spawn! -n g' & 10_:.Spawn -n g' & 10_:.Spawn +n g'! & 28_:.Spawn! +n g' & 28_:.Spawn +n g' & 28_:.Spawn x gS * :lua MiniSplitjoin.toggle({ region = MiniSplitjoin.get_visual_region() }) Toggle arguments n gS * v:lua.MiniSplitjoin.operator("toggle") . " " @@ -372,9 +370,9 @@ x k * v:count == 0 ? 'gk' : 'k' n k * v:count == 0 ? 'gk' : 'k' Move up n m? & :echo ":Dispatch" dispatch#make_focus(v:count > 1 ? 0 : v:count ? line(".") : -1) -n m! & 10_:.Make! -n m & 10_:.Make -n m & 10_:.Make +n m! & 28_:.Make! +n m & 28_:.Make +n m & 28_:.Make n shn * ~/.local/share/nvim/lazy/mini.nvim/lua/mini/surround.lua Highlight next surrounding n sFn * ~/.local/share/nvim/lazy/mini.nvim/lua/mini/surround.lua @@ -458,6 +456,14 @@ x (MatchitVisualBackward) * :call matchit#Match_wrapper('',0,'v')(MatchitVisualForward) * :call matchit#Match_wrapper('',1,'v'):if col("''") != col("$") | exe ":normal! m'" | endifgv`` n (MatchitNormalBackward) * :call matchit#Match_wrapper('',0,'n') n (MatchitNormalForward) * :call matchit#Match_wrapper('',1,'n') +o (textobj-xmlattr-attr-i) & 34_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-i","o") +v (textobj-xmlattr-attr-i) & 34_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-i","v") +o (textobj-xmlattr-attr-a) & 34_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-a","o") +v (textobj-xmlattr-attr-a) & 34_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-a","v") +n 34_ * 34_ + 34_(save-cursor-pos) * 34_save_cursor_pos() +n 28_:. & :=getcmdline() =~ ',' ? "\0250" : "" +n PlenaryTestFile * :lua require('plenary.test_harness').test_file(vim.fn.expand("%:p")) s luasnip-jump-prev * ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua LuaSnip: Jump to the previous node s luasnip-jump-next * ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua @@ -474,14 +480,6 @@ s luasnip-expand-or-jump * ~/.local/share/nvim/lazy/LuaSnip/plugin/luasni LuaSnip: Repeat last node expansion n luasnip-delete-check * ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua LuaSnip: Removes current snippet from jumplist -n PlenaryTestFile * :lua require('plenary.test_harness').test_file(vim.fn.expand("%:p")) -o (textobj-xmlattr-attr-i) & 14_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-i","o") -v (textobj-xmlattr-attr-i) & 14_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-i","v") -o (textobj-xmlattr-attr-a) & 14_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-a","o") -v (textobj-xmlattr-attr-a) & 14_(save-cursor-pos):call g:__textobj_xmlattr.do_by_pattern("select","attr-a","v") -n 14_ * 14_ - 14_(save-cursor-pos) * 14_save_cursor_pos() -n 10_:. & :=getcmdline() =~ ',' ? "\0250" : "" x * silent! update | redraw Save and go to Normal mode n * :w! @@ -494,4 +492,4 @@ n * :lua vim.lsp.buf.signature_help() Signature ``` -- Generated on Tue 21 Jan 2025 15:03:23 EET +- Generated on Tue 21 Jan 2025 15:24:13 EET