From ae231ba13208205cffadb2a0e6bb78924d093203 Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Sat, 14 Jun 2025 19:26:45 +0800 Subject: [PATCH] feat(nvim): tidy old config, improve startup time --- .../editor/neovim/nvim/lua/core/options.lua | 29 ----------- .../neovim/nvim/lua/plugins/plugins-setup.lua | 48 ++++++------------- .../neovim/nvim/lua/plugins/sessions.lua | 10 ---- 3 files changed, 14 insertions(+), 73 deletions(-) delete mode 100644 modules/coding/editor/neovim/nvim/lua/plugins/sessions.lua diff --git a/modules/coding/editor/neovim/nvim/lua/core/options.lua b/modules/coding/editor/neovim/nvim/lua/core/options.lua index 426da2f..483f592 100644 --- a/modules/coding/editor/neovim/nvim/lua/core/options.lua +++ b/modules/coding/editor/neovim/nvim/lua/core/options.lua @@ -98,13 +98,6 @@ vim.api.nvim_create_autocmd("FileType", { end, }) --- fix https://github.com/neovim/neovim/issues/21856 -vim.api.nvim_create_autocmd({ "VimLeave" }, { - callback = function() - vim.fn.jobstart("", { detach = true }) - end, -}) - -- MkDir vim.api.nvim_create_user_command("MakeDirectory", function() ---@diagnostic disable-next-line: missing-parameter @@ -116,25 +109,3 @@ vim.api.nvim_create_user_command("MakeDirectory", function() vim.notify("Directory already exists", vim.log.levels.WARN, { title = "Nvim" }) end end, { desc = "Create directory if it doesn't exist" }) - --- Neovide config -if vim.g.neovide then - local global = vim.g - vim.o.guifont = "monospace:h14" - global.neovide_padding_top = 0 - global.neovide_padding_bottom = 0 - global.neovide_padding_right = 0 - global.neovide_padding_left = 0 - global.neovide_hide_mouse_when_typing = true - global.neovide_cursor_animation_length = 0.05 - global.neovide_cursor_trail_size = 0.15 - global.neovide_confirm_quit = true -end - -vim.api.nvim_create_autocmd({ "VimEnter" }, { - callback = function() - -- A dumb way to clear annoying NeoVim startup screen - vim.cmd("normal ia") - vim.cmd("normal u") - end, -}) diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua b/modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua index 1b2cc36..11b947f 100644 --- a/modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua +++ b/modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua @@ -30,15 +30,14 @@ local plugins = { }, { "nvim-tree/nvim-tree.lua", - lazy = false, dependencies = { { "nvim-tree/nvim-web-devicons", lazy = true } }, + event = "VeryLazy", config = function() require("nvim-tree").setup(require("plugins.nvim-tree")) end }, { "nvim-treesitter/nvim-treesitter", - lazy = false, event = "VeryLazy", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", @@ -51,16 +50,14 @@ local plugins = { }, { url = "https://gitlab.com/HiPhish/rainbow-delimiters.nvim", - lazy = false, - event = "VeryLazy", + event = "BufEnter", config = function() require("plugins.rainbow-delimiters") end }, { "lukas-reineke/indent-blankline.nvim", - lazy = false, - event = "VeryLazy", + event = "BufEnter", config = function() require("ibl").setup(require("plugins.indent-blankline")) end @@ -68,7 +65,7 @@ local plugins = { { "neovim/nvim-lspconfig", dependencies = { "hrsh7th/cmp-nvim-lsp" }, - lazy = false, + event = "BufEnter", config = function() require("plugins.lsp.lspconfig") require("plugins.lsp.others") @@ -129,7 +126,7 @@ local plugins = { }, { "L3MON4D3/LuaSnip", - lazy = false, + event = "BufEnter", dependencies = { { "rafamadriz/friendly-snippets", lazy = true } }, build = "make install_jsregexp", config = function() @@ -146,23 +143,21 @@ local plugins = { "hrsh7th/cmp-path", "onsails/lspkind.nvim" }, - lazy = false, + event = "BufEnter", config = function() require("cmp").setup(require("plugins.cmp.cmp")) end }, { "numToStr/Comment.nvim", - lazy = false, - event = "VeryLazy", + event = "BufEnter", config = function() require("Comment").setup(require("plugins.comment")) end }, { "windwp/nvim-autopairs", - lazy = false, - event = "VeryLazy", + event = "BufEnter", dependencies = { "hrsh7th/nvim-cmp" }, config = function() require("nvim-autopairs").setup(require("plugins.autopairs")) @@ -170,15 +165,13 @@ local plugins = { }, { "akinsho/bufferline.nvim", - lazy = false, config = function() require("bufferline").setup(require("plugins.bufferline")) end }, { "lewis6991/gitsigns.nvim", - lazy = false, - event = "VeryLazy", + event = "BufEnter", config = function() require("gitsigns").setup(require("plugins.gitsigns")) end @@ -193,23 +186,13 @@ local plugins = { }, { "alexghergh/nvim-tmux-navigation", - lazy = false, event = "VeryLazy", config = function() require("nvim-tmux-navigation").setup(require("plugins.tmuxnav")) end }, - { - "natecraddock/sessions.nvim", - lazy = false, - event = "VeryLazy", - config = function() - require("sessions").setup(require("plugins.sessions")) - end - }, { "natecraddock/workspaces.nvim", - lazy = false, event = "VeryLazy", dependencies = { "nvim-telescope/telescope.nvim", "natecraddock/sessions.nvim" }, config = function() @@ -237,13 +220,12 @@ local plugins = { end }, ]] { - "lukas-reineke/headlines.nvim", - dependencies = "nvim-treesitter/nvim-treesitter", - config = true, -- or `opts = {}` + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + opts = {}, }, { "folke/noice.nvim", - lazy = false, event = "VeryLazy", dependencies = { "MunifTanjim/nui.nvim", @@ -259,7 +241,6 @@ local plugins = { }, { "voldikss/vim-floaterm", - lazy = false, event = "VeryLazy", config = function() require("plugins.floaterm") @@ -267,8 +248,7 @@ local plugins = { }, { "folke/todo-comments.nvim", - lazy = false, - event = "VeryLazy", + event = "BufEnter", opts = {}, }, { @@ -288,7 +268,7 @@ local plugins = { }, { "pest-parser/pest.vim", - event = "VeryLazy", + ft = "pest", opts = {} } } diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/sessions.lua b/modules/coding/editor/neovim/nvim/lua/plugins/sessions.lua deleted file mode 100644 index 356b30e..0000000 --- a/modules/coding/editor/neovim/nvim/lua/plugins/sessions.lua +++ /dev/null @@ -1,10 +0,0 @@ -M = { - events = { "VimLeavePre" }, - indent = { - tab_char = "▏" - }, - session_filepath = vim.fn.stdpath("data") .. "/session", -} - -return M -