diff --git a/nvim/dot-config/nvim/lua/plugins/blink.lua b/nvim/dot-config/nvim/lua/plugins/blink.lua index 353faf8..41efd3e 100644 --- a/nvim/dot-config/nvim/lua/plugins/blink.lua +++ b/nvim/dot-config/nvim/lua/plugins/blink.lua @@ -5,6 +5,7 @@ return { "saghen/blink.cmp", -- optional: provides snippets for the snippet source dependencies = { "rafamadriz/friendly-snippets" }, + event = "InsertEnter", -- use a release tag to download pre-built binaries version = "1.*", @@ -117,6 +118,10 @@ return { }, }, + cmdline = { + enabled = false, + }, + -- (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"` diff --git a/nvim/dot-config/nvim/lua/plugins/colorizer.lua b/nvim/dot-config/nvim/lua/plugins/colorizer.lua index 387e803..774d121 100644 --- a/nvim/dot-config/nvim/lua/plugins/colorizer.lua +++ b/nvim/dot-config/nvim/lua/plugins/colorizer.lua @@ -3,7 +3,6 @@ --- @type LazySpec return { "NvChad/nvim-colorizer.lua", - event = "VeryLazy", opts = { lazy_load = true, filetypes = { diff --git a/nvim/dot-config/nvim/lua/plugins/dap.lua b/nvim/dot-config/nvim/lua/plugins/dap.lua index f8505eb..0281cd8 100644 --- a/nvim/dot-config/nvim/lua/plugins/dap.lua +++ b/nvim/dot-config/nvim/lua/plugins/dap.lua @@ -3,6 +3,7 @@ --- @type LazySpec return { { + enabled = false, "mfussenegger/nvim-dap", config = function() local dap = require("dap") @@ -88,6 +89,7 @@ return { end, }, { + enabled = false, "theHamsta/nvim-dap-virtual-text", dependencies = { "mfussenegger/nvim-dap", diff --git a/nvim/dot-config/nvim/lua/plugins/fidget.lua b/nvim/dot-config/nvim/lua/plugins/fidget.lua index 703b1d9..1ad2747 100644 --- a/nvim/dot-config/nvim/lua/plugins/fidget.lua +++ b/nvim/dot-config/nvim/lua/plugins/fidget.lua @@ -3,6 +3,7 @@ --- @type LazySpec return { "j-hui/fidget.nvim", + event = "LspAttach", opts = { notification = { window = { diff --git a/nvim/dot-config/nvim/lua/plugins/gitsigns.lua b/nvim/dot-config/nvim/lua/plugins/gitsigns.lua index ca7b509..653ea3f 100644 --- a/nvim/dot-config/nvim/lua/plugins/gitsigns.lua +++ b/nvim/dot-config/nvim/lua/plugins/gitsigns.lua @@ -4,7 +4,7 @@ return { -- Adds git related signs to the gutter, as well as utilities for managing changes "lewis6991/gitsigns.nvim", - event = "VeryLazy", + event = { "BufWritePost", "BufReadPre" }, --- @module "gitsigns" --- @type Gitsigns.Config opts = { @@ -32,30 +32,42 @@ return { }, }, init = function() - local ga = require("gitsigns.actions") - - vim.keymap.set("n", "gs", ga.stage_hunk, { desc = "(Un)stage hunk" }) - vim.keymap.set("n", "gS", ga.stage_buffer, { desc = "Stage buffer" }) + vim.keymap.set("n", "gs", function() + require("gitsigns.actions").stage_hunk() + end, { desc = "(Un)stage hunk" }) + vim.keymap.set("n", "gS", function() + require("gitsigns.actions").stage_buffer() + end, { desc = "Stage buffer" }) vim.keymap.set("v", "gs", function() - ga.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + require("gitsigns.actions").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, { desc = "(Un)stage selection" }) - vim.keymap.set("n", "gd", ga.preview_hunk, { desc = "Diff hunk" }) + vim.keymap.set("n", "gd", function() + require("gitsigns.actions").preview_hunk() + end, { desc = "Diff hunk" }) - vim.keymap.set("n", "tb", ga.toggle_current_line_blame, { desc = "Line blame" }) - vim.keymap.set("n", "gb", ga.blame_line, { desc = "View blame" }) + vim.keymap.set("n", "tb", function() + require("gitsigns.actions").toggle_current_line_blame() + end, { desc = "Line blame" }) + vim.keymap.set("n", "gb", function() + require("gitsigns.actions").blame_line() + end, { desc = "View blame" }) - vim.keymap.set("n", "gr", ga.reset_hunk, { desc = "Reset hunk" }) - vim.keymap.set("n", "gR", ga.reset_buffer, { desc = "Reset buffer" }) + vim.keymap.set("n", "gr", function() + require("gitsigns.actions").reset_hunk() + end, { desc = "Reset hunk" }) + vim.keymap.set("n", "gR", function() + require("gitsigns.actions").reset_buffer() + end, { desc = "Reset buffer" }) vim.keymap.set("v", "gr", function() - ga.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + require("gitsigns.actions").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, { desc = "Git reset selection" }) vim.keymap.set("n", "]g", function() - ga.nav_hunk("next") + require("gitsigns.actions").nav_hunk("next") end, { desc = "Next hunk" }) vim.keymap.set("n", "[g", function() - ga.nav_hunk("prev") + require("gitsigns.actions").nav_hunk("prev") end, { desc = "Previous hunk" }) end, } diff --git a/nvim/dot-config/nvim/lua/plugins/guess-indent.lua b/nvim/dot-config/nvim/lua/plugins/guess-indent.lua index 1fc467b..3ffb340 100644 --- a/nvim/dot-config/nvim/lua/plugins/guess-indent.lua +++ b/nvim/dot-config/nvim/lua/plugins/guess-indent.lua @@ -3,6 +3,8 @@ --- @type LazySpec return { "NMAC427/guess-indent.nvim", + cmd = "GuessIndent", + event = { "BufReadPre" }, --- @module "guess-indent" --- @type GuessIndentConfig opts = {}, diff --git a/nvim/dot-config/nvim/lua/plugins/inc-rename.lua b/nvim/dot-config/nvim/lua/plugins/inc-rename.lua index 6c77cfe..1f66876 100644 --- a/nvim/dot-config/nvim/lua/plugins/inc-rename.lua +++ b/nvim/dot-config/nvim/lua/plugins/inc-rename.lua @@ -3,6 +3,9 @@ --- @type LazySpec return { "smjonas/inc-rename.nvim", + cmd = "IncRename", + -- We can't load on just the command otherwise the preview does not work + event = "LspAttach", --- @module "inc_rename" --- @type inc_rename.UserConfig opts = { diff --git a/nvim/dot-config/nvim/lua/plugins/kubernetes.lua b/nvim/dot-config/nvim/lua/plugins/kubernetes.lua index f21973f..5808f6c 100644 --- a/nvim/dot-config/nvim/lua/plugins/kubernetes.lua +++ b/nvim/dot-config/nvim/lua/plugins/kubernetes.lua @@ -3,6 +3,7 @@ --- @type LazySpec return { "diogo464/kubernetes.nvim", + ft = "yaml", opts = { schema_strict = true, schema_generate_always = false, diff --git a/nvim/dot-config/nvim/lua/plugins/lspconfig.lua b/nvim/dot-config/nvim/lua/plugins/lspconfig.lua index 507fc07..0698d26 100644 --- a/nvim/dot-config/nvim/lua/plugins/lspconfig.lua +++ b/nvim/dot-config/nvim/lua/plugins/lspconfig.lua @@ -3,4 +3,5 @@ --- @type LazySpec return { "neovim/nvim-lspconfig", + cmd = { "LspInfo", "LspStart", "LspStop", "LspRestart" }, } diff --git a/nvim/dot-config/nvim/lua/plugins/lualine.lua b/nvim/dot-config/nvim/lua/plugins/lualine.lua index 109b739..a949e7f 100644 --- a/nvim/dot-config/nvim/lua/plugins/lualine.lua +++ b/nvim/dot-config/nvim/lua/plugins/lualine.lua @@ -1,6 +1,10 @@ -- https://github.com/nvim-lualine/lualine.nvim local function get_schema() + if vim.bo.filetype ~= "yaml" then + return "" + end + local schema = require("schema-companion.context").get_buffer_schema() if schema.name == "none" then return "" diff --git a/nvim/dot-config/nvim/lua/plugins/mason-lspconfig.lua b/nvim/dot-config/nvim/lua/plugins/mason-lspconfig.lua index 1bae420..11d8df5 100644 --- a/nvim/dot-config/nvim/lua/plugins/mason-lspconfig.lua +++ b/nvim/dot-config/nvim/lua/plugins/mason-lspconfig.lua @@ -3,6 +3,7 @@ --- @type LazySpec return { "mason-org/mason-lspconfig.nvim", + cmd = { "LspInstall", "LspUninstall" }, event = "VeryLazy", --- @module "mason-lspconfig" --- @type MasonLspconfigSettings diff --git a/nvim/dot-config/nvim/lua/plugins/mason-tool-installer.lua b/nvim/dot-config/nvim/lua/plugins/mason-tool-installer.lua index 948e7fe..4d74891 100644 --- a/nvim/dot-config/nvim/lua/plugins/mason-tool-installer.lua +++ b/nvim/dot-config/nvim/lua/plugins/mason-tool-installer.lua @@ -36,6 +36,5 @@ return { ensure_installed = ensure_installed, auto_update = true, debounde_hours = 24, - start_delay = 1000, }, } diff --git a/nvim/dot-config/nvim/lua/plugins/mason.lua b/nvim/dot-config/nvim/lua/plugins/mason.lua index 4066867..d71a7c2 100644 --- a/nvim/dot-config/nvim/lua/plugins/mason.lua +++ b/nvim/dot-config/nvim/lua/plugins/mason.lua @@ -3,6 +3,7 @@ --- @type LazySpec return { "mason-org/mason.nvim", + cmd = { "Mason", "MasonUpdate", "MasonInstall", "MasonUninstall", "MasonUninstallAll", "MasonLog" }, --- @module "mason" --- @type MasonSettings opts = {}, diff --git a/nvim/dot-config/nvim/lua/plugins/ros.lua b/nvim/dot-config/nvim/lua/plugins/ros.lua index 684e244..c2f9266 100644 --- a/nvim/dot-config/nvim/lua/plugins/ros.lua +++ b/nvim/dot-config/nvim/lua/plugins/ros.lua @@ -3,6 +3,7 @@ --- @type LazySpec return { "tadachs/ros-nvim", + event = { "BufRead", "BufNewFile" }, opts = { only_workspace = true, }, @@ -10,6 +11,5 @@ return { dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", - "nvim-telescope/telescope.nvim", }, } diff --git a/nvim/dot-config/nvim/lua/plugins/schema-companion.lua b/nvim/dot-config/nvim/lua/plugins/schema-companion.lua index 16d490e..205caaa 100644 --- a/nvim/dot-config/nvim/lua/plugins/schema-companion.lua +++ b/nvim/dot-config/nvim/lua/plugins/schema-companion.lua @@ -38,14 +38,16 @@ return { "nvim-telescope/telescope.nvim", "diogo464/kubernetes.nvim", }, - init = function() - vim.keymap.set( - "n", + keys = { + { "ys", - require("telescope").extensions.schema_companion.select_schema, - { desc = "Yaml schema" } - ) - end, + function() + require("telescope").extensions.schema_companion.select_schema() + end, + desc = "Yaml schema", + ft = "yaml", + }, + }, --- @module "schema-companion" --- @type schema_companion.Config opts = { diff --git a/nvim/dot-config/nvim/lua/plugins/schemastore.lua b/nvim/dot-config/nvim/lua/plugins/schemastore.lua index 045fb57..f2fbf0a 100644 --- a/nvim/dot-config/nvim/lua/plugins/schemastore.lua +++ b/nvim/dot-config/nvim/lua/plugins/schemastore.lua @@ -3,4 +3,5 @@ --- @type LazySpec return { "b0o/schemastore.nvim", + lazy = true, } diff --git a/nvim/dot-config/nvim/lua/plugins/smart-splits.lua b/nvim/dot-config/nvim/lua/plugins/smart-splits.lua index 2d23bae..1642e14 100644 --- a/nvim/dot-config/nvim/lua/plugins/smart-splits.lua +++ b/nvim/dot-config/nvim/lua/plugins/smart-splits.lua @@ -3,24 +3,51 @@ --- @type LazySpec return { "mrjones2014/smart-splits.nvim", + event = "VeryLazy", + --- @module "smart-splits" + --- @type SmartSplitsConfig opts = { at_edge = "stop", cursor_follows_swapped_bufs = true, }, init = function() - vim.keymap.set("n", "", require("smart-splits").move_cursor_left) - vim.keymap.set("n", "", require("smart-splits").move_cursor_down) - vim.keymap.set("n", "", require("smart-splits").move_cursor_up) - vim.keymap.set("n", "", require("smart-splits").move_cursor_right) + vim.keymap.set("n", "", function() + require("smart-splits").move_cursor_left() + end) + vim.keymap.set("n", "", function() + require("smart-splits").move_cursor_down() + end) + vim.keymap.set("n", "", function() + require("smart-splits").move_cursor_up() + end) + vim.keymap.set("n", "", function() + require("smart-splits").move_cursor_right() + end) - vim.keymap.set("n", "h", require("smart-splits").swap_buf_left, { desc = "Swap buffer to the left" }) - vim.keymap.set("n", "j", require("smart-splits").swap_buf_down, { desc = "Swap buffer to the bottom" }) - vim.keymap.set("n", "k", require("smart-splits").swap_buf_up, { desc = "Swap buffer to the top" }) - vim.keymap.set("n", "l", require("smart-splits").swap_buf_right, { desc = "Swap buffer to the right" }) + vim.keymap.set("n", "h", function() + require("smart-splits").swap_buf_left() + end, { desc = "Swap buffer to the left" }) + vim.keymap.set("n", "j", function() + require("smart-splits").swap_buf_down() + end, { desc = "Swap buffer to the bottom" }) + vim.keymap.set("n", "k", function() + require("smart-splits").swap_buf_up() + end, { desc = "Swap buffer to the top" }) + vim.keymap.set("n", "l", function() + require("smart-splits").swap_buf_right() + end, { desc = "Swap buffer to the right" }) - vim.keymap.set("n", "", require("smart-splits").resize_left, { desc = "Resize buffer to the left" }) - vim.keymap.set("n", "", require("smart-splits").resize_down, { desc = "Resize buffer to the bottom" }) - vim.keymap.set("n", "", require("smart-splits").resize_up, { desc = "Resize buffer to the top" }) - vim.keymap.set("n", "", require("smart-splits").resize_right, { desc = "Resize buffer to the right" }) + vim.keymap.set("n", "", function() + require("smart-splits").resize_left() + end, { desc = "Resize buffer to the left" }) + vim.keymap.set("n", "", function() + require("smart-splits").resize_down() + end, { desc = "Resize buffer to the bottom" }) + vim.keymap.set("n", "", function() + require("smart-splits").resize_up() + end, { desc = "Resize buffer to the top" }) + vim.keymap.set("n", "", function() + require("smart-splits").resize_right() + end, { desc = "Resize buffer to the right" }) end, } diff --git a/nvim/dot-config/nvim/lua/plugins/telescope.lua b/nvim/dot-config/nvim/lua/plugins/telescope.lua index 0aed161..3d09808 100644 --- a/nvim/dot-config/nvim/lua/plugins/telescope.lua +++ b/nvim/dot-config/nvim/lua/plugins/telescope.lua @@ -4,51 +4,63 @@ local window = require("symbols.window") --- @type LazySpec return { "nvim-telescope/telescope.nvim", + cmd = { "Telescope" }, dependencies = { "nvim-lua/plenary.nvim", - "nvim-telescope/telescope-ui-select.nvim", + { + "nvim-telescope/telescope-ui-select.nvim", + config = function() + require("telescope").load_extension("ui-select") + end, + }, { "nvim-telescope/telescope-fzf-native.nvim", build = "make", cond = function() return vim.fn.executable("make") == 1 end, + config = function() + require("telescope").load_extension("fzf") + end, }, }, - opts = { - pickers = { - find_files = { - hidden = true, - }, - }, - defaults = { - file_ignore_patterns = { - ".git/", - }, - mappings = { - n = { - [""] = "move_selection_worse", - [""] = "move_selection_better", - }, - i = { - [""] = "move_selection_worse", - [""] = "move_selection_better", + opts = function() + return { + pickers = { + find_files = { + hidden = true, }, }, - borderchars = window.borderchars, - }, - extensions = { - ["ui-select"] = { - require("telescope.themes").get_dropdown(), + defaults = { + file_ignore_patterns = { + ".git/", + }, + mappings = { + n = { + [""] = "move_selection_worse", + [""] = "move_selection_better", + }, + i = { + [""] = "move_selection_worse", + [""] = "move_selection_better", + }, + }, + borderchars = window.borderchars, }, - }, - }, + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown(), + }, + }, + } + end, init = function() - require("telescope").load_extension("fzf") - require("telescope").load_extension("ui-select") - - vim.keymap.set("n", ".", require("telescope.builtin").oldfiles, { desc = "Find recently opened files" }) - vim.keymap.set("n", "sb", require("telescope.builtin").buffers, { desc = "Buffers" }) + vim.keymap.set("n", ".", function() + require("telescope.builtin").oldfiles() + end, { desc = "Find recently opened files" }) + vim.keymap.set("n", "sb", function() + require("telescope.builtin").buffers() + end, { desc = "Buffers" }) vim.keymap.set("n", "/", function() require("telescope.builtin").current_buffer_fuzzy_find({ @@ -63,18 +75,30 @@ return { }) end, { desc = "Grep in open files" }) - vim.keymap.set("n", "", require("telescope.builtin").find_files, { desc = "Find files" }) - vim.keymap.set("n", "sh", require("telescope.builtin").help_tags, { desc = "Help" }) + vim.keymap.set("n", "", function() + require("telescope.builtin").find_files() + end, { desc = "Find files" }) + vim.keymap.set("n", "sh", function() + require("telescope.builtin").help_tags() + end, { desc = "Help" }) vim.keymap.set("n", "sw", function() require("telescope.builtin").grep_string({ -- Show matches in the order they appear in the document sorting_strategy = "ascending", }) end, { desc = "Current word" }) - vim.keymap.set("n", "sg", require("telescope.builtin").live_grep, { desc = "Grep" }) - vim.keymap.set("n", "sd", require("telescope.builtin").diagnostics, { desc = "Diagnostics" }) - vim.keymap.set("n", "sr", require("telescope.builtin").resume, { desc = "Resume" }) - vim.keymap.set("n", "sk", require("telescope.builtin").keymaps, { desc = "Keymaps" }) + vim.keymap.set("n", "sg", function() + require("telescope.builtin").live_grep() + end, { desc = "Grep" }) + vim.keymap.set("n", "sd", function() + require("telescope.builtin").diagnostics() + end, { desc = "Diagnostics" }) + vim.keymap.set("n", "sr", function() + require("telescope.builtin").resume() + end, { desc = "Resume" }) + vim.keymap.set("n", "sk", function() + require("telescope.builtin").keymaps() + end, { desc = "Keymaps" }) vim.keymap.set("n", "sn", function() require("telescope.builtin").find_files({ cwd = vim.fn.stdpath("config") }) end, { desc = "Neovim files" }) diff --git a/nvim/dot-config/nvim/lua/plugins/todo-comments.lua b/nvim/dot-config/nvim/lua/plugins/todo-comments.lua index daea378..c2d4e2d 100644 --- a/nvim/dot-config/nvim/lua/plugins/todo-comments.lua +++ b/nvim/dot-config/nvim/lua/plugins/todo-comments.lua @@ -8,6 +8,7 @@ return { dependencies = { "nvim-lua/plenary.nvim", }, + event = "VeryLazy", opts = { keywords = { -- FIX: Fix @@ -52,13 +53,12 @@ return { require("todo-comments").jump_prev() end, { desc = "Previous todo comment" }) - if pcall(require, "trouble") then - -- TODO: Use cwd to only show todo's in the current file - -- vim.keymap.set("n", "", "TroubleToggle todo cwd=%", { desc = "Next todo comment" }) - vim.keymap.set("n", "", "TroubleToggle todo", { desc = "Next todo comment" }) - end - if pcall(require, "telescope") then - vim.keymap.set("n", "st", "TodoTelescope", { desc = "Search todo" }) - end + -- -- TODO: Use cwd to only show todo's in the current file + -- -- vim.keymap.set("n", "", "TroubleToggle todo cwd=%", { desc = "Next todo comment" }) + -- vim.keymap.set("n", "", "TroubleToggle todo", { desc = "Next todo comment" }) + + vim.keymap.set("n", "st", function() + require("telescope").extensions["todo-comments"].todo() + end, { desc = "Search todo" }) end, } diff --git a/nvim/dot-config/nvim/lua/plugins/which-key.lua b/nvim/dot-config/nvim/lua/plugins/which-key.lua index 0f2ca99..6751714 100644 --- a/nvim/dot-config/nvim/lua/plugins/which-key.lua +++ b/nvim/dot-config/nvim/lua/plugins/which-key.lua @@ -4,6 +4,7 @@ local window = require("symbols.window") --- @type LazySpec return { "folke/which-key.nvim", + event = "VeryLazy", --- @module "which-key" --- @type wk.Opts opts = { @@ -48,15 +49,13 @@ return { }, expand = 1, sort = { "alphanum" }, - }, - init = function() - require("which-key").add({ + spec = { { "b", group = "Buffer" }, { "d", group = "Doument" }, { "g", group = "Git" }, { "t", group = "Toggle" }, { "s", group = "Search" }, { "gr", group = "LSP" }, - }) - end, + }, + }, }