From 91499a306fc4605ee4c90c2f1eab33b2887f863d Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Mon, 6 Jan 2025 17:20:06 +0530 Subject: [PATCH] chore(nvim): Neovim config cleanups - Use newer installation for Lazy.nvim - Treesitter: ensure_install sql, bash, jsonc, python, dockerfile plugins - Completion: Use to accept. to accept was interfering with completions that were suggested at end of the line and you don't want to accept but just want to go to the next line - Snacks: disble the abhorrent *smooth* scrolling - Whichkey: More time before pop-up shows (450ms) --- common/.config/nvim/init.lua | 26 ++++++------------- .../lua/config/filetype-based-keymaps.lua | 1 - common/.config/nvim/lua/config/options.lua | 4 +-- .../nvim/lua/plugins/code-completion.lua | 2 +- .../.config/nvim/lua/plugins/code-generic.lua | 6 ++++- .../nvim/lua/plugins/utility-plugs.lua | 8 +++--- 6 files changed, 21 insertions(+), 26 deletions(-) diff --git a/common/.config/nvim/init.lua b/common/.config/nvim/init.lua index 6bae2cd..3caad30 100644 --- a/common/.config/nvim/init.lua +++ b/common/.config/nvim/init.lua @@ -22,7 +22,13 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then lazypath, }) if vim.v.shell_error ~= 0 then - error("Error cloning lazy.nvim:\n" .. out) + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) end end @@ -32,27 +38,11 @@ vim.opt.rtp:prepend(lazypath) -- You can also configure plugins after the setup call, -- as they will be available in your neovim runtime. require("lazy").setup({ - { import = "plugins" }, -}, { - lockfile = vim.fn.stdpath("data") .. "/lazy/lazy-lock.json", change_detection = { notify = false, }, build = { warn_on_override = true, }, - performance = { - rtp = { - -- Disable some rtp plugins - disabled_plugins = { - "gzip", - "matchit", - -- "matchparen", - "netrwPlugin", - "tarPlugin", - "tutor", - "zipPlugin", - }, - }, - }, + spec = { { import = "plugins" } }, }) diff --git a/common/.config/nvim/lua/config/filetype-based-keymaps.lua b/common/.config/nvim/lua/config/filetype-based-keymaps.lua index dd931ac..007fd4e 100644 --- a/common/.config/nvim/lua/config/filetype-based-keymaps.lua +++ b/common/.config/nvim/lua/config/filetype-based-keymaps.lua @@ -3,7 +3,6 @@ vim.api.nvim_create_autocmd("FileType", { group = vim.api.nvim_create_augroup("keymaps-javascript", { clear = true }), pattern = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", "vue", "svelte", "astro" }, callback = function() - -- vim.keymap.set({ "n", "v" }, "ca", "OmniSharpGetCodeActions", { desc = "Code: Code Actions (C#)" }) vim.keymap.set({ "n", "v" }, "co", function() vim.lsp.buf.code_action({ apply = true, diff --git a/common/.config/nvim/lua/config/options.lua b/common/.config/nvim/lua/config/options.lua index b02776e..0927dc1 100644 --- a/common/.config/nvim/lua/config/options.lua +++ b/common/.config/nvim/lua/config/options.lua @@ -20,5 +20,5 @@ vim.g.markdown_recommended_style = 0 vim.g.have_nerd_font = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -vim.opt.inccommand = 'split' +vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } +vim.opt.inccommand = "split" diff --git a/common/.config/nvim/lua/plugins/code-completion.lua b/common/.config/nvim/lua/plugins/code-completion.lua index 4ca32aa..04b852a 100644 --- a/common/.config/nvim/lua/plugins/code-completion.lua +++ b/common/.config/nvim/lua/plugins/code-completion.lua @@ -36,7 +36,7 @@ return { -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept -- See the full "keymap" documentation for information on defining your own keymap. keymap = { - preset = "enter", + preset = "super-tab", [""] = { "select_and_accept" }, [""] = { "snippet_forward", "fallback" }, diff --git a/common/.config/nvim/lua/plugins/code-generic.lua b/common/.config/nvim/lua/plugins/code-generic.lua index 436c949..07549cf 100644 --- a/common/.config/nvim/lua/plugins/code-generic.lua +++ b/common/.config/nvim/lua/plugins/code-generic.lua @@ -439,7 +439,6 @@ return { ---@diagnostic disable-next-line: missing-fields require("nvim-treesitter.configs").setup({ ensure_installed = { - -- These 2 are required for cmdline "regex", "markdown", "markdown_inline", @@ -452,6 +451,11 @@ return { "css", "json5", "yaml", + "sql", + "bash", + "jsonc", + "python", + "dockerfile", }, auto_install = true, diff --git a/common/.config/nvim/lua/plugins/utility-plugs.lua b/common/.config/nvim/lua/plugins/utility-plugs.lua index 77e103a..6535098 100644 --- a/common/.config/nvim/lua/plugins/utility-plugs.lua +++ b/common/.config/nvim/lua/plugins/utility-plugs.lua @@ -46,7 +46,7 @@ return { style = "fancy", }, scroll = { - enabled = true, + enabled = false, }, scratch = { enabled = true, @@ -86,7 +86,7 @@ return { function() Snacks.scratch.select() end, - desc = "Toggle Scratch Buffer", + desc = "Select Scratch Buffer", }, { "gz", @@ -217,13 +217,15 @@ return { "echasnovski/mini.icons", }, opts = { + delay = 450, preset = "helix", warning = true, -- Document existing key chains spec = { + { "/", group = "NVIM Scratch Buffer" }, { "a", group = "AI" }, - { "c", group = "Code", icon = { icon = "", color = "orange" } }, { "b", group = "Buffer Operations", icon = { icon = "", color = "orange" } }, + { "c", group = "Code", icon = { icon = "", color = "orange" } }, { "d", group = "Diagnostics", icon = { icon = "", color = "orange" } }, { "g", group = "Git", icon = { icon = "", color = "orange" } }, { "h", group = "Help", icon = { icon = "󰞋", color = "orange" } },