Compare commits

..

2 Commits

Author SHA1 Message Date
832733f931 feat(nvim): use mini.nvim & neo-tree 2026-02-07 12:00:30 +08:00
a1d873cc30 feat(nvim): use blink.cmp 2026-02-07 11:03:28 +08:00
13 changed files with 147 additions and 227 deletions

View File

@@ -17,24 +17,4 @@ vim.lsp.config("nixd", {
}, },
}) })
return { return {}
{
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
opts.sources = opts.sources or {}
table.insert(opts.sources, {
name = "lazydev",
group_index = 0,
})
end,
},
}

View File

@@ -1,44 +1,42 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" }, "LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
"blink.cmp": { "branch": "main", "commit": "f9e855c4d96e1264f7c818844f5a0166ad48c212" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "gitsigns.nvim": { "branch": "main", "commit": "1ce96a464fdbc24208e24c117e2021794259005d" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "abf82a65f185bd54adc0679f74b7d6e1ada690c9" },
"glance.nvim": { "branch": "master", "commit": "bf86d8b79dce808e65fdb6e9269d0b4ed6d2eefc" }, "glance.nvim": { "branch": "master", "commit": "bf86d8b79dce808e65fdb6e9269d0b4ed6d2eefc" },
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"inlay-hints.nvim": { "branch": "master", "commit": "12c48937702906f67dfbd7f64b1c0d8861635506" }, "inlay-hints.nvim": { "branch": "master", "commit": "11be32be3761c6263df2311afb6baa0de0863967" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"leap.nvim": { "branch": "main", "commit": "f19d43590c4b6d31188ee1ea2954d2b7558a9e11" }, "leap.nvim": { "branch": "main", "commit": "d7316deae68dc93d6957020cdda6d7bb399218fb" },
"lspkind.nvim": { "branch": "master", "commit": "dbac5149fb5fb1b642266ff268b1e0f4ebac9293" }, "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" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lspconfig": { "branch": "master", "commit": "419b082102fa813739588dd82e19a8b6b2442855" }, "nvim-lspconfig": { "branch": "master", "commit": "66fd02ad1c7ea31616d3ca678fa04e6d0b360824" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" }, "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" },
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
"nvim-tree.lua": { "branch": "master", "commit": "5757bcf0447d22d8f78826bc5c59b28da2824c3b" }, "nvim-tree.lua": { "branch": "master", "commit": "037d89e60fb01a6c11a48a19540253b8c72a3c32" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
"outline.nvim": { "branch": "main", "commit": "1967ef50036b0b1eac4977aeede55915a741afe0" }, "outline.nvim": { "branch": "main", "commit": "ead1820d49c8e79ce89cab1c2c318981b695c9d2" },
"pest.vim": { "branch": "master", "commit": "7cfcb43f824e74d13dfe631359fff2ec23836a77" }, "pest.vim": { "branch": "master", "commit": "7cfcb43f824e74d13dfe631359fff2ec23836a77" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "d6b802552cbe7d643a3b6b31f419c248d1f1e220" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "d6b802552cbe7d643a3b6b31f419c248d1f1e220" },
"render-markdown.nvim": { "branch": "main", "commit": "c54380dd4d8d1738b9691a7c349ecad7967ac12e" }, "render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" },
"ripgrep": { "branch": "master", "commit": "0a88cccd5188074de96f54a4b6b44a63971ac157" }, "ripgrep": { "branch": "master", "commit": "0a88cccd5188074de96f54a4b6b44a63971ac157" },
"telescope.nvim": { "branch": "master", "commit": "0d8b6eaa0b5ae6bb3d9785f7a3ba4a4c6c1b1af2" }, "telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
"tree-sitter-nu": { "branch": "main", "commit": "4c149627cc592560f77ead1c384e27ec85926407" }, "tree-sitter-nu": { "branch": "main", "commit": "bb3f533e5792260291945e1f329e1f0a779def6e" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"vim-floaterm": { "branch": "master", "commit": "a11b930f55324e9b05e2ef16511fe713f1b456a7" }, "vim-floaterm": { "branch": "master", "commit": "a11b930f55324e9b05e2ef16511fe713f1b456a7" },
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" } "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }

View File

@@ -1,25 +0,0 @@
M = {
check_ts = true,
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
},
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = [=[[%'%"%)%>%]%)%}%,]]=],
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "Search",
highlight_grey = "Comment",
},
}
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local ok, cmp = pcall(require, "cmp")
if ok then
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
end
return M

View File

@@ -1,5 +1,6 @@
local buf_kill = require("core.globals").buf_kill local buf_kill = require("core.globals").buf_kill
--- @type bufferline.UserConfig
M = { M = {
highlights = { highlights = {
buffer_selected = { buffer_selected = {
@@ -10,7 +11,7 @@ M = {
diagnostics = "nvim_lsp", diagnostics = "nvim_lsp",
offsets = { offsets = {
{ {
filetype = "NvimTree", filetype = "neo-tree",
text = "File Explorer", text = "File Explorer",
highlight = "Directory", highlight = "Directory",
text_align = "center", text_align = "center",

View File

@@ -1,64 +1,32 @@
local cmp = require("cmp") --- @type blink.cmp.Config
M = { M = {
window = { keymap = {
-- <Tab> to accept
preset = "super-tab",
},
appearance = {
nerd_font_variant = "mono",
},
completion = { completion = {
border = "rounded", -- By default, you may press `<c-space>` to show the documentation.
scrollbar = "", -- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = true, auto_show_delay_ms = 1000 },
}, },
documentation = { sources = {
border = "rounded", default = { "lsp", "path", "snippets", "lazydev" },
scrollbar = "", providers = {
lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
}, },
}, },
formatting = { snippets = { preset = "luasnip" },
format = require("lspkind").cmp_format({
mode = "symbol", -- See :h blink-cmp-config-fuzzy for more information
maxwidth = 50, fuzzy = {
ellipsis_char = "...", implementation = "lua",
}),
}, },
snippet = {
expand = function(args) -- Shows a signature help window while you type arguments for a function
require("luasnip").lsp_expand(args.body) signature = { enabled = true },
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<Escape>"] = cmp.mapping.abort(),
["<Tab>"] = cmp.mapping.confirm({ select = true }),
["<Up>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, {
"i",
"s",
}),
["<Down>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, {
"i",
"s",
}),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
}, {
{ name = "buffer" },
}),
} }
vim.o.wildmenu = true
vim.o.pumheight = 10
return M return M

View File

@@ -1,3 +1,4 @@
--- @type ibl.config
M = { M = {
enabled = true, enabled = true,
indent = { indent = {

View File

@@ -1,3 +0,0 @@
M = {}
return M

View File

@@ -85,12 +85,15 @@ local servers = {
-- keep-sorted end -- keep-sorted end
} }
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = {
capabilities = vim.lsp.protocol.make_client_capabilities() textDocument = {
capabilities.textDocument.foldingRange = { foldingRange = {
dynamicRegistration = false, dynamicRegistration = false,
lineFoldingOnly = true, lineFoldingOnly = true,
},
},
} }
capabilities = require("blink.cmp").get_lsp_capabilities(capabilities)
for server, config in pairs(servers) do for server, config in pairs(servers) do
config["capabilities"] = capabilities config["capabilities"] = capabilities
vim.lsp.config(server, config) vim.lsp.config(server, config)

View File

@@ -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

View File

@@ -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", "<leader>e", ":NvimTreeToggle<CR>", opt)
vim.keymap.set("n", "<leader>te", ":NvimTreeFocus<CR>", 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

View File

@@ -21,20 +21,72 @@ local plugins = {
end, end,
}, },
{ {
"nvim-lualine/lualine.nvim", 'echasnovski/mini.nvim',
lazy = false,
dependencies = { { "nvim-tree/nvim-web-devicons", lazy = true } },
config = function() 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, end,
}, },
{ {
"nvim-tree/nvim-tree.lua", 'nvim-neo-tree/neo-tree.nvim',
dependencies = { { "nvim-tree/nvim-web-devicons", lazy = true } }, version = '*',
lazy = false, dependencies = {
config = function() 'nvim-lua/plenary.nvim',
require("nvim-tree").setup(require("plugins.nvim-tree")) 'nvim-tree/nvim-web-devicons',
end, 'MunifTanjim/nui.nvim',
},
cmd = 'Neotree',
keys = {
{ '\\', ':Neotree reveal toggle<CR>', desc = 'Toggle NeoTree', silent = true },
{ '<leader>e', ':Neotree reveal toggle<CR>', 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',
["<leader>e"] = "close_window",
["<c-]>"] = "set_root",
},
},
},
},
}, },
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
@@ -69,7 +121,7 @@ local plugins = {
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { "hrsh7th/cmp-nvim-lsp" }, dependencies = { "saghen/blink.cmp" },
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
require("plugins.lsp.lspconfig") require("plugins.lsp.lspconfig")
@@ -117,7 +169,10 @@ local plugins = {
{ {
"MysticalDevil/inlay-hints.nvim", "MysticalDevil/inlay-hints.nvim",
event = "LspAttach", event = "LspAttach",
dependencies = { "neovim/nvim-lspconfig" }, dependencies = {
"neovim/nvim-lspconfig",
"onsails/lspkind.nvim",
},
opts = {}, opts = {},
}, },
{ {
@@ -127,6 +182,11 @@ local plugins = {
require("outline").setup(require("plugins.lsp.outline")) require("outline").setup(require("plugins.lsp.outline"))
end, end,
}, },
{
"saghen/blink.cmp",
event = "VeryLazy",
build = "cargo build --release",
dependencies = {
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
event = "InsertEnter", event = "InsertEnter",
@@ -137,18 +197,17 @@ local plugins = {
end, end,
}, },
{ {
"hrsh7th/nvim-cmp", "folke/lazydev.nvim",
dependencies = { ft = "lua",
"hrsh7th/cmp-nvim-lsp", opts = {
"L3MON4D3/LuaSnip", library = {
"saadparwaiz1/cmp_luasnip", { path = "${3rd}/luv/library", words = { "vim%.uv" } },
"rafamadriz/friendly-snippets", },
"hrsh7th/cmp-path", },
"onsails/lspkind.nvim", },
}, },
event = "InsertEnter",
config = function() config = function()
require("cmp").setup(require("plugins.cmp.cmp")) require("blink.cmp").setup(require("plugins.cmp.cmp"))
end, end,
}, },
{ {
@@ -159,10 +218,7 @@ local plugins = {
{ {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
event = "InsertEnter", event = "InsertEnter",
dependencies = { "hrsh7th/nvim-cmp" }, opts = {},
config = function()
require("nvim-autopairs").setup(require("plugins.autopairs"))
end,
}, },
{ {
"akinsho/bufferline.nvim", "akinsho/bufferline.nvim",
@@ -207,7 +263,7 @@ local plugins = {
}, },
}, },
{ {
"ggandor/leap.nvim", "https://codeberg.org/andyg/leap.nvim",
dependencies = { "tpope/vim-repeat" }, dependencies = { "tpope/vim-repeat" },
config = function() config = function()
vim.keymap.set({ "n", "x", "o" }, "s", "<Plug>(leap)") vim.keymap.set({ "n", "x", "o" }, "s", "<Plug>(leap)")

View File

@@ -1,4 +1,5 @@
local rainbow_delimiters = require("rainbow-delimiters") local rainbow_delimiters = require("rainbow-delimiters")
--- @type rainbow_delimiters.config
vim.g.rainbow_delimiters = { vim.g.rainbow_delimiters = {
strategy = { strategy = {
[""] = rainbow_delimiters.strategy["global"], [""] = rainbow_delimiters.strategy["global"],

View File

@@ -1,9 +1,11 @@
--- @type TSConfig
M = { M = {
auto_install = true, auto_install = true,
parser_install_dir = "$HOME/.local/share/nvim/lazy/nvim-treesitter", parser_install_dir = "$HOME/.local/share/nvim/lazy/nvim-treesitter",
sync_install = true, sync_install = true,
modules = {}, modules = {},
ignore_install = {}, ignore_install = {},
ensure_installed = {},
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },