update: nvim

This commit is contained in:
wyj
2025-03-24 20:37:02 -04:00
parent ac8f51e7cf
commit cc1870ecd2
47 changed files with 880 additions and 751 deletions
@@ -1,80 +0,0 @@
return function()
require("modules.utils").load_plugin("aerial", {
lazy_load = false,
close_on_select = true,
highlight_on_jump = false,
disable_max_lines = 8500,
disable_max_size = 1000000,
ignore = { filetypes = { "NvimTree", "terminal", "nofile" } },
-- Use symbol tree for folding. Set to true or false to enable/disable
-- Set to "auto" to manage folds if your previous foldmethod was 'manual'
-- This can be a filetype map (see :help aerial-filetype-map)
manage_folds = "auto",
layout = {
-- Determines the default direction to open the aerial window. The 'prefer'
-- options will open the window in the other direction *if* there is a
-- different buffer in the way of the preferred direction
-- Enum: prefer_right, prefer_left, right, left, float
default_direction = "prefer_right",
},
-- Keymaps in aerial window. Can be any value that `vim.keymap.set` accepts OR a table of keymap
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
-- Additionally, if it is a string that matches "actions.<name>",
-- it will use the mapping at require("aerial.actions").<name>
-- Set to `false` to remove a keymap
keymaps = {
["?"] = "actions.show_help",
["g?"] = "actions.show_help",
["<CR>"] = "actions.jump",
["<2-LeftMouse>"] = "actions.jump",
["<C-v>"] = "actions.jump_vsplit",
["<C-s>"] = "actions.jump_split",
["<C-d>"] = "actions.down_and_scroll",
["<C-u>"] = "actions.up_and_scroll",
["{"] = "actions.prev",
["}"] = "actions.next",
["[["] = "actions.prev_up",
["]]"] = "actions.next_up",
["q"] = "actions.close",
["o"] = "actions.tree_toggle",
["O"] = "actions.tree_toggle_recursive",
["zr"] = "actions.tree_increase_fold_level",
["zR"] = "actions.tree_open_all",
["zm"] = "actions.tree_decrease_fold_level",
["zM"] = "actions.tree_close_all",
["zx"] = "actions.tree_sync_folds",
["zX"] = "actions.tree_sync_folds",
},
-- A list of all symbols to display. Set to false to display all symbols.
-- This can be a filetype map (see :help aerial-filetype-map)
-- To see all available values, see :help SymbolKind
filter_kind = {
"Array",
"Boolean",
"Class",
"Constant",
"Constructor",
"Enum",
"EnumMember",
"Event",
"Field",
"File",
"Function",
"Interface",
"Key",
"Method",
"Module",
"Namespace",
"Null",
-- "Number",
"Object",
"Operator",
"Package",
-- "Property",
-- "String",
"Struct",
-- "TypeParameter",
-- "Variable",
},
})
end
@@ -8,6 +8,13 @@ local format_modifications_only = settings.format_modifications_only
local server_formatting_block_list = settings.server_formatting_block_list
local format_timeout = settings.format_timeout
vim.api.nvim_create_user_command("Format", function()
M.format({
timeout = format_timeout,
filter = M.format_filter,
})
end, {})
vim.api.nvim_create_user_command("FormatToggle", function()
M.toggle_format_on_save()
end, {})
@@ -118,7 +125,7 @@ function M.format(opts)
end
local bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ buffer = bufnr })
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if opts.filter then
clients = opts.filter(clients)
@@ -1,14 +1,20 @@
return function()
local snippet_path = vim.fn.stdpath("config") .. "/snips/"
if not vim.tbl_contains(vim.opt.rtp:get(), snippet_path) then
vim.opt.rtp:append(snippet_path)
end
local vim_path = require("core.global").vim_path
local snippet_path = vim_path .. "/snips/"
local user_snippet_path = vim_path .. "/lua/user/snips/"
require("modules.utils").load_plugin("luasnip", {
history = true,
update_events = "TextChanged,TextChangedI",
delete_check_events = "TextChanged,InsertLeave",
}, false, require("luasnip").config.set_config)
require("luasnip.loaders.from_vscode").lazy_load({
paths = {
snippet_path,
user_snippet_path,
},
})
require("luasnip.loaders.from_lua").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()
@@ -52,10 +52,12 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
end
local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name)
local default_ok, default_handler = pcall(require, "completion.servers." .. lsp_name)
-- Use preset if there is no user definition
if not ok then
ok, custom_handler = pcall(require, "completion.servers." .. lsp_name)
ok, custom_handler = default_ok, default_handler
end
if not ok then
-- Default to use factory config for server(s) that doesn't include a spec
nvim_lsp[lsp_name].setup(opts)
@@ -66,7 +68,14 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
--- See `clangd.lua` for example.
custom_handler(opts)
elseif type(custom_handler) == "table" then
nvim_lsp[lsp_name].setup(vim.tbl_deep_extend("force", opts, custom_handler))
nvim_lsp[lsp_name].setup(
vim.tbl_deep_extend(
"force",
opts,
type(default_handler) == "table" and default_handler or {},
custom_handler
)
)
else
vim.notify(
string.format(
@@ -83,7 +83,9 @@ M.setup = function()
)
end,
on_stderr = function(_, msg_stream)
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
if msg_stream then
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
end
end,
})
:start()
@@ -17,7 +17,7 @@ return function()
-- Don't specify any config here if you are using the default one.
local sources = {
btns.formatting.clang_format.with({
filetypes = { "c", "cpp", "objc", "objcpp", "cs", "java", "cuda", "proto" },
filetypes = { "c", "cpp", "objc", "objcpp", "cs", "cuda", "proto" },
extra_args = formatter_args("clang_format"),
}),
btns.formatting.prettier.with({
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/bashls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/bashls.lua
return {
cmd = { "bash-language-server", "start" },
filetypes = { "bash", "sh" },
@@ -33,7 +33,7 @@ local function get_binary_path_list(binaries)
return table.concat(path_list, ",")
end
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/clangd.lua
return function(options)
require("lspconfig").clangd.setup({
on_attach = options.on_attach,
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/dartls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/dartls.lua
return {
cmd = { "dart", "language-server", "--protocol=lsp" },
filetypes = { "dart" },
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/gopls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/gopls.lua
return {
cmd = { "gopls", "-remote.debug=:0", "-remote=auto" },
filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" },
@@ -31,11 +31,11 @@ return {
gopls = {
staticcheck = true,
semanticTokens = true,
noSemanticString = true,
usePlaceholders = true,
completeUnimported = true,
symbolMatcher = "Fuzzy",
buildFlags = { "-tags", "integration" },
semanticTokenTypes = { string = false },
codelenses = {
generate = true,
gc_details = true,
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jsonls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/jsonls.lua
return {
flags = { debounce_text_changes = 500 },
settings = {
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/lua_ls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/lua_ls.lua
return {
settings = {
Lua = {
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/pylsp.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/pylsp.lua
return {
cmd = { "pylsp" },
filetypes = { "python" },