From 832733f931f4dc42bf5a579e19a23ff778e27298 Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Sat, 7 Feb 2026 11:45:59 +0800 Subject: [PATCH] feat(nvim): use mini.nvim & neo-tree --- .../coding/editor/neovim/nvim/lazy-lock.json | 3 +- .../neovim/nvim/lua/plugins/bufferline.lua | 3 +- .../neovim/nvim/lua/plugins/cmp/cmp.lua | 1 - .../nvim/lua/plugins/indent-blankline.lua | 1 + .../neovim/nvim/lua/plugins/lualine.lua | 30 -------- .../neovim/nvim/lua/plugins/nvim-tree.lua | 32 --------- .../neovim/nvim/lua/plugins/plugins-setup.lua | 72 ++++++++++++++++--- .../nvim/lua/plugins/rainbow-delimiters.lua | 1 + .../neovim/nvim/lua/plugins/treesitter.lua | 2 + 9 files changed, 70 insertions(+), 75 deletions(-) delete mode 100644 modules/coding/editor/neovim/nvim/lua/plugins/lualine.lua delete mode 100644 modules/coding/editor/neovim/nvim/lua/plugins/nvim-tree.lua diff --git a/modules/coding/editor/neovim/nvim/lazy-lock.json b/modules/coding/editor/neovim/nvim/lazy-lock.json index af63929..e6baf46 100644 --- a/modules/coding/editor/neovim/nvim/lazy-lock.json +++ b/modules/coding/editor/neovim/nvim/lazy-lock.json @@ -13,7 +13,8 @@ "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, "leap.nvim": { "branch": "main", "commit": "d7316deae68dc93d6957020cdda6d7bb399218fb" }, "lspkind.nvim": { "branch": "master", "commit": "c7274c48137396526b59d86232eabcdc7fed8a32" }, - "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "mini.nvim": { "branch": "main", "commit": "8c40d95931cbe6138391af9180e59439ed2e69df" }, + "neo-tree.nvim": { "branch": "main", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/bufferline.lua b/modules/coding/editor/neovim/nvim/lua/plugins/bufferline.lua index 7b9e97b..e7e4491 100644 --- a/modules/coding/editor/neovim/nvim/lua/plugins/bufferline.lua +++ b/modules/coding/editor/neovim/nvim/lua/plugins/bufferline.lua @@ -1,5 +1,6 @@ local buf_kill = require("core.globals").buf_kill +--- @type bufferline.UserConfig M = { highlights = { buffer_selected = { @@ -10,7 +11,7 @@ M = { diagnostics = "nvim_lsp", offsets = { { - filetype = "NvimTree", + filetype = "neo-tree", text = "File Explorer", highlight = "Directory", text_align = "center", diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/cmp/cmp.lua b/modules/coding/editor/neovim/nvim/lua/plugins/cmp/cmp.lua index b559b85..a71883b 100644 --- a/modules/coding/editor/neovim/nvim/lua/plugins/cmp/cmp.lua +++ b/modules/coding/editor/neovim/nvim/lua/plugins/cmp/cmp.lua @@ -1,4 +1,3 @@ ---- @module "blink.cmp" --- @type blink.cmp.Config M = { keymap = { diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/indent-blankline.lua b/modules/coding/editor/neovim/nvim/lua/plugins/indent-blankline.lua index 11efc03..44d80a8 100644 --- a/modules/coding/editor/neovim/nvim/lua/plugins/indent-blankline.lua +++ b/modules/coding/editor/neovim/nvim/lua/plugins/indent-blankline.lua @@ -1,3 +1,4 @@ +--- @type ibl.config M = { enabled = true, indent = { diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/lualine.lua b/modules/coding/editor/neovim/nvim/lua/plugins/lualine.lua deleted file mode 100644 index f632ade..0000000 --- a/modules/coding/editor/neovim/nvim/lua/plugins/lualine.lua +++ /dev/null @@ -1,30 +0,0 @@ -M = { - options = { - theme = "tokyonight", - }, - sections = { - lualine_y = { - "encoding", - "fileformat", - "filetype", - }, - lualine_x = { - { - require("noice").api.status.message.get_hl, - cond = require("noice").api.status.message.has, - }, - { - require("noice").api.status.command.get, - cond = require("noice").api.status.command.has, - color = { fg = "#ff9e64" }, - }, - { - require("noice").api.status.search.get, - cond = require("noice").api.status.search.has, - color = { fg = "#ff9e64" }, - }, - }, - }, -} - -return M diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/nvim-tree.lua b/modules/coding/editor/neovim/nvim/lua/plugins/nvim-tree.lua deleted file mode 100644 index 6d35348..0000000 --- a/modules/coding/editor/neovim/nvim/lua/plugins/nvim-tree.lua +++ /dev/null @@ -1,32 +0,0 @@ -M = { - sync_root_with_cwd = true, - diagnostics = { - enable = false, - debounce_delay = 50, - show_on_dirs = true, - }, - filters = { - git_ignored = false, - }, -} - -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 - -local opt = require("core.globals").keymap_opt -vim.keymap.set("n", "e", ":NvimTreeToggle", opt) -vim.keymap.set("n", "te", ":NvimTreeFocus", opt) - -vim.api.nvim_create_autocmd("BufEnter", { - group = vim.api.nvim_create_augroup("NvimTreeCloseOnLast", { clear = true }), - pattern = "NvimTree*", - callback = function() - if vim.api.nvim_call_function("winlayout", {})[1] == "leaf" and vim.bo.filetype == "NvimTree" then - vim.defer_fn(function() - vim.cmd("NvimTreeClose") - end, 10) - end - end, -}) - -return M 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 2e2280e..4fcce32 100644 --- a/modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua +++ b/modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua @@ -21,20 +21,72 @@ local plugins = { end, }, { - "nvim-lualine/lualine.nvim", - lazy = false, - dependencies = { { "nvim-tree/nvim-web-devicons", lazy = true } }, + 'echasnovski/mini.nvim', config = function() - require("lualine").setup(require("plugins.lualine")) + -- Simple and easy statusline. + -- You could remove this setup call if you don't like it, + -- and try some other statusline plugin + local statusline = require 'mini.statusline' + -- set use_icons to true if you have a Nerd Font + statusline.setup { use_icons = vim.g.have_nerd_font } + + -- You can configure sections in the statusline by overriding their + -- default behavior. For example, here we set the section for + -- cursor location to LINE:COLUMN + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + -- ... and there is more! + -- Check out: https://github.com/echasnovski/mini.nvim end, }, { - "nvim-tree/nvim-tree.lua", - dependencies = { { "nvim-tree/nvim-web-devicons", lazy = true } }, - lazy = false, - config = function() - require("nvim-tree").setup(require("plugins.nvim-tree")) - end, + 'nvim-neo-tree/neo-tree.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'MunifTanjim/nui.nvim', + }, + cmd = 'Neotree', + keys = { + { '\\', ':Neotree reveal toggle', desc = 'Toggle NeoTree', silent = true }, + { 'e', ':Neotree reveal toggle', desc = 'Toggle NeoTree', silent = true }, + }, + --- @type neotree.Config + opts = { + close_if_last_window = true, + filesystem = { + filtered_items = { + hide_dotfiles = false, + }, + window = { + width = 30, + mappings = { + ['\\'] = 'close_window', + ["e"] = "close_window", + [""] = "set_root", + }, + }, + }, + }, }, { "nvim-treesitter/nvim-treesitter", diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/rainbow-delimiters.lua b/modules/coding/editor/neovim/nvim/lua/plugins/rainbow-delimiters.lua index 5d07753..0d8a4c2 100644 --- a/modules/coding/editor/neovim/nvim/lua/plugins/rainbow-delimiters.lua +++ b/modules/coding/editor/neovim/nvim/lua/plugins/rainbow-delimiters.lua @@ -1,4 +1,5 @@ local rainbow_delimiters = require("rainbow-delimiters") +--- @type rainbow_delimiters.config vim.g.rainbow_delimiters = { strategy = { [""] = rainbow_delimiters.strategy["global"], diff --git a/modules/coding/editor/neovim/nvim/lua/plugins/treesitter.lua b/modules/coding/editor/neovim/nvim/lua/plugins/treesitter.lua index 678a295..67ca241 100644 --- a/modules/coding/editor/neovim/nvim/lua/plugins/treesitter.lua +++ b/modules/coding/editor/neovim/nvim/lua/plugins/treesitter.lua @@ -1,9 +1,11 @@ +--- @type TSConfig M = { auto_install = true, parser_install_dir = "$HOME/.local/share/nvim/lazy/nvim-treesitter", sync_install = true, modules = {}, ignore_install = {}, + ensure_installed = {}, highlight = { enable = true }, indent = { enable = true },