update: nvim
This commit is contained in:
@@ -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" },
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
return function()
|
||||
require("mini.cursorword").setup({
|
||||
-- Delay (in ms) between when cursor moved and when highlighting appeared
|
||||
delay = 200,
|
||||
})
|
||||
require("modules.utils").gen_cursorword_hl()
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
return function()
|
||||
vim.g.maplocalleader = ","
|
||||
require("modules.utils").load_plugin("grug-far", {
|
||||
engine = "ripgrep",
|
||||
engines = {
|
||||
ripgrep = {
|
||||
path = "rg",
|
||||
showReplaceDiff = true,
|
||||
placeholders = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
windowCreationCommand = "bot split",
|
||||
disableBufferLineNumbers = false,
|
||||
icons = {
|
||||
enabled = true,
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("local-highlight", {
|
||||
hlgroup = "IlluminatedWordText",
|
||||
insert_mode = false,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
return function()
|
||||
vim.g.matchup_transmute_enabled = 1
|
||||
vim.g.matchup_surround_enabled = 1
|
||||
vim.g.matchup_matchparen_offscreen = { method = "popup" }
|
||||
end
|
||||
@@ -10,7 +10,6 @@ return function()
|
||||
require("modules.utils").load_plugin("crates", {
|
||||
smart_insert = true,
|
||||
insert_closing_quote = true,
|
||||
avoid_prerelease = true,
|
||||
autoload = true,
|
||||
autoupdate = true,
|
||||
autoupdate_throttle = 250,
|
||||
@@ -19,7 +18,6 @@ return function()
|
||||
thousands_separator = ",",
|
||||
notification_title = "Crates",
|
||||
curl_args = { "-sL", "--retry", "1" },
|
||||
disable_invalid_feature_diagnostic = false,
|
||||
text = {
|
||||
loading = " " .. icons.misc.Watch .. "Loading",
|
||||
version = " " .. icons.ui.Check .. "%s",
|
||||
|
||||
@@ -5,20 +5,43 @@ return function()
|
||||
misc = require("modules.utils.icons").get("misc", true),
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
}
|
||||
local utils = require("dropbar.utils")
|
||||
local sources = require("dropbar.sources")
|
||||
-- Custom source to display only the leaf filename in the dropbar
|
||||
sources.symbols = {
|
||||
get_symbols = function(buf, win, cursor)
|
||||
local symbols = sources.path.get_symbols(buf, win, cursor)
|
||||
return { symbols[#symbols] }
|
||||
end,
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("dropbar", {
|
||||
bar = {
|
||||
hover = false,
|
||||
truncate = true,
|
||||
pick = { pivots = "etovxqpdygfblzhckisuran" },
|
||||
sources = function(buf)
|
||||
if vim.bo[buf].ft == "markdown" then
|
||||
return {
|
||||
sources.symbols,
|
||||
sources.markdown,
|
||||
}
|
||||
end
|
||||
if vim.bo[buf].buftype == "terminal" then
|
||||
return {
|
||||
sources.terminal,
|
||||
}
|
||||
end
|
||||
return {
|
||||
sources.symbols,
|
||||
utils.source.fallback({
|
||||
sources.lsp,
|
||||
sources.treesitter,
|
||||
}),
|
||||
}
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
path = {
|
||||
relative_to = function()
|
||||
-- Only show the leaf filename in dropbar
|
||||
return vim.fn.expand("%:p:h")
|
||||
end,
|
||||
},
|
||||
terminal = {
|
||||
name = function(buf)
|
||||
local name = vim.api.nvim_buf_get_name(buf)
|
||||
@@ -35,7 +58,6 @@ return function()
|
||||
icons = {
|
||||
enable = true,
|
||||
kinds = {
|
||||
use_devicons = true,
|
||||
symbols = {
|
||||
-- Type
|
||||
Array = icons.type.Array,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
return function()
|
||||
local builtin = require("telescope.builtin")
|
||||
local extensions = require("telescope").extensions
|
||||
local vim_path = require("core.global").vim_path
|
||||
|
||||
require("modules.utils").load_plugin("search", {
|
||||
collections = {
|
||||
@@ -12,7 +13,9 @@ return function()
|
||||
name = "Files",
|
||||
tele_func = function(opts)
|
||||
opts = opts or {}
|
||||
if vim.fn.isdirectory(".git") == 1 then
|
||||
if vim.fn.getcwd() == vim_path then
|
||||
builtin.find_files(vim.tbl_deep_extend("force", opts, { no_ignore = true }))
|
||||
elseif vim.fn.isdirectory(".git") == 1 then
|
||||
builtin.git_files(opts)
|
||||
else
|
||||
builtin.find_files(opts)
|
||||
@@ -46,13 +49,20 @@ return function()
|
||||
{
|
||||
name = "Word in project",
|
||||
tele_func = function()
|
||||
extensions.live_grep_args.live_grep_args()
|
||||
local opts = {}
|
||||
if vim.fn.getcwd() == vim_path then
|
||||
opts["additional_args"] = { "--no-ignore" }
|
||||
end
|
||||
extensions.live_grep_args.live_grep_args(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Word under cursor",
|
||||
tele_func = function(opts)
|
||||
opts = opts or {}
|
||||
if vim.fn.getcwd() == vim_path then
|
||||
opts["additional_args"] = { "--no-ignore" }
|
||||
end
|
||||
builtin.grep_string(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
@@ -44,13 +44,6 @@ return function()
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
},
|
||||
extensions = {
|
||||
aerial = {
|
||||
show_lines = false,
|
||||
show_nesting = {
|
||||
["_"] = false, -- This key will be the default
|
||||
lua = true, -- You can set the option for specific filetypes
|
||||
},
|
||||
},
|
||||
fzf = {
|
||||
fuzzy = false,
|
||||
override_generic_sorter = true,
|
||||
@@ -97,6 +90,5 @@ return function()
|
||||
require("telescope").load_extension("undo")
|
||||
require("telescope").load_extension("zoxide")
|
||||
require("telescope").load_extension("persisted")
|
||||
require("telescope").load_extension("aerial")
|
||||
require("telescope").load_extension("advanced_git_search")
|
||||
end
|
||||
|
||||
@@ -8,21 +8,11 @@ return function()
|
||||
return vim.o.columns * 0.40
|
||||
end
|
||||
end,
|
||||
on_open = function(term)
|
||||
on_open = function()
|
||||
-- Prevent infinite calls from freezing neovim.
|
||||
-- Only set these options specific to this terminal buffer.
|
||||
vim.api.nvim_set_option_value("foldmethod", "manual", { scope = "local" })
|
||||
vim.api.nvim_set_option_value("foldexpr", "0", { scope = "local" })
|
||||
|
||||
-- Prevent horizontal terminal from obscuring `nvim-tree`.
|
||||
local api = require("nvim-tree.api")
|
||||
local tree = require("nvim-tree.view")
|
||||
if tree.is_visible() and term.direction == "horizontal" then
|
||||
local width = vim.fn.winwidth(tree.get_winnr())
|
||||
api.tree.toggle()
|
||||
tree.View.width = width
|
||||
api.tree.toggle(false, true)
|
||||
end
|
||||
end,
|
||||
highlights = {
|
||||
Normal = {
|
||||
|
||||
@@ -34,8 +34,8 @@ return function()
|
||||
padding = 0,
|
||||
},
|
||||
{
|
||||
filetype = "aerial",
|
||||
text = "Symbol Outline",
|
||||
filetype = "trouble",
|
||||
text = "LSP Outline",
|
||||
text_align = "center",
|
||||
padding = 0,
|
||||
},
|
||||
|
||||
@@ -30,7 +30,23 @@ return function()
|
||||
properties = {},
|
||||
},
|
||||
integrations = {
|
||||
treesitter = true,
|
||||
cmp = true,
|
||||
dap = true,
|
||||
dap_ui = true,
|
||||
diffview = true,
|
||||
dropbar = { enabled = true, color_mode = true },
|
||||
fidget = true,
|
||||
flash = true,
|
||||
fzf = true,
|
||||
gitsigns = true,
|
||||
grug_far = true,
|
||||
hop = true,
|
||||
indent_blankline = { enabled = true, colored_indent_levels = true },
|
||||
lsp_saga = true,
|
||||
lsp_trouble = true,
|
||||
markdown = true,
|
||||
mason = true,
|
||||
mini = { enabled = true, indentscope_color = "" },
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
@@ -46,53 +62,14 @@ return function()
|
||||
information = { "underline" },
|
||||
},
|
||||
},
|
||||
aerial = true,
|
||||
alpha = false,
|
||||
barbar = false,
|
||||
beacon = false,
|
||||
cmp = true,
|
||||
coc_nvim = false,
|
||||
dap = true,
|
||||
dap_ui = true,
|
||||
dashboard = false,
|
||||
dropbar = { enabled = true, color_mode = true },
|
||||
fern = false,
|
||||
fidget = true,
|
||||
flash = true,
|
||||
gitgutter = false,
|
||||
gitsigns = true,
|
||||
harpoon = false,
|
||||
headlines = false,
|
||||
hop = true,
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true, colored_indent_levels = false },
|
||||
leap = false,
|
||||
lightspeed = false,
|
||||
lsp_saga = true,
|
||||
lsp_trouble = true,
|
||||
markdown = true,
|
||||
mason = true,
|
||||
mini = false,
|
||||
navic = { enabled = false },
|
||||
neogit = false,
|
||||
neotest = false,
|
||||
neotree = { enabled = false, show_root = true, transparent_panel = false },
|
||||
noice = false,
|
||||
notify = true,
|
||||
nvimtree = true,
|
||||
overseer = false,
|
||||
pounce = false,
|
||||
rainbow_delimiters = true,
|
||||
render_markdown = true,
|
||||
sandwich = false,
|
||||
semantic_tokens = true,
|
||||
symbols_outline = false,
|
||||
telekasten = false,
|
||||
telescope = { enabled = true, style = "nvchad" },
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
ts_rainbow = false,
|
||||
vim_sneak = false,
|
||||
vimwiki = false,
|
||||
which_key = true,
|
||||
},
|
||||
color_overrides = {},
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
return function()
|
||||
local trouble_filter = function(position)
|
||||
return function(_, win)
|
||||
return vim.w[win].trouble
|
||||
and vim.w[win].trouble.position == position
|
||||
and vim.w[win].trouble.type == "split"
|
||||
and vim.w[win].trouble.relative == "editor"
|
||||
and not vim.w[win].trouble_preview
|
||||
end
|
||||
end
|
||||
|
||||
require("modules.utils").load_plugin("edgy", {
|
||||
close_when_all_hidden = true,
|
||||
exit_when_last = true,
|
||||
wo = { winbar = false },
|
||||
keys = {
|
||||
["q"] = false,
|
||||
["Q"] = false,
|
||||
["<C-q>"] = false,
|
||||
["<A-j>"] = function(win)
|
||||
win:resize("height", -2)
|
||||
end,
|
||||
["<A-k>"] = function(win)
|
||||
win:resize("height", 2)
|
||||
end,
|
||||
["<A-h>"] = function(win)
|
||||
win:resize("width", -2)
|
||||
end,
|
||||
["<A-l>"] = function(win)
|
||||
win:resize("width", 2)
|
||||
end,
|
||||
},
|
||||
bottom = {
|
||||
{ ft = "qf", size = { height = 0.3 } },
|
||||
{
|
||||
ft = "toggleterm",
|
||||
size = { height = 0.3 },
|
||||
filter = function(_, win)
|
||||
return vim.w[win].relative == ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
ft = "help",
|
||||
size = { height = 0.3 },
|
||||
filter = function(buf)
|
||||
return vim.bo[buf].buftype == "help"
|
||||
end,
|
||||
},
|
||||
},
|
||||
left = {
|
||||
{
|
||||
ft = "NvimTree",
|
||||
pinned = true,
|
||||
open = "NvimTreeOpen",
|
||||
size = { width = 30 },
|
||||
},
|
||||
},
|
||||
right = {
|
||||
{
|
||||
ft = "trouble",
|
||||
pinned = true,
|
||||
size = { height = 0.6, width = 0.3 },
|
||||
open = "Trouble symbols toggle win.position=right",
|
||||
filter = trouble_filter("right"),
|
||||
},
|
||||
{
|
||||
ft = "trouble",
|
||||
pinned = true,
|
||||
collapsed = true,
|
||||
size = { height = 0.4, width = 0.3 },
|
||||
open = "Trouble lsp toggle win.position=right",
|
||||
filter = trouble_filter("right"),
|
||||
},
|
||||
},
|
||||
}, false, nil, true)
|
||||
end
|
||||
@@ -164,7 +164,7 @@ return function()
|
||||
lsp = {
|
||||
function()
|
||||
local buf_ft = vim.bo.filetype
|
||||
local clients = vim.lsp.get_clients({ buffer = vim.api.nvim_get_current_buf() })
|
||||
local clients = vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() })
|
||||
local lsp_lists = {}
|
||||
local available_servers = {}
|
||||
if next(clients) == nil then
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
return function()
|
||||
local blend_color = require("modules.utils").gen_neodim_blend_attr()
|
||||
|
||||
require("modules.utils").load_plugin("neodim", {
|
||||
alpha = 0.45,
|
||||
blend_color = blend_color,
|
||||
refresh_delay = 75, -- time in ms to wait after typing before refreshing diagnostics
|
||||
hide = {
|
||||
virtual_text = true,
|
||||
signs = false,
|
||||
underline = false,
|
||||
},
|
||||
priority = 80,
|
||||
disable = {
|
||||
"alpha",
|
||||
"bigfile",
|
||||
"checkhealth",
|
||||
"dap-repl",
|
||||
"diff",
|
||||
"fugitive",
|
||||
"fugitiveblame",
|
||||
"git",
|
||||
"gitcommit",
|
||||
"help",
|
||||
"log",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"qf",
|
||||
"TelescopePrompt",
|
||||
"text",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
"vimwiki",
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -21,11 +21,6 @@ completion["nvimdev/lspsaga.nvim"] = {
|
||||
config = require("completion.lspsaga"),
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
}
|
||||
completion["stevearc/aerial.nvim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
config = require("completion.aerial"),
|
||||
}
|
||||
completion["DNLHC/glance.nvim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
|
||||
@@ -55,17 +55,17 @@ editor["echasnovski/mini.align"] = {
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("editor.align"),
|
||||
}
|
||||
editor["echasnovski/mini.cursorword"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("editor.cursorword"),
|
||||
}
|
||||
editor["smoka7/hop.nvim"] = {
|
||||
lazy = true,
|
||||
version = "*",
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("editor.hop"),
|
||||
}
|
||||
editor["tzachar/local-highlight.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("editor.local-highlight"),
|
||||
}
|
||||
editor["brenoprata10/nvim-highlight-colors"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
@@ -84,32 +84,30 @@ editor["tpope/vim-sleuth"] = {
|
||||
lazy = true,
|
||||
event = { "BufNewFile", "BufReadPost", "BufFilePost" },
|
||||
}
|
||||
editor["nvim-pack/nvim-spectre"] = {
|
||||
editor["MagicDuck/grug-far.nvim"] = {
|
||||
lazy = true,
|
||||
cmd = "Spectre",
|
||||
cmd = "GrugFar",
|
||||
config = require("editor.grug-far"),
|
||||
}
|
||||
editor["mrjones2014/smart-splits.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHoldI", "CursorHold" },
|
||||
config = require("editor.splits"),
|
||||
}
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- :treesitter related plugins --
|
||||
----------------------------------------------------------------------
|
||||
editor["nvim-treesitter/nvim-treesitter"] = {
|
||||
lazy = true,
|
||||
build = function()
|
||||
if vim.fn.has("gui_running") == 1 then
|
||||
if #vim.api.nvim_list_uis() > 0 then
|
||||
vim.api.nvim_command([[TSUpdate]])
|
||||
end
|
||||
end,
|
||||
event = "BufReadPre",
|
||||
config = require("editor.treesitter"),
|
||||
dependencies = {
|
||||
{ "andymass/vim-matchup" },
|
||||
{ "mfussenegger/nvim-treehopper" },
|
||||
{ "nvim-treesitter/nvim-treesitter-textobjects" },
|
||||
{
|
||||
"andymass/vim-matchup",
|
||||
init = require("editor.matchup"),
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
config = require("editor.autotag"),
|
||||
|
||||
@@ -7,9 +7,14 @@ ui["goolord/alpha-nvim"] = {
|
||||
}
|
||||
ui["akinsho/bufferline.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
event = { "BufReadPre", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.bufferline"),
|
||||
}
|
||||
ui["folke/edgy.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPre", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.edgy"),
|
||||
}
|
||||
ui["Jint-lzxy/nvim"] = {
|
||||
lazy = false,
|
||||
branch = "refactor/syntax-highlighting",
|
||||
@@ -36,11 +41,6 @@ ui["nvim-lualine/lualine.nvim"] = {
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.lualine"),
|
||||
}
|
||||
ui["zbirenbaum/neodim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
config = require("ui.neodim"),
|
||||
}
|
||||
ui["karb94/neoscroll.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
@@ -56,6 +56,11 @@ ui["folke/paint.nvim"] = {
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("ui.paint"),
|
||||
}
|
||||
ui["mrjones2014/smart-splits.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHoldI", "CursorHold" },
|
||||
config = require("ui.splits"),
|
||||
}
|
||||
ui["folke/todo-comments.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
|
||||
@@ -57,7 +57,7 @@ local function init_palette()
|
||||
end
|
||||
|
||||
if not palette then
|
||||
palette = vim.g.colors_name:find("catppuccin") and require("catppuccin.palettes").get_palette()
|
||||
palette = (vim.g.colors_name or ""):find("catppuccin") and require("catppuccin.palettes").get_palette()
|
||||
or {
|
||||
rosewater = "#DC8A78",
|
||||
flamingo = "#DD7878",
|
||||
@@ -104,7 +104,7 @@ end
|
||||
-- NOTE: If the active colorscheme isn't `catppuccin`, this function won't overwrite existing definitions
|
||||
---Sets a global highlight group.
|
||||
---@param name string @Highlight group name, e.g. "ErrorMsg"
|
||||
---@param foreground string @The foreground color
|
||||
---@param foreground? string @The foreground color
|
||||
---@param background? string @The background color
|
||||
---@param italic? boolean
|
||||
local function set_global_hl(name, foreground, background, italic)
|
||||
@@ -133,6 +133,24 @@ function M.blend(foreground, background, alpha)
|
||||
return string.format("#%02x%02x%02x", blend_channel(1), blend_channel(2), blend_channel(3))
|
||||
end
|
||||
|
||||
---Darken a color by blending it with the background color.
|
||||
---@param hex string @The color in hex to darken
|
||||
---@param amount number @The amount to darken the color
|
||||
---@param bg string @The background color to blend with
|
||||
---@return string @The darkened color as a hex string
|
||||
function M.darken(hex, amount, bg)
|
||||
return M.blend(hex, bg or "#000000", math.abs(amount))
|
||||
end
|
||||
|
||||
---Lighten a color by blending it with the foreground color.
|
||||
---@param hex string @The color in hex to lighten
|
||||
---@param amount number @The amount to lighten the color
|
||||
---@param fg string @The foreground color to blend with
|
||||
---@return string @The lightened color as a hex string
|
||||
function M.lighten(hex, amount, fg)
|
||||
return M.blend(hex, fg or "#FFFFFF", math.abs(amount))
|
||||
end
|
||||
|
||||
---Get RGB highlight by highlight group
|
||||
---@param hl_group string @Highlight group name
|
||||
---@param use_bg boolean @Returns background or not
|
||||
@@ -143,7 +161,10 @@ function M.hl_to_rgb(hl_group, use_bg, fallback_hl)
|
||||
local hlexists = pcall(vim.api.nvim_get_hl, 0, { name = hl_group, link = false })
|
||||
|
||||
if hlexists then
|
||||
local result = vim.api.nvim_get_hl(0, { name = hl_group, link = false })
|
||||
-- FIXME: Investigate why hl-StatusLine is undefined in toggleterm and remove this workaround
|
||||
-- (@Jint-lzxy)
|
||||
local link = vim.bo.filetype == "toggleterm"
|
||||
local result = vim.api.nvim_get_hl(0, { name = hl_group, link = link })
|
||||
if use_bg then
|
||||
hex = result.bg and string.format("#%06x", result.bg) or "NONE"
|
||||
else
|
||||
@@ -166,6 +187,7 @@ function M.extend_hl(name, def)
|
||||
local current_def = vim.api.nvim_get_hl(0, { name = name, link = false })
|
||||
local combined_def = vim.tbl_deep_extend("force", current_def, def)
|
||||
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
vim.api.nvim_set_hl(0, name, combined_def)
|
||||
end
|
||||
|
||||
@@ -235,18 +257,13 @@ function M.gen_alpha_hl()
|
||||
set_global_hl("AlphaFooter", colors.yellow)
|
||||
end
|
||||
|
||||
-- Generate blend_color for neodim.
|
||||
function M.gen_neodim_blend_attr()
|
||||
local trans_bg = require("core.settings").transparent_background
|
||||
local appearance = require("core.settings").background
|
||||
-- Generate highlight groups for cursorword. Existing attributes will NOT be overwritten
|
||||
function M.gen_cursorword_hl()
|
||||
local colors = M.get_palette()
|
||||
|
||||
if trans_bg and appearance == "dark" then
|
||||
return "#000000"
|
||||
elseif trans_bg and appearance == "light" then
|
||||
return "#FFFFFF"
|
||||
else
|
||||
return M.hl_to_rgb("Normal", true)
|
||||
end
|
||||
-- Do not highlight `MiniCursorwordCurrent`
|
||||
set_global_hl("MiniCursorword", nil, M.darken(colors.surface1, 0.7, colors.base))
|
||||
set_global_hl("MiniCursorwordCurrent", nil)
|
||||
end
|
||||
|
||||
---Convert number (0/1) to boolean
|
||||
@@ -303,7 +320,8 @@ end
|
||||
---@param opts nil|table @The default config to be merged with
|
||||
---@param vim_plugin? boolean @If this plugin is written in vimscript or not
|
||||
---@param setup_callback? function @Add new callback if the plugin needs unusual setup function
|
||||
function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback)
|
||||
---@param overwrite? boolean @If load user table-type config by overwriting
|
||||
function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback, overwrite)
|
||||
vim_plugin = vim_plugin or false
|
||||
|
||||
-- Get the file name of the default config
|
||||
@@ -336,7 +354,11 @@ function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback)
|
||||
if ok then
|
||||
-- Extend base config if the returned user config is a table
|
||||
if type(user_config) == "table" then
|
||||
opts = tbl_recursive_merge(opts, user_config)
|
||||
if overwrite == true then
|
||||
opts = vim.tbl_deep_extend("force", opts, user_config)
|
||||
else
|
||||
opts = tbl_recursive_merge(opts, user_config)
|
||||
end
|
||||
setup_callback(opts)
|
||||
-- Replace base config if the returned user config is a function
|
||||
elseif type(user_config) == "function" then
|
||||
|
||||
Reference in New Issue
Block a user