From 3b9e90ea5a8400dd6844473f17d29ff93bf00145 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Mon, 10 Nov 2025 15:26:18 +0100 Subject: [PATCH] [Perf] Start performance improvements --- nvim/lua/lazy-conf.lua | 1 - nvim/lua/plugins/lsp/lspconfig.lua | 2 -- nvim/lua/plugins/nav/gitsigns.lua | 1 + .../plugins/nav/{telescope => }/telescope.lua | 15 ++++-------- nvim/lua/plugins/nav/telescope/frecency.lua | 8 ------- nvim/lua/plugins/style/colorizer.lua | 2 +- nvim/lua/plugins/style/comment-box.lua | 24 +++++++------------ nvim/lua/plugins/style/comment.lua | 2 +- nvim/lua/plugins/style/lualine.lua | 1 + nvim/lua/plugins/style/noice.lua | 3 --- nvim/lua/plugins/style/todo-comments.lua | 1 + nvim/lua/plugins/testing/neotest.lua | 1 + nvim/lua/plugins/util/autotag.lua | 19 +++++++-------- nvim/lua/plugins/util/context.lua | 1 + nvim/lua/plugins/util/diff/diffview.lua | 13 +++++----- nvim/lua/plugins/util/scratch.lua | 9 +++---- 16 files changed, 37 insertions(+), 66 deletions(-) rename nvim/lua/plugins/nav/{telescope => }/telescope.lua (90%) delete mode 100644 nvim/lua/plugins/nav/telescope/frecency.lua diff --git a/nvim/lua/lazy-conf.lua b/nvim/lua/lazy-conf.lua index c535aef..421d24b 100755 --- a/nvim/lua/lazy-conf.lua +++ b/nvim/lua/lazy-conf.lua @@ -14,7 +14,6 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { { import = "plugins.nav" }, - { import = "plugins.nav.telescope" }, { import = "plugins.lsp" }, { import = "plugins.style" }, { import = "plugins.util" }, diff --git a/nvim/lua/plugins/lsp/lspconfig.lua b/nvim/lua/plugins/lsp/lspconfig.lua index 80167df..cc3ffc0 100755 --- a/nvim/lua/plugins/lsp/lspconfig.lua +++ b/nvim/lua/plugins/lsp/lspconfig.lua @@ -12,8 +12,6 @@ return { "mfussenegger/nvim-jdtls", }, config = function() - local enable = vim.lsp.enable - -- Change the Diagnostic symbols in the sign column (gutter) local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶", Info = "󰋽 " } for type, icon in pairs(signs) do diff --git a/nvim/lua/plugins/nav/gitsigns.lua b/nvim/lua/plugins/nav/gitsigns.lua index 79bbd1f..7ec432b 100755 --- a/nvim/lua/plugins/nav/gitsigns.lua +++ b/nvim/lua/plugins/nav/gitsigns.lua @@ -1,6 +1,7 @@ return { -- git buffer integration "lewis6991/gitsigns.nvim", + event = "BufNew", config = function() require("gitsigns").setup({ count_chars = { "¹", "²", "³", "⁴", "⁵", "⁶", "⁷", "⁸", "⁹", ["+"] = "⁺" }, diff --git a/nvim/lua/plugins/nav/telescope/telescope.lua b/nvim/lua/plugins/nav/telescope.lua similarity index 90% rename from nvim/lua/plugins/nav/telescope/telescope.lua rename to nvim/lua/plugins/nav/telescope.lua index edfdb12..f10e68d 100755 --- a/nvim/lua/plugins/nav/telescope/telescope.lua +++ b/nvim/lua/plugins/nav/telescope.lua @@ -9,6 +9,9 @@ return { -- For major updates, this must be adjusted manually. version = "^1.0.0", }, + }, + keys = { + }, config = function() local builtin = require("telescope.builtin") @@ -81,17 +84,7 @@ return { -- Old Files opts.desc = "Show recent files" - vim.keymap.set("n", "fof", builtin.oldfiles, opts) - - -- Frecency (Old files, but better) - local function run_frecency() - require("telescope").extensions.frecency.frecency({ - workspace = "CWD", - }) - end - - opts.desc = "Show recent files (Frecency algorithm)" - vim.keymap.set("n", "fr", run_frecency, opts) + vim.keymap.set("n", "fr", builtin.oldfiles, opts) -- Quickfix Items opts.desc = "Show quickfix items" diff --git a/nvim/lua/plugins/nav/telescope/frecency.lua b/nvim/lua/plugins/nav/telescope/frecency.lua deleted file mode 100644 index 6794d69..0000000 --- a/nvim/lua/plugins/nav/telescope/frecency.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "nvim-telescope/telescope-frecency.nvim", - -- install the latest stable version - version = "*", - config = function() - require("telescope").load_extension("frecency") - end, -} diff --git a/nvim/lua/plugins/style/colorizer.lua b/nvim/lua/plugins/style/colorizer.lua index dfebe71..b1b36fc 100755 --- a/nvim/lua/plugins/style/colorizer.lua +++ b/nvim/lua/plugins/style/colorizer.lua @@ -1,7 +1,7 @@ return { -- colorizes colors in code "NvChad/nvim-colorizer.lua", - --cmd = 'ColorizerToggle', + event = "BufRead", config = function() require("colorizer").setup({ filetypes = { "*" }, diff --git a/nvim/lua/plugins/style/comment-box.lua b/nvim/lua/plugins/style/comment-box.lua index 6a18867..d57208c 100755 --- a/nvim/lua/plugins/style/comment-box.lua +++ b/nvim/lua/plugins/style/comment-box.lua @@ -41,21 +41,13 @@ return { box_width = 50, line_width = 70, }) - - local opts = { silent = true } - - opts.desc = "comment text box" - vim.keymap.set({ "n", "v" }, "cb", ":CBccbox", opts) - opts.desc = "comment text line" - vim.keymap.set({ "n", "v" }, "cl", ":CBllline", opts) - opts.desc = "comment line" - vim.keymap.set({ "n", "v" }, "ce", ":CBline", opts) - opts.desc = "comment highlight" - vim.keymap.set({ "n", "v" }, "ch", ":CBlcbox18", opts) - - opts.desc = "delete comment box" - vim.keymap.set({ "n", "v" }, "cd", ":CBd", opts) - opts.desc = "yank comment box contents" - vim.keymap.set({ "n", "v" }, "cy", ":CBy", opts) end, + keys = { + { "cb", ":CBccbox", mode = { "n", "v" }, desc = "Comment text box" }, + { "cl", ":CBllline", mode = { "n", "v" }, desc = "Comment text line" }, + { "ce", ":CBline", mode = { "n", "v" }, desc = "Comment line" }, + { "ch", ":CBlcbox18", mode = { "n", "v" }, desc = "Comment highlight" }, + { "cd", ":CBd", mode = { "n", "v" }, desc = "Delete comment box" }, + { "cy", ":CBy", mode = { "n", "v" }, desc = "Yank comment box content" } + }, } diff --git a/nvim/lua/plugins/style/comment.lua b/nvim/lua/plugins/style/comment.lua index 1289f51..c78b490 100755 --- a/nvim/lua/plugins/style/comment.lua +++ b/nvim/lua/plugins/style/comment.lua @@ -2,7 +2,7 @@ return { -- add comment keybinds "numToStr/Comment.nvim", opts = {}, - lazy = false, + event = "BufRead", config = function() require("Comment").setup() require("Comment.ft").set("hyprlang", "#%s") diff --git a/nvim/lua/plugins/style/lualine.lua b/nvim/lua/plugins/style/lualine.lua index daa1033..073a483 100755 --- a/nvim/lua/plugins/style/lualine.lua +++ b/nvim/lua/plugins/style/lualine.lua @@ -2,6 +2,7 @@ return { -- status line "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, + event = "VeryLazy", config = function() local function getWords() local wc = vim.api.nvim_eval("wordcount()") diff --git a/nvim/lua/plugins/style/noice.lua b/nvim/lua/plugins/style/noice.lua index 837bc80..f7b4ad5 100755 --- a/nvim/lua/plugins/style/noice.lua +++ b/nvim/lua/plugins/style/noice.lua @@ -1,9 +1,6 @@ return { "folke/noice.nvim", event = "VeryLazy", - opts = { - -- add any options here - }, dependencies = { -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries "MunifTanjim/nui.nvim", diff --git a/nvim/lua/plugins/style/todo-comments.lua b/nvim/lua/plugins/style/todo-comments.lua index e663f5d..5e1851e 100644 --- a/nvim/lua/plugins/style/todo-comments.lua +++ b/nvim/lua/plugins/style/todo-comments.lua @@ -1,6 +1,7 @@ return { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, + event = "BufRead", opts = { { signs = true, -- show icons in the signs column diff --git a/nvim/lua/plugins/testing/neotest.lua b/nvim/lua/plugins/testing/neotest.lua index b43f23e..d7b15b6 100755 --- a/nvim/lua/plugins/testing/neotest.lua +++ b/nvim/lua/plugins/testing/neotest.lua @@ -9,6 +9,7 @@ return { "orjangj/neotest-ctest", "rouge8/neotest-rust", }, + keys = {}, config = function() local neotest = require("neotest") local keymap = vim.keymap.set diff --git a/nvim/lua/plugins/util/autotag.lua b/nvim/lua/plugins/util/autotag.lua index 27f0c1b..966f873 100755 --- a/nvim/lua/plugins/util/autotag.lua +++ b/nvim/lua/plugins/util/autotag.lua @@ -1,13 +1,12 @@ return { "windwp/nvim-ts-autotag", - config = function() - require("nvim-ts-autotag").setup({ - opts = { - -- Defaults - enable_close = true, -- Auto close tags - enable_rename = true, -- Auto rename pairs of tags - enable_close_on_slash = true, -- Auto close on trailing gd", ":DiffviewOpen", opts("Start diffview")) - vim.keymap.set("n", "gf", ":DiffviewFileHistory", opts("View file history")) - vim.keymap.set("n", "gc", ":DiffviewClose", opts("Close diffview")) - vim.keymap.set("n", "gr", ":DiffviewRefresh", opts("Refresh diffview")) - end + keys = { + { "gd", ":DiffviewOpen", desc = "Open diffview" }, + { "gf", ":DiffviewFileHistory", desc = "View file history" }, + { "gc", ":DiffviewClose", desc = "Close diffview" }, + { "gr", ":DiffviewRefresh", desc = "Refresh diffview" }, + }, } diff --git a/nvim/lua/plugins/util/scratch.lua b/nvim/lua/plugins/util/scratch.lua index e42df7d..9baa9f2 100644 --- a/nvim/lua/plugins/util/scratch.lua +++ b/nvim/lua/plugins/util/scratch.lua @@ -1,9 +1,6 @@ return { "LintaoAmons/scratch.nvim", - event = "VeryLazy", - config = function() - local opts = require("utils").opts - - vim.keymap.set("n", "+", ":Scratch", opts("Open a scratchpad")) - end, + keys = { + { "+", ":Scratch", desc = "Open a scratchpad" } + } }