From 16321c0c4fd0415dcb813af49ba0fc28ba389714 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Tue, 10 Dec 2024 22:19:29 +0100 Subject: [PATCH] Neovim: Update packages --- .config/nvim/lazy-lock.json | 70 +++++++++++++------------- .config/nvim/lua/core/autocommands.lua | 13 +++++ .config/nvim/lua/editor.lua | 6 --- .config/nvim/lua/keybind-functions.lua | 6 +-- .config/nvim/lua/keybinds.lua | 47 ++++++++--------- 5 files changed, 75 insertions(+), 67 deletions(-) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index b32c7ab..b26e336 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,40 +1,40 @@ { - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, - "auto-save.nvim": { "branch": "main", "commit": "e98cafef75271ec83dc84c933f124ab1bb675ef8" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, + "auto-save.nvim": { "branch": "main", "commit": "b58948445c43e6903987a9bb97c82e66fdcc0786" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, - "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, - "friendly-snippets": { "branch": "main", "commit": "dbd45e9ba76d535e4cba88afa1b7aa43bb765336" }, - "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, - "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, - "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, - "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, - "neodev.nvim": { "branch": "main", "commit": "f7f249b361e9fb245eea24cbcd9f5502e796c6ea" }, - "neogit": { "branch": "master", "commit": "0d0879b0045fb213c328126969a3317c0963d34a" }, - "nvim-base16": { "branch": "master", "commit": "b3e9ec6a82c05b562cd71f40fe8964438a9ba64a" }, - "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-lspconfig": { "branch": "master", "commit": "d5b6d4366dfd7a1071b930defd365e6d0be258de" }, - "nvim-treesitter": { "branch": "master", "commit": "adf72368f6af026b4cd19851d34a313a54159857" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "7f00d94543f1fd37cab2afa2e9a6cd54e1c6b9ef" }, - "nvim-web-devicons": { "branch": "master", "commit": "14ac5887110b06b89a96881d534230dac3ed134d" }, - "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "4be2e8689067494ed7e5a4f1221adc31d1a07783" }, - "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "dashboard-nvim": { "branch": "master", "commit": "ae309606940d26d8c9df8b048a6e136b6bbec478" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, + "lazy.nvim": { "branch": "main", "commit": "7c493713bc2cb392706866eeba53aaef6c8e9fc6" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "neogit": { "branch": "master", "commit": "40038473707c54a846bd11ecaf5933dd45858972" }, + "nvim-base16": { "branch": "master", "commit": "6ac181b5733518040a33017dde654059cd771b7c" }, + "nvim-cmp": { "branch": "main", "commit": "3403e2e9391ed0a28c3afddd8612701b647c8e26" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-lspconfig": { "branch": "master", "commit": "5a812abc65d529ea7673059a348814c21d7f87ff" }, + "nvim-treesitter": { "branch": "master", "commit": "337b503688eccb3046547661e4c738e674548fcf" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, + "nvim-web-devicons": { "branch": "master", "commit": "e73d2774d12d0ecf9e05578d692ba1ea50508cf2" }, + "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "4916fa12e5b28d21a1f031f0bdd10aa15a75d85d" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "161eb67a82ee269d1037df64c6d5a05bd5860d32" }, - "sqlite.lua": { "branch": "master", "commit": "40701b6151f8883980c1548647116de39b763540" }, - "telescope-all-recent.nvim": { "branch": "main", "commit": "c1a83b96de07ed4c27af5a46cf8b10c8ee802973" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope-recent-files": { "branch": "main", "commit": "6893cda11625254cc7dc2ea76e0a100c7deeb028" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, - "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, - "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, - "ultimate-autopair.nvim": { "branch": "development", "commit": "6ecf7461d44513af89f8257f057fcc99e9297612" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } -} \ No newline at end of file + "rainbow-delimiters.nvim": { "branch": "master", "commit": "c7e489756b5455f922ce79ac374a4ede594f4a20" }, + "sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" }, + "telescope-all-recent.nvim": { "branch": "main", "commit": "267e9e5fd13a6e9a4cc6ffe00452d446d040401d" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope-recent-files": { "branch": "main", "commit": "3a7a1b9c6b52b6ff7938c59f64c87a05e013dff8" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" }, + "ultimate-autopair.nvim": { "branch": "development", "commit": "9e3209190c22953566ae4e6436ad2b4ff4dabb95" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" } +} diff --git a/.config/nvim/lua/core/autocommands.lua b/.config/nvim/lua/core/autocommands.lua index 6656d5f..172cf1c 100644 --- a/.config/nvim/lua/core/autocommands.lua +++ b/.config/nvim/lua/core/autocommands.lua @@ -27,3 +27,16 @@ vim.api.nvim_create_autocmd("TextYankPost", { group = highlight_group, callback = function() vim.highlight.on_yank() end, }) + +-- Show message when autosaving +local group = vim.api.nvim_create_augroup('autosave', {}) +vim.api.nvim_create_autocmd('User', { + pattern = 'AutoSaveWritePost', + group = group, + callback = function(opts) + if opts.data.saved_buffer ~= nil then + local filename = vim.api.nvim_buf_get_name(opts.data.saved_buffer) + vim.notify("Wrote " .. filename, vim.log.levels.INFO) + end + end, +}) diff --git a/.config/nvim/lua/editor.lua b/.config/nvim/lua/editor.lua index 05eb9f8..83948b2 100644 --- a/.config/nvim/lua/editor.lua +++ b/.config/nvim/lua/editor.lua @@ -43,12 +43,6 @@ return { cmd = "ASToggle", -- defer, until run command event = { "InsertLeave", "TextChanged" }, -- defer, until event trigger opts = { - execution_message = { - enabled = true, - message = function() - return [["]] .. vim.fn.bufname() .. [[" written]] - end, - }, debounce_delay = 5000, -- delay for `defer_save`, in ms condition = function(buf) -- Dont save special-buffers diff --git a/.config/nvim/lua/keybind-functions.lua b/.config/nvim/lua/keybind-functions.lua index 7fe7592..deeaef3 100644 --- a/.config/nvim/lua/keybind-functions.lua +++ b/.config/nvim/lua/keybind-functions.lua @@ -13,9 +13,9 @@ end -- Set which-key key section description M.wk = function(keybind, description, bufnr) - require("which-key").register({ - [keybind] = { name = description, _ = "which_key_ignore" }, - }, { mode = { "n", "v" }, buffer = bufnr }) -- bufnr = nil means global + require("which-key").add({ + { keybind, group = description, mode = { "n", "v" }, buffer = bufnr }, + }) end M.buffer_close = function() diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua index 764dc0d..be75fae 100644 --- a/.config/nvim/lua/keybinds.lua +++ b/.config/nvim/lua/keybinds.lua @@ -64,7 +64,7 @@ M.setup = function() K("n", "", builtin.commands, { desc = "Execute command" }) - -- F.wk("b", "buffer/bookmark") + F.wk("b", "buffer/bookmark") K("n", "bb", builtin.buffers, { desc = "Switch buffer" }) K("n", "bd", F.buffer_dashboard, { desc = "Dashboard" }) @@ -119,29 +119,30 @@ M.setup = function() K({ "n", "v" }, "w", "", { remap = true }) -- keymap and which-key should *both* be triggered - wk.register({ - w = { - name = "window", - s = "Split window", - v = "Split window vertically", - w = "Switch windows", - q = "Quit a window", - o = "Close all other windows", - T = "Break out into a new tab", - x = "Swap current with next", - ["-"] = "Decrease height", - ["+"] = "Increase height", - [""] = "Decrease width", - [">"] = "Increase width", - ["|"] = "Max out the width", - ["_"] = "Max out the height", - ["="] = "Equally high and wide", - h = "Go to the left window", - l = "Go to the right window", - k = "Go to the up window", - j = "Go to the down window", + wk.add({ + { + mode = { "n", "v" }, + { "w", group = "window" }, + { "w+", desc = "Increase height" }, + { "w-", desc = "Decrease height" }, + { "w<", desc = "Decrease width" }, + { "w=", desc = "Equally high and wide" }, + { "w>", desc = "Increase width" }, + { "wT", desc = "Break out into a new tab" }, + { "w_", desc = "Max out the height" }, + { "wh", desc = "Go to the left window" }, + { "wj", desc = "Go to the down window" }, + { "wk", desc = "Go to the up window" }, + { "wl", desc = "Go to the right window" }, + { "wo", desc = "Close all other windows" }, + { "wq", desc = "Quit a window" }, + { "ws", desc = "Split window" }, + { "wv", desc = "Split window vertically" }, + { "ww", desc = "Switch windows" }, + { "wx", desc = "Swap current with next" }, + { "w|", desc = "Max out the width" }, }, - }, { mode = { "n", "v" }, prefix = "", preset = true }) + }) -- https://github.com/folke/which-key.nvim/issues/270 -- https://github.com/folke/which-key.nvim/blob/main/lua/which-key/plugins/presets/misc.lua end