update: imac config
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
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
|
||||
@@ -0,0 +1,206 @@
|
||||
return function()
|
||||
local icons = {
|
||||
kind = require("modules.utils.icons").get("kind"),
|
||||
type = require("modules.utils.icons").get("type"),
|
||||
cmp = require("modules.utils.icons").get("cmp"),
|
||||
}
|
||||
|
||||
local border = function(hl)
|
||||
return {
|
||||
{ "┌", hl },
|
||||
{ "─", hl },
|
||||
{ "┐", hl },
|
||||
{ "│", hl },
|
||||
{ "┘", hl },
|
||||
{ "─", hl },
|
||||
{ "└", hl },
|
||||
{ "│", hl },
|
||||
}
|
||||
end
|
||||
|
||||
local compare = require("cmp.config.compare")
|
||||
compare.lsp_scores = function(entry1, entry2)
|
||||
local diff
|
||||
if entry1.completion_item.score and entry2.completion_item.score then
|
||||
diff = (entry2.completion_item.score * entry2.score) - (entry1.completion_item.score * entry1.score)
|
||||
else
|
||||
diff = entry2.score - entry1.score
|
||||
end
|
||||
return (diff < 0)
|
||||
end
|
||||
|
||||
local use_copilot = require("core.settings").use_copilot
|
||||
local comparators = use_copilot == true
|
||||
and {
|
||||
require("copilot_cmp.comparators").prioritize,
|
||||
require("copilot_cmp.comparators").score,
|
||||
-- require("cmp_tabnine.compare"),
|
||||
compare.offset, -- Items closer to cursor will have lower priority
|
||||
compare.exact,
|
||||
-- compare.scopes,
|
||||
compare.lsp_scores,
|
||||
compare.sort_text,
|
||||
compare.score,
|
||||
compare.recently_used,
|
||||
-- compare.locality, -- Items closer to cursor will have higher priority, conflicts with `offset`
|
||||
require("cmp-under-comparator").under,
|
||||
compare.kind,
|
||||
compare.length,
|
||||
compare.order,
|
||||
}
|
||||
or {
|
||||
-- require("cmp_tabnine.compare"),
|
||||
compare.offset, -- Items closer to cursor will have lower priority
|
||||
compare.exact,
|
||||
-- compare.scopes,
|
||||
compare.lsp_scores,
|
||||
compare.sort_text,
|
||||
compare.score,
|
||||
compare.recently_used,
|
||||
-- compare.locality, -- Items closer to cursor will have higher priority, conflicts with `offset`
|
||||
require("cmp-under-comparator").under,
|
||||
compare.kind,
|
||||
compare.length,
|
||||
compare.order,
|
||||
}
|
||||
|
||||
local cmp = require("cmp")
|
||||
require("modules.utils").load_plugin("cmp", {
|
||||
preselect = cmp.PreselectMode.None,
|
||||
window = {
|
||||
completion = {
|
||||
border = border("PmenuBorder"),
|
||||
winhighlight = "Normal:Pmenu,CursorLine:PmenuSel,Search:PmenuSel",
|
||||
scrollbar = false,
|
||||
},
|
||||
documentation = {
|
||||
border = border("CmpDocBorder"),
|
||||
winhighlight = "Normal:CmpDoc",
|
||||
},
|
||||
},
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = comparators,
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
local lspkind_icons = vim.tbl_deep_extend("force", icons.kind, icons.type, icons.cmp)
|
||||
-- load lspkind icons
|
||||
vim_item.kind =
|
||||
string.format(" %s %s", lspkind_icons[vim_item.kind] or icons.cmp.undefined, vim_item.kind or "")
|
||||
|
||||
-- set up labels for completion entries
|
||||
vim_item.menu = setmetatable({
|
||||
cmp_tabnine = "[TN]",
|
||||
copilot = "[CPLT]",
|
||||
buffer = "[BUF]",
|
||||
orgmode = "[ORG]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[LUA]",
|
||||
path = "[PATH]",
|
||||
tmux = "[TMUX]",
|
||||
treesitter = "[TS]",
|
||||
latex_symbols = "[LTEX]",
|
||||
luasnip = "[SNIP]",
|
||||
spell = "[SPELL]",
|
||||
}, {
|
||||
__index = function()
|
||||
return "[BTN]" -- builtin/unknown source names
|
||||
end,
|
||||
})[entry.source.name]
|
||||
|
||||
-- cut down long results
|
||||
local label = vim_item.abbr
|
||||
local truncated_label = vim.fn.strcharpart(label, 0, 80)
|
||||
if truncated_label ~= label then
|
||||
vim_item.abbr = truncated_label .. "..."
|
||||
end
|
||||
|
||||
-- deduplicate results from nvim_lsp
|
||||
if entry.source.name == "nvim_lsp" then
|
||||
vim_item.dup = 0
|
||||
end
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
matching = {
|
||||
disallow_partial_fuzzy_matching = false,
|
||||
},
|
||||
performance = {
|
||||
async_budget = 1,
|
||||
max_view_entries = 120,
|
||||
},
|
||||
-- You can set mappings if you want
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-w>"] = cmp.mapping.abort(),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
||||
elseif require("luasnip").expand_or_locally_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
require("luasnip").jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<CR>"] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }),
|
||||
}),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- You should specify your *installed* sources.
|
||||
sources = {
|
||||
{ name = "nvim_lsp", max_item_count = 350 },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{ name = "treesitter" },
|
||||
{ name = "spell" },
|
||||
{ name = "tmux" },
|
||||
{ name = "orgmode" },
|
||||
{
|
||||
name = "buffer",
|
||||
option = {
|
||||
get_bufnrs = function()
|
||||
return vim.api.nvim_buf_line_count(0) < 7500 and vim.api.nvim_list_bufs() or {}
|
||||
end,
|
||||
},
|
||||
},
|
||||
{ name = "latex_symbols" },
|
||||
{ name = "copilot" },
|
||||
-- { name = "codeium" },
|
||||
-- { name = "cmp_tabnine" },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "Whitespace",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("codeium", {})
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("copilot_cmp", {})
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
return function()
|
||||
vim.defer_fn(function()
|
||||
require("modules.utils").load_plugin("copilot", {
|
||||
cmp = {
|
||||
enabled = true,
|
||||
method = "getCompletionsCycling",
|
||||
},
|
||||
panel = {
|
||||
-- if true, it can interfere with completions in copilot-cmp
|
||||
enabled = false,
|
||||
},
|
||||
suggestion = {
|
||||
-- if true, it can interfere with completions in copilot-cmp
|
||||
enabled = false,
|
||||
},
|
||||
filetypes = {
|
||||
["bigfile"] = false,
|
||||
["dap-repl"] = false,
|
||||
["fugitive"] = false,
|
||||
["fugitiveblame"] = false,
|
||||
["git"] = false,
|
||||
["gitcommit"] = false,
|
||||
["log"] = false,
|
||||
["toggleterm"] = false,
|
||||
},
|
||||
})
|
||||
end, 100)
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
return { "-style={BasedOnStyle: LLVM, IndentWidth: 4}" }
|
||||
@@ -0,0 +1,198 @@
|
||||
local M = {}
|
||||
|
||||
local settings = require("core.settings")
|
||||
local disabled_workspaces = settings.format_disabled_dirs
|
||||
local format_on_save = settings.format_on_save
|
||||
local format_notify = settings.format_notify
|
||||
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("FormatToggle", function()
|
||||
M.toggle_format_on_save()
|
||||
end, {})
|
||||
|
||||
local block_list = settings.formatter_block_list
|
||||
vim.api.nvim_create_user_command("FormatterToggleFt", function(opts)
|
||||
if block_list[opts.args] == nil then
|
||||
vim.notify(
|
||||
string.format("[LSP] Formatter for [%s] has been recorded in list and disabled.", opts.args),
|
||||
vim.log.levels.WARN,
|
||||
{ title = "LSP Formatter Warning" }
|
||||
)
|
||||
block_list[opts.args] = true
|
||||
else
|
||||
block_list[opts.args] = not block_list[opts.args]
|
||||
vim.notify(
|
||||
string.format(
|
||||
"[LSP] Formatter for [%s] has been %s.",
|
||||
opts.args,
|
||||
not block_list[opts.args] and "enabled" or "disabled"
|
||||
),
|
||||
not block_list[opts.args] and vim.log.levels.INFO or vim.log.levels.WARN,
|
||||
{ title = string.format("LSP Formatter %s", not block_list[opts.args] and "Info" or "Warning") }
|
||||
)
|
||||
end
|
||||
end, { nargs = 1, complete = "filetype" })
|
||||
|
||||
function M.enable_format_on_save(is_configured)
|
||||
local opts = { pattern = "*", timeout = format_timeout }
|
||||
vim.api.nvim_create_augroup("format_on_save", { clear = true })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = "format_on_save",
|
||||
pattern = opts.pattern,
|
||||
callback = function()
|
||||
require("completion.formatting").format({
|
||||
timeout_ms = opts.timeout,
|
||||
filter = M.format_filter,
|
||||
})
|
||||
end,
|
||||
})
|
||||
if not is_configured then
|
||||
vim.notify(
|
||||
"Successfully enabled format-on-save",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Settings modification success" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function M.disable_format_on_save(is_configured)
|
||||
pcall(vim.api.nvim_del_augroup_by_name, "format_on_save")
|
||||
if not is_configured then
|
||||
vim.notify(
|
||||
"Successfully disabled format-on-save",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Settings modification success" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function M.configure_format_on_save()
|
||||
if format_on_save then
|
||||
M.enable_format_on_save(true)
|
||||
else
|
||||
M.disable_format_on_save(true)
|
||||
end
|
||||
end
|
||||
|
||||
function M.toggle_format_on_save()
|
||||
local status = pcall(vim.api.nvim_get_autocmds, {
|
||||
group = "format_on_save",
|
||||
event = "BufWritePre",
|
||||
})
|
||||
if not status then
|
||||
M.enable_format_on_save(false)
|
||||
else
|
||||
M.disable_format_on_save(false)
|
||||
end
|
||||
end
|
||||
|
||||
function M.format_filter(clients)
|
||||
return vim.tbl_filter(function(client)
|
||||
local status_ok, formatting_supported = pcall(function()
|
||||
return client.supports_method("textDocument/formatting")
|
||||
end)
|
||||
if status_ok and formatting_supported and client.name == "null-ls" then
|
||||
return "null-ls"
|
||||
elseif not server_formatting_block_list[client.name] and status_ok and formatting_supported then
|
||||
return client.name
|
||||
end
|
||||
end, clients)
|
||||
end
|
||||
|
||||
function M.format(opts)
|
||||
local filedir = vim.fn.expand("%:p:h")
|
||||
for i = 1, #disabled_workspaces do
|
||||
if vim.regex(vim.fs.normalize(disabled_workspaces[i])):match_str(filedir) ~= nil then
|
||||
vim.notify(
|
||||
string.format(
|
||||
"[LSP] Formatting for all files under [%s] has been disabled.",
|
||||
vim.fs.normalize(disabled_workspaces[i])
|
||||
),
|
||||
vim.log.levels.WARN,
|
||||
{ title = "LSP Formatter Warning" }
|
||||
)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
|
||||
local clients = vim.lsp.get_clients({ buffer = bufnr })
|
||||
|
||||
if opts.filter then
|
||||
clients = opts.filter(clients)
|
||||
elseif opts.id then
|
||||
clients = vim.tbl_filter(function(client)
|
||||
return client.id == opts.id
|
||||
end, clients)
|
||||
elseif opts.name then
|
||||
clients = vim.tbl_filter(function(client)
|
||||
return client.name == opts.name
|
||||
end, clients)
|
||||
end
|
||||
|
||||
clients = vim.tbl_filter(function(client)
|
||||
return client.supports_method("textDocument/formatting")
|
||||
end, clients)
|
||||
|
||||
if #clients == 0 then
|
||||
vim.notify(
|
||||
"[LSP] Format request failed, no matching language servers.",
|
||||
vim.log.levels.WARN,
|
||||
{ title = "Formatting Failed" }
|
||||
)
|
||||
end
|
||||
|
||||
local timeout_ms = opts.timeout_ms
|
||||
for _, client in pairs(clients) do
|
||||
if block_list[vim.bo.filetype] == true then
|
||||
vim.notify(
|
||||
string.format(
|
||||
"[LSP][%s] Formatting for [%s] has been disabled. This file is not being processed.",
|
||||
client.name,
|
||||
vim.bo.filetype
|
||||
),
|
||||
vim.log.levels.WARN,
|
||||
{ title = "LSP Formatter Warning" }
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
if
|
||||
format_modifications_only
|
||||
and require("lsp-format-modifications").format_modifications(client, bufnr).success
|
||||
then
|
||||
if format_notify then
|
||||
vim.notify(
|
||||
string.format("[LSP] Format changed lines successfully with %s!", client.name),
|
||||
vim.log.levels.INFO,
|
||||
{ title = "LSP Range Format Success" }
|
||||
)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Fall back to format the whole buffer (even if partial formatting failed)
|
||||
local params = vim.lsp.util.make_formatting_params(opts.formatting_options)
|
||||
local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, bufnr)
|
||||
if result and result.result then
|
||||
vim.lsp.util.apply_text_edits(result.result, bufnr, client.offset_encoding)
|
||||
if format_notify then
|
||||
vim.notify(
|
||||
string.format("[LSP] Format successfully with %s!", client.name),
|
||||
vim.log.levels.INFO,
|
||||
{ title = "LSP Format Success" }
|
||||
)
|
||||
end
|
||||
elseif err then
|
||||
vim.notify(
|
||||
string.format("[LSP][%s] %s", client.name, err),
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "LSP Format Error" }
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,83 @@
|
||||
return function()
|
||||
local icons = { ui = require("modules.utils.icons").get("ui", true) }
|
||||
local actions = require("glance").actions
|
||||
|
||||
require("modules.utils").load_plugin("glance", {
|
||||
height = 20,
|
||||
zindex = 50,
|
||||
preview_win_opts = {
|
||||
cursorline = true,
|
||||
number = true,
|
||||
wrap = true,
|
||||
},
|
||||
border = {
|
||||
enable = require("core.settings").transparent_background,
|
||||
top_char = "―",
|
||||
bottom_char = "―",
|
||||
},
|
||||
list = {
|
||||
position = "right",
|
||||
width = 0.33, -- 33% width relative to the active window, min 0.1, max 0.5
|
||||
},
|
||||
folds = {
|
||||
folded = true, -- Automatically fold list on startup
|
||||
fold_closed = icons.ui.ArrowClosed,
|
||||
fold_open = icons.ui.ArrowOpen,
|
||||
},
|
||||
indent_lines = { enable = true },
|
||||
winbar = { enable = true },
|
||||
mappings = {
|
||||
list = {
|
||||
["k"] = actions.previous,
|
||||
["j"] = actions.next,
|
||||
["<Up>"] = actions.previous,
|
||||
["<Down>"] = actions.next,
|
||||
["<S-Tab>"] = actions.previous_location, -- Bring the cursor to the previous location skipping groups in the list
|
||||
["<Tab>"] = actions.next_location, -- Bring the cursor to the next location skipping groups in the list
|
||||
["<C-u>"] = actions.preview_scroll_win(8),
|
||||
["<C-d>"] = actions.preview_scroll_win(-8),
|
||||
["<CR>"] = actions.jump,
|
||||
["v"] = actions.jump_vsplit,
|
||||
["s"] = actions.jump_split,
|
||||
["t"] = actions.jump_tab,
|
||||
["c"] = actions.close_fold,
|
||||
["o"] = actions.open_fold,
|
||||
["[]"] = actions.enter_win("preview"), -- Focus preview window
|
||||
["q"] = actions.close,
|
||||
["Q"] = actions.close,
|
||||
["<Esc>"] = actions.close,
|
||||
["gq"] = actions.quickfix,
|
||||
},
|
||||
preview = {
|
||||
["Q"] = actions.close,
|
||||
["<C-c>q"] = actions.close,
|
||||
["<C-c>o"] = actions.jump,
|
||||
["<C-c>v"] = actions.jump_vsplit,
|
||||
["<C-c>s"] = actions.jump_split,
|
||||
["<C-c>t"] = actions.jump_tab,
|
||||
["<C-p>"] = actions.previous_location,
|
||||
["<C-n>"] = actions.next_location,
|
||||
["[]"] = actions.enter_win("list"), -- Focus list window
|
||||
},
|
||||
},
|
||||
hooks = {
|
||||
before_open = function(results, open, _, method)
|
||||
if #results == 0 then
|
||||
vim.notify(
|
||||
"This method is not supported by any of the servers registered for the current buffer",
|
||||
vim.log.levels.WARN,
|
||||
{ title = "Glance" }
|
||||
)
|
||||
elseif #results == 1 and method == "references" then
|
||||
vim.notify(
|
||||
"The identifier under cursor is the only one found",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Glance" }
|
||||
)
|
||||
else
|
||||
open(results)
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("lsp_signature", {
|
||||
bind = true,
|
||||
-- TODO: Remove the following line when nvim-cmp#1613 gets resolved
|
||||
check_completion_visible = false,
|
||||
floating_window = true,
|
||||
floating_window_above_cur_line = true,
|
||||
hi_parameter = "Search",
|
||||
hint_enable = true,
|
||||
transparency = nil, -- disabled by default, allow floating win transparent value 1~100
|
||||
wrap = true,
|
||||
zindex = 45, -- avoid overlap with nvim.cmp
|
||||
handler_opts = { border = "single" },
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
return function()
|
||||
local nvim_lsp = require("lspconfig")
|
||||
require("completion.neoconf").setup()
|
||||
require("completion.mason").setup()
|
||||
require("completion.mason-lspconfig").setup()
|
||||
|
||||
local opts = {
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
}
|
||||
-- Setup lsps that are not supported by `mason.nvim` but supported by `nvim-lspconfig` here.
|
||||
if vim.fn.executable("dart") == 1 then
|
||||
local ok, _opts = pcall(require, "user.configs.lsp-servers.dartls")
|
||||
if not ok then
|
||||
_opts = require("completion.servers.dartls")
|
||||
end
|
||||
local final_opts = vim.tbl_deep_extend("keep", _opts, opts)
|
||||
nvim_lsp.dartls.setup(final_opts)
|
||||
end
|
||||
|
||||
pcall(require, "user.configs.lsp")
|
||||
|
||||
pcall(vim.cmd.LspStart) -- Start LSPs
|
||||
end
|
||||
@@ -0,0 +1,183 @@
|
||||
return function()
|
||||
require("modules.utils").gen_lspkind_hl()
|
||||
|
||||
local icons = {
|
||||
cmp = require("modules.utils.icons").get("cmp", true),
|
||||
diagnostics = require("modules.utils.icons").get("diagnostics", true),
|
||||
kind = require("modules.utils.icons").get("kind", true),
|
||||
type = require("modules.utils.icons").get("type", true),
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
}
|
||||
|
||||
local function set_sidebar_icons()
|
||||
-- Set icons for sidebar
|
||||
vim.diagnostic.config({
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error_alt,
|
||||
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warning_alt,
|
||||
[vim.diagnostic.severity.INFO] = icons.diagnostics.Information_alt,
|
||||
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint_alt,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
set_sidebar_icons()
|
||||
|
||||
require("modules.utils").load_plugin("lspsaga", {
|
||||
-- Breadcrumbs: https://nvimdev.github.io/lspsaga/breadcrumbs/
|
||||
symbol_in_winbar = {
|
||||
enable = false,
|
||||
separator = " " .. icons.ui.Separator,
|
||||
hide_keyword = false,
|
||||
show_file = false,
|
||||
folder_level = 1,
|
||||
color_mode = true,
|
||||
delay = 100,
|
||||
},
|
||||
-- Callhierarchy: https://nvimdev.github.io/lspsaga/callhierarchy/
|
||||
callhierarchy = {
|
||||
layout = "float",
|
||||
keys = {
|
||||
edit = "e",
|
||||
vsplit = "v",
|
||||
split = "s",
|
||||
tabe = "t",
|
||||
quit = "q",
|
||||
shuttle = "[]",
|
||||
toggle_or_req = "u",
|
||||
close = "<Esc>",
|
||||
},
|
||||
},
|
||||
-- Code Action: https://nvimdev.github.io/lspsaga/codeaction/
|
||||
code_action = {
|
||||
num_shortcut = true,
|
||||
only_in_cursor = false,
|
||||
show_server_name = true,
|
||||
extend_gitsigns = false,
|
||||
keys = {
|
||||
quit = "q",
|
||||
exec = "<CR>",
|
||||
},
|
||||
},
|
||||
-- Diagnostics: https://nvimdev.github.io/lspsaga/diagnostic/
|
||||
diagnostic = {
|
||||
show_code_action = true,
|
||||
jump_num_shortcut = true,
|
||||
max_width = 0.5,
|
||||
max_height = 0.6,
|
||||
text_hl_follow = true,
|
||||
border_follow = true,
|
||||
extend_relatedInformation = true,
|
||||
show_layout = "float",
|
||||
show_normal_height = 10,
|
||||
max_show_width = 0.9,
|
||||
max_show_height = 0.6,
|
||||
diagnostic_only_current = false,
|
||||
keys = {
|
||||
exec_action = "r",
|
||||
quit = "q",
|
||||
toggle_or_jump = "<CR>",
|
||||
quit_in_show = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
-- Hover: https://nvimdev.github.io/lspsaga/hover/
|
||||
hover = {
|
||||
max_width = 0.45,
|
||||
max_height = 0.7,
|
||||
open_link = "gl",
|
||||
open_cmd = "silent !" .. require("core.settings").external_browser,
|
||||
},
|
||||
-- Impl: https://nvimdev.github.io/lspsaga/implement/
|
||||
implement = {
|
||||
enable = true,
|
||||
sign = true,
|
||||
virtual_text = false,
|
||||
priority = 100,
|
||||
},
|
||||
-- LightBulb: https://nvimdev.github.io/lspsaga/lightbulb/
|
||||
lightbulb = {
|
||||
enable = false,
|
||||
sign = true,
|
||||
virtual_text = false,
|
||||
debounce = 10,
|
||||
sign_priority = 20,
|
||||
},
|
||||
-- Rename: https://nvimdev.github.io/lspsaga/rename/
|
||||
rename = {
|
||||
in_select = false,
|
||||
auto_save = false,
|
||||
project_max_width = 0.5,
|
||||
project_max_height = 0.5,
|
||||
keys = {
|
||||
quit = "<C-c>",
|
||||
exec = "<CR>",
|
||||
select = "x",
|
||||
},
|
||||
},
|
||||
-- Beacon: https://nvimdev.github.io/lspsaga/misc/#beacon
|
||||
beacon = {
|
||||
enable = true,
|
||||
frequency = 12,
|
||||
},
|
||||
-- Generic UI Options: https://nvimdev.github.io/lspsaga/misc/#generic-ui-options
|
||||
ui = {
|
||||
border = "single", -- Can be single, double, rounded, solid, shadow.
|
||||
devicon = true,
|
||||
title = true,
|
||||
expand = icons.ui.ArrowClosed,
|
||||
collapse = icons.ui.ArrowOpen,
|
||||
code_action = icons.ui.CodeAction,
|
||||
actionfix = icons.ui.Spell,
|
||||
lines = { "┗", "┣", "┃", "━", "┏" },
|
||||
imp_sign = icons.kind.Implementation,
|
||||
kind = {
|
||||
-- Kind
|
||||
Class = { icons.kind.Class, "LspKindClass" },
|
||||
Constant = { icons.kind.Constant, "LspKindConstant" },
|
||||
Constructor = { icons.kind.Constructor, "LspKindConstructor" },
|
||||
Enum = { icons.kind.Enum, "LspKindEnum" },
|
||||
EnumMember = { icons.kind.EnumMember, "LspKindEnumMember" },
|
||||
Event = { icons.kind.Event, "LspKindEvent" },
|
||||
Field = { icons.kind.Field, "LspKindField" },
|
||||
File = { icons.kind.File, "LspKindFile" },
|
||||
Function = { icons.kind.Function, "LspKindFunction" },
|
||||
Interface = { icons.kind.Interface, "LspKindInterface" },
|
||||
Key = { icons.kind.Keyword, "LspKindKey" },
|
||||
Method = { icons.kind.Method, "LspKindMethod" },
|
||||
Module = { icons.kind.Module, "LspKindModule" },
|
||||
Namespace = { icons.kind.Namespace, "LspKindNamespace" },
|
||||
Operator = { icons.kind.Operator, "LspKindOperator" },
|
||||
Package = { icons.kind.Package, "LspKindPackage" },
|
||||
Property = { icons.kind.Property, "LspKindProperty" },
|
||||
Struct = { icons.kind.Struct, "LspKindStruct" },
|
||||
TypeParameter = { icons.kind.TypeParameter, "LspKindTypeParameter" },
|
||||
Variable = { icons.kind.Variable, "LspKindVariable" },
|
||||
-- Type
|
||||
Array = { icons.type.Array, "LspKindArray" },
|
||||
Boolean = { icons.type.Boolean, "LspKindBoolean" },
|
||||
Null = { icons.type.Null, "LspKindNull" },
|
||||
Number = { icons.type.Number, "LspKindNumber" },
|
||||
Object = { icons.type.Object, "LspKindObject" },
|
||||
String = { icons.type.String, "LspKindString" },
|
||||
-- ccls-specific icons.
|
||||
TypeAlias = { icons.kind.TypeAlias, "LspKindTypeAlias" },
|
||||
Parameter = { icons.kind.Parameter, "LspKindParameter" },
|
||||
StaticMethod = { icons.kind.StaticMethod, "LspKindStaticMethod" },
|
||||
-- Microsoft-specific icons.
|
||||
Text = { icons.kind.Text, "LspKindText" },
|
||||
Snippet = { icons.kind.Snippet, "LspKindSnippet" },
|
||||
Folder = { icons.kind.Folder, "LspKindFolder" },
|
||||
Unit = { icons.kind.Unit, "LspKindUnit" },
|
||||
Value = { icons.kind.Value, "LspKindValue" },
|
||||
},
|
||||
},
|
||||
-- Scrolling Keymaps: https://nvimdev.github.io/lspsaga/misc/#scrolling-keymaps
|
||||
scroll_preview = {
|
||||
scroll_down = "<C-d>",
|
||||
scroll_up = "<C-u>",
|
||||
},
|
||||
request_timeout = 3000,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
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
|
||||
|
||||
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_lua").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function()
|
||||
local diagnostics_virtual_text = require("core.settings").diagnostics_virtual_text
|
||||
local diagnostics_level = require("core.settings").diagnostics_level
|
||||
|
||||
local nvim_lsp = require("lspconfig")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
require("lspconfig.ui.windows").default_options.border = "rounded"
|
||||
|
||||
require("modules.utils").load_plugin("mason-lspconfig", {
|
||||
ensure_installed = require("core.settings").lsp_deps,
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
signs = true,
|
||||
underline = true,
|
||||
virtual_text = diagnostics_virtual_text and {
|
||||
severity = {
|
||||
min = vim.diagnostic.severity[diagnostics_level],
|
||||
},
|
||||
} or false,
|
||||
-- set update_in_insert to false because it was enabled by lspsaga
|
||||
update_in_insert = false,
|
||||
})
|
||||
|
||||
local opts = {
|
||||
capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
require("cmp_nvim_lsp").default_capabilities()
|
||||
),
|
||||
}
|
||||
---A handler to setup all servers defined under `completion/servers/*.lua`
|
||||
---@param lsp_name string
|
||||
local function mason_lsp_handler(lsp_name)
|
||||
-- rust_analyzer is configured using mrcjkb/rustaceanvim
|
||||
-- warn users if they have set it up manually
|
||||
if lsp_name == "rust_analyzer" then
|
||||
local config_exist = pcall(require, "completion.servers." .. lsp_name)
|
||||
if config_exist then
|
||||
vim.notify(
|
||||
[[
|
||||
`rust_analyzer` is configured independently via `mrcjkb/rustaceanvim`. To get rid of this warning,
|
||||
please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` directory and configure
|
||||
`rust_analyzer` using the appropriate init options provided by `rustaceanvim` instead.]],
|
||||
vim.log.levels.WARN,
|
||||
{ title = "nvim-lspconfig" }
|
||||
)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name)
|
||||
-- Use preset if there is no user definition
|
||||
if not ok then
|
||||
ok, custom_handler = pcall(require, "completion.servers." .. lsp_name)
|
||||
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)
|
||||
return
|
||||
elseif type(custom_handler) == "function" then
|
||||
--- Case where language server requires its own setup
|
||||
--- Make sure to call require("lspconfig")[lsp_name].setup() in the function
|
||||
--- 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))
|
||||
else
|
||||
vim.notify(
|
||||
string.format(
|
||||
"Failed to setup [%s].\n\nServer definition under `completion/servers` must return\neither a fun(opts) or a table (got '%s' instead)",
|
||||
lsp_name,
|
||||
type(custom_handler)
|
||||
),
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "nvim-lspconfig" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
mason_lspconfig.setup_handlers({ mason_lsp_handler })
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function()
|
||||
require("modules.utils").load_plugin("mason-null-ls", {
|
||||
ensure_installed = require("core.settings").null_ls_deps,
|
||||
automatic_installation = false,
|
||||
automatic_setup = true,
|
||||
handlers = {},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,94 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function()
|
||||
local is_windows = require("core.global").is_windows
|
||||
|
||||
local mason_registry = require("mason-registry")
|
||||
require("lspconfig.ui.windows").default_options.border = "rounded"
|
||||
|
||||
local icons = {
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
misc = require("modules.utils.icons").get("misc", true),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("mason", {
|
||||
ui = {
|
||||
border = "single",
|
||||
icons = {
|
||||
package_pending = icons.ui.Modified_alt,
|
||||
package_installed = icons.ui.Check,
|
||||
package_uninstalled = icons.misc.Ghost,
|
||||
},
|
||||
keymaps = {
|
||||
toggle_server_expand = "<CR>",
|
||||
install_server = "i",
|
||||
update_server = "u",
|
||||
check_server_version = "c",
|
||||
update_all_servers = "U",
|
||||
check_outdated_servers = "C",
|
||||
uninstall_server = "X",
|
||||
cancel_installation = "<C-c>",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Additional plugins for pylsp
|
||||
mason_registry:on(
|
||||
"package:install:success",
|
||||
vim.schedule_wrap(function(pkg)
|
||||
if pkg.name ~= "python-lsp-server" then
|
||||
return
|
||||
end
|
||||
|
||||
local venv = vim.fn.stdpath("data") .. "/mason/packages/python-lsp-server/venv"
|
||||
local python = is_windows and venv .. "/Scripts/python.exe" or venv .. "/bin/python"
|
||||
local black = is_windows and venv .. "/Scripts/black.exe" or venv .. "/bin/black"
|
||||
local ruff = is_windows and venv .. "/Scripts/ruff.exe" or venv .. "/bin/ruff"
|
||||
|
||||
require("plenary.job")
|
||||
:new({
|
||||
command = python,
|
||||
args = {
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"-U",
|
||||
"--disable-pip-version-check",
|
||||
"python-lsp-black",
|
||||
"python-lsp-ruff",
|
||||
"pylsp-rope",
|
||||
},
|
||||
cwd = venv,
|
||||
env = { VIRTUAL_ENV = venv },
|
||||
on_exit = function()
|
||||
if vim.fn.executable(black) == 1 and vim.fn.executable(ruff) == 1 then
|
||||
vim.notify(
|
||||
"Finished installing pylsp plugins",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "[lsp] Install Status" }
|
||||
)
|
||||
else
|
||||
vim.notify(
|
||||
"Failed to install pylsp plugins. [Executable not found]",
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "[lsp] Install Failure" }
|
||||
)
|
||||
end
|
||||
end,
|
||||
on_start = function()
|
||||
vim.notify(
|
||||
"Now installing pylsp plugins...",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "[lsp] Install Status", timeout = 6000 }
|
||||
)
|
||||
end,
|
||||
on_stderr = function(_, msg_stream)
|
||||
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
end)
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,20 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function()
|
||||
require("modules.utils").load_plugin("neoconf", {
|
||||
-- send new configuration to lsp clients when changing json settings
|
||||
live_reload = true,
|
||||
-- name of the local settings files
|
||||
local_settings = ".neoconf.json",
|
||||
-- name of the global settings file in your Neovim config directory
|
||||
global_settings = "neoconf.json",
|
||||
-- import existing settings from other plugins
|
||||
import = {
|
||||
vscode = true, -- local .vscode/settings.json
|
||||
coc = true, -- global/local coc-settings.json
|
||||
nlsp = true, -- global/local nlsp-settings.nvim json settings
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,77 @@
|
||||
return function()
|
||||
local null_ls = require("null-ls")
|
||||
local btns = null_ls.builtins
|
||||
|
||||
---Return formatter args required by `extra_args`
|
||||
---@param formatter_name string
|
||||
---@return table|nil
|
||||
local function formatter_args(formatter_name)
|
||||
local ok, args = pcall(require, "user.configs.formatters." .. formatter_name)
|
||||
if not ok then
|
||||
args = require("completion.formatters." .. formatter_name)
|
||||
end
|
||||
return args
|
||||
end
|
||||
|
||||
-- Please set additional flags for the supported servers here
|
||||
-- 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" },
|
||||
extra_args = formatter_args("clang_format"),
|
||||
}),
|
||||
btns.formatting.prettier.with({
|
||||
filetypes = {
|
||||
"vue",
|
||||
"typescript",
|
||||
"javascript",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"yaml",
|
||||
"html",
|
||||
"css",
|
||||
"scss",
|
||||
"sh",
|
||||
"markdown",
|
||||
},
|
||||
}),
|
||||
}
|
||||
require("modules.utils").load_plugin("null-ls", {
|
||||
border = "rounded",
|
||||
debug = false,
|
||||
log_level = "warn",
|
||||
update_in_insert = false,
|
||||
sources = sources,
|
||||
default_timeout = require("core.settings").format_timeout,
|
||||
})
|
||||
|
||||
require("completion.mason-null-ls").setup()
|
||||
|
||||
-- Setup usercmd to register/deregister available source(s)
|
||||
local function _gen_completion()
|
||||
local sources_cont = null_ls.get_source({
|
||||
filetype = vim.bo.filetype,
|
||||
})
|
||||
local completion_items = {}
|
||||
for _, server in pairs(sources_cont) do
|
||||
table.insert(completion_items, server.name)
|
||||
end
|
||||
return completion_items
|
||||
end
|
||||
vim.api.nvim_create_user_command("NullLsToggle", function(opts)
|
||||
if vim.tbl_contains(_gen_completion(), opts.args) then
|
||||
null_ls.toggle({ name = opts.args })
|
||||
else
|
||||
vim.notify(
|
||||
string.format("[Null-ls] Unable to find any registered source named [%s].", opts.args),
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "Null-ls Internal Error" }
|
||||
)
|
||||
end
|
||||
end, {
|
||||
nargs = 1,
|
||||
complete = _gen_completion,
|
||||
})
|
||||
|
||||
require("completion.formatting").configure_format_on_save()
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/bashls.lua
|
||||
return {
|
||||
cmd = { "bash-language-server", "start" },
|
||||
filetypes = { "bash", "sh" },
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
local function switch_source_header_splitcmd(bufnr, splitcmd)
|
||||
bufnr = require("lspconfig").util.validate_bufnr(bufnr)
|
||||
local clangd_client = require("lspconfig").util.get_active_client_by_name(bufnr, "clangd")
|
||||
local params = { uri = vim.uri_from_bufnr(bufnr) }
|
||||
if clangd_client then
|
||||
clangd_client.request("textDocument/switchSourceHeader", params, function(err, result)
|
||||
if err then
|
||||
error(tostring(err))
|
||||
end
|
||||
if not result then
|
||||
vim.notify("Corresponding file can’t be determined", vim.log.levels.ERROR, { title = "LSP Error!" })
|
||||
return
|
||||
end
|
||||
vim.api.nvim_command(splitcmd .. " " .. vim.uri_to_fname(result))
|
||||
end)
|
||||
else
|
||||
vim.notify(
|
||||
"Method textDocument/switchSourceHeader is not supported by any active server on this buffer",
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "LSP Error!" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_binary_path_list(binaries)
|
||||
local path_list = {}
|
||||
for _, binary in ipairs(binaries) do
|
||||
local path = vim.fn.exepath(binary)
|
||||
if path ~= "" then
|
||||
table.insert(path_list, path)
|
||||
end
|
||||
end
|
||||
return table.concat(path_list, ",")
|
||||
end
|
||||
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua
|
||||
return function(options)
|
||||
require("lspconfig").clangd.setup({
|
||||
on_attach = options.on_attach,
|
||||
capabilities = vim.tbl_deep_extend("keep", { offsetEncoding = { "utf-16", "utf-8" } }, options.capabilities),
|
||||
single_file_support = true,
|
||||
cmd = {
|
||||
"clangd",
|
||||
"-j=12",
|
||||
"--enable-config",
|
||||
"--background-index",
|
||||
"--pch-storage=memory",
|
||||
-- You MUST set this arg ↓ to your c/cpp compiler location (if not included)!
|
||||
"--query-driver=" .. get_binary_path_list({ "clang++", "clang", "gcc", "g++" }),
|
||||
"--clang-tidy",
|
||||
"--all-scopes-completion",
|
||||
"--completion-style=detailed",
|
||||
"--header-insertion-decorators",
|
||||
"--header-insertion=iwyu",
|
||||
"--limit-references=3000",
|
||||
"--limit-results=350",
|
||||
},
|
||||
commands = {
|
||||
ClangdSwitchSourceHeader = {
|
||||
function()
|
||||
switch_source_header_splitcmd(0, "edit")
|
||||
end,
|
||||
description = "Open source/header in current buffer",
|
||||
},
|
||||
ClangdSwitchSourceHeaderVSplit = {
|
||||
function()
|
||||
switch_source_header_splitcmd(0, "vsplit")
|
||||
end,
|
||||
description = "Open source/header in a new vsplit",
|
||||
},
|
||||
ClangdSwitchSourceHeaderSplit = {
|
||||
function()
|
||||
switch_source_header_splitcmd(0, "split")
|
||||
end,
|
||||
description = "Open source/header in a new split",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/dartls.lua
|
||||
return {
|
||||
cmd = { "dart", "language-server", "--protocol=lsp" },
|
||||
filetypes = { "dart" },
|
||||
init_options = {
|
||||
closingLabels = true,
|
||||
flutterOutline = true,
|
||||
onlyAnalyzeProjectsWithOpenFiles = true,
|
||||
outline = true,
|
||||
suggestFromUnimportedLibraries = true,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/gopls.lua
|
||||
return {
|
||||
cmd = { "gopls", "-remote.debug=:0", "-remote=auto" },
|
||||
filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" },
|
||||
flags = { allow_incremental_sync = true, debounce_text_changes = 500 },
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
contextSupport = true,
|
||||
dynamicRegistration = true,
|
||||
completionItem = {
|
||||
commitCharactersSupport = true,
|
||||
deprecatedSupport = true,
|
||||
preselectSupport = true,
|
||||
insertReplaceSupport = true,
|
||||
labelDetailsSupport = true,
|
||||
snippetSupport = true,
|
||||
documentationFormat = { "markdown", "plaintext" },
|
||||
resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"details",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
settings = {
|
||||
gopls = {
|
||||
staticcheck = true,
|
||||
semanticTokens = true,
|
||||
noSemanticString = true,
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
symbolMatcher = "Fuzzy",
|
||||
buildFlags = { "-tags", "integration" },
|
||||
codelenses = {
|
||||
generate = true,
|
||||
gc_details = true,
|
||||
test = true,
|
||||
tidy = true,
|
||||
vendor = true,
|
||||
regenerate_cgo = true,
|
||||
upgrade_dependency = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
-- https://github.com/vscode-langservers/vscode-html-languageserver-bin
|
||||
return {
|
||||
cmd = { "html-languageserver", "--stdio" },
|
||||
filetypes = { "html" },
|
||||
init_options = {
|
||||
configurationSection = { "html", "css", "javascript" },
|
||||
embeddedLanguages = { css = true, javascript = true },
|
||||
},
|
||||
settings = {},
|
||||
single_file_support = true,
|
||||
flags = { debounce_text_changes = 500 },
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jsonls.lua
|
||||
return {
|
||||
flags = { debounce_text_changes = 500 },
|
||||
settings = {
|
||||
json = {
|
||||
-- Schemas https://www.schemastore.org
|
||||
schemas = {
|
||||
{
|
||||
fileMatch = { "package.json" },
|
||||
url = "https://json.schemastore.org/package.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { "tsconfig*.json" },
|
||||
url = "https://json.schemastore.org/tsconfig.json",
|
||||
},
|
||||
{
|
||||
fileMatch = {
|
||||
".prettierrc",
|
||||
".prettierrc.json",
|
||||
"prettier.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/prettierrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { ".eslintrc", ".eslintrc.json" },
|
||||
url = "https://json.schemastore.org/eslintrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = {
|
||||
".babelrc",
|
||||
".babelrc.json",
|
||||
"babel.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/babelrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { "lerna.json" },
|
||||
url = "https://json.schemastore.org/lerna.json",
|
||||
},
|
||||
{
|
||||
fileMatch = {
|
||||
".stylelintrc",
|
||||
".stylelintrc.json",
|
||||
"stylelint.config.json",
|
||||
},
|
||||
url = "http://json.schemastore.org/stylelintrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { "/.github/workflows/*" },
|
||||
url = "https://json.schemastore.org/github-workflow.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/lua_ls.lua
|
||||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = "LuaJIT" },
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
disable = { "different-requires", "undefined-field" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
vim.fn.expand("$VIMRUNTIME/lua"),
|
||||
vim.fn.expand("$VIMRUNTIME/lua/vim/lsp"),
|
||||
},
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 10000,
|
||||
},
|
||||
hint = { enable = true, setType = true },
|
||||
format = { enable = false },
|
||||
telemetry = { enable = false },
|
||||
-- Do not override treesitter lua highlighting with lua_ls's highlighting
|
||||
semantic = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/pylsp.lua
|
||||
return {
|
||||
cmd = { "pylsp" },
|
||||
filetypes = { "python" },
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
-- Lint
|
||||
ruff = {
|
||||
enabled = true,
|
||||
select = {
|
||||
-- enable pycodestyle
|
||||
"E",
|
||||
-- enable pyflakes
|
||||
"F",
|
||||
},
|
||||
ignore = {
|
||||
-- ignore E501 (line too long)
|
||||
-- "E501",
|
||||
-- ignore F401 (imported but unused)
|
||||
-- "F401",
|
||||
},
|
||||
extendSelect = { "I" },
|
||||
severities = {
|
||||
-- Hint, Information, Warning, Error
|
||||
F401 = "I",
|
||||
E501 = "I",
|
||||
},
|
||||
},
|
||||
flake8 = { enabled = false },
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
mccabe = { enabled = false },
|
||||
|
||||
-- Code refactor
|
||||
rope = { enabled = true },
|
||||
|
||||
-- Formatting
|
||||
black = { enabled = true },
|
||||
pyls_isort = { enabled = false },
|
||||
autopep8 = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return function()
|
||||
require("cmp_tabnine.config"):setup({ max_line = 1000, max_num_results = 20, sort = true })
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("mini.align", {
|
||||
-- Whether to disable showing non-error feedback
|
||||
silent = false,
|
||||
-- Module mappings. Use `''` (empty string) to disable one.
|
||||
mappings = {
|
||||
start = "gea",
|
||||
start_with_preview = "geA",
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("autoclose", {
|
||||
keys = {
|
||||
["("] = { escape = false, close = true, pair = "()" },
|
||||
["["] = { escape = false, close = true, pair = "[]" },
|
||||
["{"] = { escape = false, close = true, pair = "{}" },
|
||||
|
||||
["<"] = { escape = true, close = true, pair = "<>", enabled_filetypes = { "rust" } },
|
||||
[">"] = { escape = true, close = false, pair = "<>" },
|
||||
[")"] = { escape = true, close = false, pair = "()" },
|
||||
["]"] = { escape = true, close = false, pair = "[]" },
|
||||
["}"] = { escape = true, close = false, pair = "{}" },
|
||||
|
||||
['"'] = { escape = true, close = true, pair = '""' },
|
||||
["`"] = { escape = true, close = true, pair = "``" },
|
||||
["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = { "rust" } },
|
||||
},
|
||||
options = {
|
||||
disable_when_touch = false,
|
||||
disabled_filetypes = {
|
||||
"alpha",
|
||||
"bigfile",
|
||||
"checkhealth",
|
||||
"dap-repl",
|
||||
"diff",
|
||||
"help",
|
||||
"log",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"qf",
|
||||
"TelescopePrompt",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
"vimwiki",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("nvim-ts-autotag", {
|
||||
opts = {
|
||||
enable_close = true, -- Auto close tags
|
||||
enable_rename = true, -- Auto rename pairs of tags
|
||||
enable_close_on_slash = false, -- Auto close on trailing </
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
return function()
|
||||
local ftdetect = {
|
||||
name = "ftdetect",
|
||||
opts = { defer = true },
|
||||
disable = function()
|
||||
vim.api.nvim_set_option_value("filetype", "bigfile", { scope = "local" })
|
||||
end,
|
||||
}
|
||||
|
||||
local cmp = {
|
||||
name = "nvim-cmp",
|
||||
opts = { defer = true },
|
||||
disable = function()
|
||||
require("cmp").setup.buffer({ enabled = false })
|
||||
end,
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("bigfile", {
|
||||
filesize = 2, -- size of the file in MiB
|
||||
pattern = { "*" }, -- autocmd pattern
|
||||
features = { -- features to disable
|
||||
"indent_blankline",
|
||||
"lsp",
|
||||
"syntax",
|
||||
"treesitter",
|
||||
"vimopts",
|
||||
cmp,
|
||||
ftdetect,
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("Comment", {
|
||||
-- Add a space b/w comment and the line
|
||||
padding = true,
|
||||
-- Whether the cursor should stay at its position
|
||||
sticky = true,
|
||||
-- Lines to be ignored while (un)comment
|
||||
ignore = "^$",
|
||||
-- LHS of toggle mappings in NORMAL mode
|
||||
toggler = {
|
||||
-- Line-comment toggle keymap
|
||||
line = "gcc",
|
||||
-- Block-comment toggle keymap
|
||||
block = "gbc",
|
||||
},
|
||||
-- LHS of operator-pending mappings in NORMAL and VISUAL mode
|
||||
opleader = {
|
||||
-- Line-comment keymap
|
||||
line = "gc",
|
||||
-- Block-comment keymap
|
||||
block = "gb",
|
||||
},
|
||||
-- LHS of extra mappings
|
||||
extra = {
|
||||
-- Add comment on the line above
|
||||
above = "gcO",
|
||||
-- Add comment on the line below
|
||||
below = "gco",
|
||||
-- Add comment at the end of line
|
||||
eol = "gcA",
|
||||
},
|
||||
-- We defined mappings in `lua/keymap/init.lua` with description so disable them here.
|
||||
mappings = {
|
||||
-- Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
|
||||
basic = false,
|
||||
-- Extra mapping; `gco`, `gcO`, `gcA`
|
||||
extra = false,
|
||||
},
|
||||
-- Function to call before (un)comment
|
||||
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
|
||||
-- Function to call after (un)comment
|
||||
post_hook = nil,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("diffview", {
|
||||
diff_binaries = false, -- Show diffs for binaries
|
||||
enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl'
|
||||
git_cmd = { "git" }, -- The git executable followed by default args.
|
||||
hg_cmd = { "hg" }, -- The hg executable followed by default args.
|
||||
use_icons = true, -- Requires nvim-web-devicons
|
||||
show_help_hints = true, -- Show hints for how to open the help panel
|
||||
watch_index = true, -- Update views and index buffers when the git index changes.
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
return function()
|
||||
vim.api.nvim_set_hl(
|
||||
0,
|
||||
"FlashLabel",
|
||||
{ underline = true, bold = true, fg = "Orange", bg = "NONE", ctermfg = "Red", ctermbg = "NONE" }
|
||||
)
|
||||
|
||||
require("modules.utils").load_plugin("flash", {
|
||||
labels = "asdfghjklqwertyuiopzxcvbnm",
|
||||
label = {
|
||||
-- allow uppercase labels
|
||||
uppercase = true,
|
||||
-- add a label for the first match in the current window.
|
||||
-- you can always jump to the first match with `<CR>`
|
||||
current = true,
|
||||
-- for the current window, label targets closer to the cursor first
|
||||
distance = true,
|
||||
},
|
||||
modes = {
|
||||
search = { enabled = false },
|
||||
-- options used when flash is activated through
|
||||
-- `f`, `F`, `t`, `T`, `;` and `,` motions
|
||||
char = {
|
||||
enabled = true,
|
||||
-- hide after jump when not using jump labels
|
||||
autohide = false,
|
||||
-- show jump labels
|
||||
jump_labels = false,
|
||||
-- set to `false` to use the current line only
|
||||
multi_line = true,
|
||||
-- When using jump labels, don't use these keys
|
||||
-- This allows using those keys directly after the motion
|
||||
label = { exclude = "hjkliardc" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("nvim-highlight-colors", {
|
||||
render = "background",
|
||||
enable_hex = true,
|
||||
enable_short_hex = true,
|
||||
enable_rgb = true,
|
||||
enable_hsl = true,
|
||||
enable_var_usage = true,
|
||||
enable_named_colors = false,
|
||||
enable_tailwind = false,
|
||||
-- Exclude filetypes or buftypes from highlighting
|
||||
exclude_filetypes = {
|
||||
"alpha",
|
||||
"bigfile",
|
||||
"dap-repl",
|
||||
"fugitive",
|
||||
"git",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"TelescopePrompt",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
},
|
||||
exclude_buftypes = {
|
||||
"nofile",
|
||||
"prompt",
|
||||
"terminal",
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("hop", { keys = "etovxqpdygfblzhckisuran" })
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("local-highlight", {
|
||||
hlgroup = "IlluminatedWordText",
|
||||
insert_mode = false,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("persisted", {
|
||||
save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"),
|
||||
autostart = true,
|
||||
-- Set `lazy = false` in `plugins/editor.lua` to enable this
|
||||
autoload = false,
|
||||
follow_cwd = true,
|
||||
use_git_branch = true,
|
||||
should_save = function()
|
||||
return vim.bo.filetype == "alpha" and false or true
|
||||
end,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,53 @@
|
||||
return function()
|
||||
---@param threshold number @Use global strategy if nr of lines exceeds this value
|
||||
local function init_strategy(threshold)
|
||||
return function()
|
||||
-- Disable on very large files
|
||||
local line_count = vim.api.nvim_buf_line_count(0)
|
||||
if line_count > 7500 then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Disable on parser error
|
||||
local errors = 200
|
||||
vim.treesitter.get_parser():for_each_tree(function(lt)
|
||||
if lt:root():has_error() and errors >= 0 then
|
||||
errors = errors - 1
|
||||
end
|
||||
end)
|
||||
if errors < 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
return line_count > threshold and require("rainbow-delimiters").strategy["global"]
|
||||
or require("rainbow-delimiters").strategy["local"]
|
||||
end
|
||||
end
|
||||
|
||||
vim.g.rainbow_delimiters = {
|
||||
strategy = {
|
||||
[""] = init_strategy(500),
|
||||
c = init_strategy(300),
|
||||
cpp = init_strategy(300),
|
||||
lua = init_strategy(500),
|
||||
vimdoc = init_strategy(300),
|
||||
vim = init_strategy(300),
|
||||
},
|
||||
query = {
|
||||
[""] = "rainbow-delimiters",
|
||||
latex = "rainbow-blocks",
|
||||
javascript = "rainbow-delimiters-react",
|
||||
},
|
||||
highlight = {
|
||||
"RainbowDelimiterRed",
|
||||
"RainbowDelimiterOrange",
|
||||
"RainbowDelimiterYellow",
|
||||
"RainbowDelimiterGreen",
|
||||
"RainbowDelimiterBlue",
|
||||
"RainbowDelimiterCyan",
|
||||
"RainbowDelimiterViolet",
|
||||
},
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("rainbow_delimiters", nil, true)
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("smart-splits", {
|
||||
-- Ignored buffer types (only while resizing)
|
||||
ignored_buftypes = {
|
||||
"nofile",
|
||||
"quickfix",
|
||||
"prompt",
|
||||
},
|
||||
-- Ignored filetypes (only while resizing)
|
||||
ignored_filetypes = { "NvimTree" },
|
||||
-- the default number of lines/columns to resize by at a time
|
||||
default_amount = 3,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
return function()
|
||||
vim.g["suda#prompt"] = "Enter administrator password: "
|
||||
|
||||
require("modules.utils").load_plugin("suda", nil, true)
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
return vim.schedule_wrap(function()
|
||||
local use_ssh = require("core.settings").use_ssh
|
||||
|
||||
vim.api.nvim_set_option_value("foldmethod", "expr", {})
|
||||
vim.api.nvim_set_option_value("foldexpr", "nvim_treesitter#foldexpr()", {})
|
||||
|
||||
require("modules.utils").load_plugin("nvim-treesitter", {
|
||||
ensure_installed = require("core.settings").treesitter_deps,
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = function(ft, bufnr)
|
||||
if
|
||||
vim.tbl_contains({ "gitcommit" }, ft)
|
||||
or (vim.api.nvim_buf_line_count(bufnr) > 7500 and ft ~= "vimdoc")
|
||||
then
|
||||
return true
|
||||
end
|
||||
|
||||
local ok, is_large_file = pcall(vim.api.nvim_buf_get_var, bufnr, "bigfile_disable_treesitter")
|
||||
return ok and is_large_file
|
||||
end,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
goto_next_start = {
|
||||
["]["] = "@function.outer",
|
||||
["]m"] = "@class.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]]"] = "@function.outer",
|
||||
["]M"] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[["] = "@function.outer",
|
||||
["[m"] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[]"] = "@function.outer",
|
||||
["[M"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
indent = { enable = true },
|
||||
matchup = { enable = true },
|
||||
}, false, require("nvim-treesitter.configs").setup)
|
||||
require("nvim-treesitter.install").prefer_git = true
|
||||
if use_ssh then
|
||||
local parsers = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
for _, parser in pairs(parsers) do
|
||||
parser.install_info.url = parser.install_info.url:gsub("https://github.com/", "git@github.com:")
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,7 @@
|
||||
return function()
|
||||
vim.g.skip_ts_context_commentstring_module = true
|
||||
require("modules.utils").load_plugin("ts_context_commentstring", {
|
||||
-- Whether to update the `commentstring` on the `CursorHold` autocmd
|
||||
enable_autocmd = false,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("treesitter-context", {
|
||||
enable = true,
|
||||
max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
line_numbers = true,
|
||||
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
|
||||
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
zindex = 50, -- Ensure compatibility with Glance's preview window
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("bqf", {
|
||||
preview = {
|
||||
border = "single",
|
||||
wrap = true,
|
||||
winblend = 0,
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,126 @@
|
||||
local bind = require("keymap.bind")
|
||||
local map_callback = bind.map_callback
|
||||
|
||||
local crates = require("crates")
|
||||
local crates_keymap = {
|
||||
["n|<leader>ct"] = map_callback(function()
|
||||
crates.toggle()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Toggle spec activities"),
|
||||
["n|<leader>cr"] = map_callback(function()
|
||||
crates.reload()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Reload crate specs"),
|
||||
|
||||
["n|<leader>cs"] = map_callback(function()
|
||||
crates.show_popup()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Toggle pop-up window"),
|
||||
["n|<leader>cv"] = map_callback(function()
|
||||
crates.show_versions_popup()
|
||||
crates.show_popup()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Select spec versions"),
|
||||
["n|<leader>cf"] = map_callback(function()
|
||||
crates.show_features_popup()
|
||||
crates.show_popup()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Select spec features"),
|
||||
["n|<leader>cd"] = map_callback(function()
|
||||
crates.show_dependencies_popup()
|
||||
crates.show_popup()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Show project dependencies"),
|
||||
|
||||
["n|<leader>cu"] = map_callback(function()
|
||||
crates.update_crate()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Update current crate's spec"),
|
||||
["v|<leader>cu"] = map_callback(function()
|
||||
crates.update_crates()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Update selected crate's spec"),
|
||||
["n|<leader>ca"] = map_callback(function()
|
||||
crates.update_all_crates()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Update all crates' specs"),
|
||||
["n|<leader>cU"] = map_callback(function()
|
||||
crates.upgrade_crate()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Upgrade current crate"),
|
||||
["v|<leader>cU"] = map_callback(function()
|
||||
crates.upgrade_crates()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Upgrade selected crates"),
|
||||
["n|<leader>cA"] = map_callback(function()
|
||||
crates.upgrade_all_crates()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Upgrade all crates"),
|
||||
|
||||
["n|<leader>cH"] = map_callback(function()
|
||||
crates.open_homepage()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Open current crate's homepage"),
|
||||
["n|<leader>cR"] = map_callback(function()
|
||||
crates.open_repository()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Open current crate's repository"),
|
||||
["n|<leader>cD"] = map_callback(function()
|
||||
crates.open_documentation()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Open current crate's documentation"),
|
||||
["n|<leader>cC"] = map_callback(function()
|
||||
crates.open_crates_io()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_buffer(0)
|
||||
:with_desc("crates: Browse current crate on crates.io"),
|
||||
}
|
||||
|
||||
bind.nvim_load_mapping(crates_keymap)
|
||||
@@ -0,0 +1,89 @@
|
||||
return function()
|
||||
local icons = {
|
||||
diagnostics = require("modules.utils.icons").get("diagnostics", true),
|
||||
git = require("modules.utils.icons").get("git", true),
|
||||
misc = require("modules.utils.icons").get("misc", true),
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
kind = require("modules.utils.icons").get("kind", true),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("crates", {
|
||||
smart_insert = true,
|
||||
insert_closing_quote = true,
|
||||
avoid_prerelease = true,
|
||||
autoload = true,
|
||||
autoupdate = true,
|
||||
autoupdate_throttle = 250,
|
||||
loading_indicator = true,
|
||||
date_format = "%Y-%m-%d",
|
||||
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",
|
||||
prerelease = " " .. icons.diagnostics.Warning_alt .. "%s",
|
||||
yanked = " " .. icons.diagnostics.Error .. "%s",
|
||||
nomatch = " " .. icons.diagnostics.Question .. "No match",
|
||||
upgrade = " " .. icons.diagnostics.Hint_alt .. "%s",
|
||||
error = " " .. icons.diagnostics.Error .. "Error fetching crate",
|
||||
},
|
||||
popup = {
|
||||
autofocus = false,
|
||||
hide_on_select = true,
|
||||
copy_register = '"',
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
show_version_date = true,
|
||||
show_dependency_version = true,
|
||||
max_height = 30,
|
||||
min_width = 20,
|
||||
padding = 1,
|
||||
text = {
|
||||
title = icons.ui.Package .. "%s",
|
||||
description = "%s",
|
||||
created_label = icons.misc.Added .. "created" .. " ",
|
||||
created = "%s",
|
||||
updated_label = icons.misc.ManUp .. "updated" .. " ",
|
||||
updated = "%s",
|
||||
downloads_label = icons.ui.CloudDownload .. "downloads ",
|
||||
downloads = "%s",
|
||||
homepage_label = icons.misc.Campass .. "homepage ",
|
||||
homepage = "%s",
|
||||
repository_label = icons.git.Repo .. "repository ",
|
||||
repository = "%s",
|
||||
documentation_label = icons.diagnostics.Information_alt .. "documentation ",
|
||||
documentation = "%s",
|
||||
crates_io_label = icons.ui.Package .. "crates.io ",
|
||||
crates_io = "%s",
|
||||
categories_label = icons.kind.Class .. "categories ",
|
||||
keywords_label = icons.kind.Keyword .. "keywords ",
|
||||
version = " %s",
|
||||
prerelease = icons.diagnostics.Warning_alt .. "%s prerelease",
|
||||
yanked = icons.diagnostics.Error .. "%s yanked",
|
||||
version_date = " %s",
|
||||
feature = " %s",
|
||||
enabled = icons.ui.Play .. "%s",
|
||||
transitive = icons.ui.List .. "%s",
|
||||
normal_dependencies_title = icons.kind.Interface .. "Dependencies",
|
||||
build_dependencies_title = icons.misc.Gavel .. "Build dependencies",
|
||||
dev_dependencies_title = icons.misc.Glass .. "Dev dependencies",
|
||||
dependency = " %s",
|
||||
optional = icons.ui.BigUnfilledCircle .. "%s",
|
||||
dependency_version = " %s",
|
||||
loading = " " .. icons.misc.Watch,
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
insert_closing_quote = true,
|
||||
text = {
|
||||
prerelease = " " .. icons.diagnostics.Warning_alt .. "pre-release ",
|
||||
yanked = " " .. icons.diagnostics.Error_alt .. "yanked ",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Set buffer-local keymaps
|
||||
require("lang.crates-keymap")
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("go", {
|
||||
-- By default, we've turned off these options to prevent clashes with our gopls config
|
||||
icons = false,
|
||||
diagnostic = false,
|
||||
lsp_cfg = false,
|
||||
lsp_gofumpt = false,
|
||||
lsp_keymaps = false,
|
||||
lsp_codelens = false,
|
||||
lsp_document_formatting = false,
|
||||
lsp_inlay_hints = { enable = false },
|
||||
-- DAP-related settings are also turned off here for the same reason
|
||||
dap_debug = false,
|
||||
dap_debug_keymap = false,
|
||||
textobjects = false,
|
||||
-- Miscellaneous options to seamlessly integrate with other plugins
|
||||
trouble = true,
|
||||
luasnip = false,
|
||||
run_in_floaterm = false,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("render-markdown", {
|
||||
-- Whether Markdown should be rendered by default or not
|
||||
enabled = true,
|
||||
-- Maximum file size (in MB) that this plugin will attempt to render
|
||||
-- Any file larger than this will effectively be ignored
|
||||
max_file_size = 2.0,
|
||||
-- Milliseconds that must pass before updating marks, updates occur
|
||||
-- within the context of the visible window, not the entire buffer
|
||||
debounce = 100,
|
||||
-- Vim modes that will show a rendered view of the markdown file
|
||||
-- All other modes will be uneffected by this plugin
|
||||
render_modes = { "n", "c", "t" },
|
||||
-- This enables hiding any added text on the line the cursor is on
|
||||
-- This does have a performance penalty as we must listen to the 'CursorMoved' event
|
||||
anti_conceal = { enabled = true },
|
||||
-- The level of logs to write to file: vim.fn.stdpath('state') .. '/render-markdown.log'
|
||||
-- Only intended to be used for plugin development / debugging
|
||||
log_level = "error",
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
return function()
|
||||
vim.g.rustaceanvim = {
|
||||
-- Disable automatic DAP configuration to avoid conflicts with previous user configs
|
||||
dap = {
|
||||
adapter = false,
|
||||
configuration = false,
|
||||
autoload_configurations = false,
|
||||
},
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("rustaceanvim", nil, true)
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
-- https://github.com/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb)
|
||||
return function()
|
||||
local dap = require("dap")
|
||||
local utils = require("modules.utils.dap")
|
||||
local is_windows = require("core.global").is_windows
|
||||
|
||||
dap.adapters.codelldb = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = vim.fn.exepath("codelldb"), -- Find codelldb on $PATH
|
||||
args = { "--port", "${port}" },
|
||||
detached = is_windows and false or true,
|
||||
},
|
||||
}
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Debug",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = utils.input_exec_path(),
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
terminal = "integrated",
|
||||
},
|
||||
{
|
||||
name = "Debug (with args)",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = utils.input_exec_path(),
|
||||
args = utils.input_args(),
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
terminal = "integrated",
|
||||
},
|
||||
{
|
||||
name = "Attach to a running process",
|
||||
type = "codelldb",
|
||||
request = "attach",
|
||||
program = utils.input_exec_path(),
|
||||
stopOnEntry = false,
|
||||
waitFor = true,
|
||||
},
|
||||
}
|
||||
dap.configurations.cpp = dap.configurations.c
|
||||
dap.configurations.rust = dap.configurations.c
|
||||
end
|
||||
@@ -0,0 +1,100 @@
|
||||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#go
|
||||
-- https://github.com/golang/vscode-go/blob/master/docs/debugging.md
|
||||
return function()
|
||||
local dap = require("dap")
|
||||
local utils = require("modules.utils.dap")
|
||||
|
||||
if not require("mason-registry").is_installed("go-debug-adapter") then
|
||||
vim.notify(
|
||||
"Automatically installing `go-debug-adapter` for go debugging",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "nvim-dap" }
|
||||
)
|
||||
|
||||
local go_dbg = require("mason-registry").get_package("go-debug-adapter")
|
||||
go_dbg:install():once(
|
||||
"closed",
|
||||
vim.schedule_wrap(function()
|
||||
if go_dbg:is_installed() then
|
||||
vim.notify("Successfully installed `go-debug-adapter`", vim.log.levels.INFO, { title = "nvim-dap" })
|
||||
end
|
||||
end)
|
||||
)
|
||||
end
|
||||
|
||||
dap.adapters.go = {
|
||||
type = "executable",
|
||||
command = "node",
|
||||
args = {
|
||||
require("mason-registry").get_package("go-debug-adapter"):get_install_path()
|
||||
.. "/extension/dist/debugAdapter.js",
|
||||
},
|
||||
}
|
||||
dap.configurations.go = {
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug (file)",
|
||||
request = "launch",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = utils.input_file_path(),
|
||||
console = "integratedTerminal",
|
||||
dlvToolPath = vim.fn.exepath("dlv"),
|
||||
showLog = true,
|
||||
showRegisters = true,
|
||||
stopOnEntry = false,
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug (file with args)",
|
||||
request = "launch",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = utils.input_file_path(),
|
||||
args = utils.input_args(),
|
||||
console = "integratedTerminal",
|
||||
dlvToolPath = vim.fn.exepath("dlv"),
|
||||
showLog = true,
|
||||
showRegisters = true,
|
||||
stopOnEntry = false,
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug (executable)",
|
||||
request = "launch",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = utils.input_exec_path(),
|
||||
args = utils.input_args(),
|
||||
console = "integratedTerminal",
|
||||
dlvToolPath = vim.fn.exepath("dlv"),
|
||||
mode = "exec",
|
||||
showLog = true,
|
||||
showRegisters = true,
|
||||
stopOnEntry = false,
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug (test file)",
|
||||
request = "launch",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = utils.input_file_path(),
|
||||
console = "integratedTerminal",
|
||||
dlvToolPath = vim.fn.exepath("dlv"),
|
||||
mode = "test",
|
||||
showLog = true,
|
||||
showRegisters = true,
|
||||
stopOnEntry = false,
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug (using go.mod)",
|
||||
request = "launch",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = "./${relativeFileDirname}",
|
||||
console = "integratedTerminal",
|
||||
dlvToolPath = vim.fn.exepath("dlv"),
|
||||
mode = "test",
|
||||
showLog = true,
|
||||
showRegisters = true,
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-lldb-vscode
|
||||
return function()
|
||||
local dap = require("dap")
|
||||
local utils = require("modules.utils.dap")
|
||||
|
||||
dap.adapters.lldb = {
|
||||
type = "executable",
|
||||
command = vim.fn.exepath("lldb-vscode"), -- Find lldb-vscode on $PATH
|
||||
}
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = utils.input_exec_path(),
|
||||
cwd = "${workspaceFolder}",
|
||||
args = utils.input_args(),
|
||||
env = utils.get_env(),
|
||||
|
||||
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
||||
--
|
||||
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
||||
--
|
||||
-- Otherwise you might get the following error:
|
||||
--
|
||||
-- Error on launch: Failed to attach to the target process
|
||||
--
|
||||
-- But you should be aware of the implications:
|
||||
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
|
||||
runInTerminal = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = dap.configurations.c
|
||||
dap.configurations.rust = dap.configurations.c
|
||||
end
|
||||
@@ -0,0 +1,74 @@
|
||||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python
|
||||
-- https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
|
||||
return function()
|
||||
local dap = require("dap")
|
||||
local utils = require("modules.utils.dap")
|
||||
local is_windows = require("core.global").is_windows
|
||||
local debugpy_root = require("mason-registry").get_package("debugpy"):get_install_path()
|
||||
|
||||
dap.adapters.python = function(callback, config)
|
||||
if config.request == "attach" then
|
||||
local port = (config.connect or config).port
|
||||
local host = (config.connect or config).host or "127.0.0.1"
|
||||
callback({
|
||||
type = "server",
|
||||
port = assert(port, "`connect.port` is required for a python `attach` configuration"),
|
||||
host = host,
|
||||
options = { source_filetype = "python" },
|
||||
})
|
||||
else
|
||||
callback({
|
||||
type = "executable",
|
||||
command = is_windows and debugpy_root .. "/venv/Scripts/pythonw.exe"
|
||||
or debugpy_root .. "/venv/bin/python",
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
options = { source_filetype = "python" },
|
||||
})
|
||||
end
|
||||
end
|
||||
dap.configurations.python = {
|
||||
{
|
||||
-- The first three options are required by nvim-dap
|
||||
type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||
request = "launch",
|
||||
name = "Debug",
|
||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||
console = "integratedTerminal",
|
||||
program = utils.input_file_path(),
|
||||
pythonPath = function()
|
||||
local venv = vim.env.CONDA_PREFIX
|
||||
if venv then
|
||||
return is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python"
|
||||
else
|
||||
return is_windows and "pythonw.exe" or "python3"
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- NOTE: This setting is for people using venv
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Debug (using venv)",
|
||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||
console = "integratedTerminal",
|
||||
program = utils.input_file_path(),
|
||||
pythonPath = function()
|
||||
-- Prefer the venv that is defined by the designated environment variable.
|
||||
local cwd, venv = vim.fn.getcwd(), os.getenv("VIRTUAL_ENV")
|
||||
local python = venv and (is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python") or ""
|
||||
if vim.fn.executable(python) == 1 then
|
||||
return python
|
||||
end
|
||||
|
||||
-- Otherwise, fall back to check if there are any local venvs available.
|
||||
venv = vim.fn.isdirectory(cwd .. "/venv") == 1 and cwd .. "/venv" or cwd .. "/.venv"
|
||||
python = is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python"
|
||||
if vim.fn.executable(python) == 1 then
|
||||
return python
|
||||
else
|
||||
return is_windows and "pythonw.exe" or "python3"
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
local M = {}
|
||||
|
||||
local bind = require("keymap.bind")
|
||||
local map_cmd = bind.map_cmd
|
||||
|
||||
local did_load_debug_mappings = false
|
||||
local debug_keymap = {
|
||||
["nv|K"] = map_cmd("<Cmd>lua require('dapui').eval()<CR>")
|
||||
:with_noremap()
|
||||
:with_nowait()
|
||||
:with_desc("Evaluate expression under cursor"),
|
||||
}
|
||||
|
||||
function M.load_extras()
|
||||
if not did_load_debug_mappings then
|
||||
require("modules.utils.keymap").amend("Debugging", "_debugging", debug_keymap)
|
||||
did_load_debug_mappings = true
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,72 @@
|
||||
return function()
|
||||
local icons = {
|
||||
ui = require("modules.utils.icons").get("ui"),
|
||||
dap = require("modules.utils.icons").get("dap"),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("dapui", {
|
||||
force_buffers = true,
|
||||
icons = {
|
||||
expanded = icons.ui.ArrowOpen,
|
||||
collapsed = icons.ui.ArrowClosed,
|
||||
current_frame = icons.ui.Indicator,
|
||||
},
|
||||
mappings = {
|
||||
-- Use a table to apply multiple mappings
|
||||
edit = "e",
|
||||
expand = { "<CR>", "<2-LeftMouse>" },
|
||||
open = "o",
|
||||
remove = "d",
|
||||
repl = "r",
|
||||
toggle = "t",
|
||||
},
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
-- Provide as ID strings or tables with "id" and "size" keys
|
||||
{
|
||||
id = "scopes",
|
||||
size = 0.3, -- Can be float or integer > 1
|
||||
},
|
||||
{ id = "watches", size = 0.3 },
|
||||
{ id = "stacks", size = 0.3 },
|
||||
{ id = "breakpoints", size = 0.1 },
|
||||
},
|
||||
size = 0.3,
|
||||
position = "right",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
{ id = "console", size = 0.55 },
|
||||
{ id = "repl", size = 0.45 },
|
||||
},
|
||||
position = "bottom",
|
||||
size = 0.25,
|
||||
},
|
||||
},
|
||||
controls = {
|
||||
enabled = true,
|
||||
-- Display controls in this session
|
||||
element = "repl",
|
||||
icons = {
|
||||
pause = icons.dap.Pause,
|
||||
play = icons.dap.Play,
|
||||
step_into = icons.dap.StepInto,
|
||||
step_over = icons.dap.StepOver,
|
||||
step_out = icons.dap.StepOut,
|
||||
step_back = icons.dap.StepBack,
|
||||
run_last = icons.dap.RunLast,
|
||||
terminate = icons.dap.Terminate,
|
||||
},
|
||||
},
|
||||
floating = {
|
||||
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
||||
mappings = {
|
||||
close = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
render = { indent = 1, max_value_lines = 85 },
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,84 @@
|
||||
return function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
local mason_dap = require("mason-nvim-dap")
|
||||
|
||||
local icons = { dap = require("modules.utils.icons").get("dap") }
|
||||
local colors = require("modules.utils").get_palette()
|
||||
local mappings = require("tool.dap.dap-keymap")
|
||||
|
||||
-- Initialize debug hooks
|
||||
_G._debugging = false
|
||||
local function debug_init_cb()
|
||||
_G._debugging = true
|
||||
mappings.load_extras()
|
||||
dapui.open({ reset = true })
|
||||
end
|
||||
local function debug_terminate_cb()
|
||||
if _debugging then
|
||||
_G._debugging = false
|
||||
dapui.close()
|
||||
end
|
||||
end
|
||||
dap.listeners.after.event_initialized["dapui_config"] = debug_init_cb
|
||||
dap.listeners.before.event_terminated["dapui_config"] = debug_terminate_cb
|
||||
dap.listeners.before.event_exited["dapui_config"] = debug_terminate_cb
|
||||
dap.listeners.before.disconnect["dapui_config"] = debug_terminate_cb
|
||||
|
||||
-- We need to override nvim-dap's default highlight groups, AFTER requiring nvim-dap for catppuccin.
|
||||
vim.api.nvim_set_hl(0, "DapStopped", { fg = colors.green })
|
||||
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpoint",
|
||||
{ text = icons.dap.Breakpoint, texthl = "DapBreakpoint", linehl = "", numhl = "" }
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpointCondition",
|
||||
{ text = icons.dap.BreakpointCondition, texthl = "DapBreakpoint", linehl = "", numhl = "" }
|
||||
)
|
||||
vim.fn.sign_define("DapStopped", { text = icons.dap.Stopped, texthl = "DapStopped", linehl = "", numhl = "" })
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpointRejected",
|
||||
{ text = icons.dap.BreakpointRejected, texthl = "DapBreakpoint", linehl = "", numhl = "" }
|
||||
)
|
||||
vim.fn.sign_define("DapLogPoint", { text = icons.dap.LogPoint, texthl = "DapLogPoint", linehl = "", numhl = "" })
|
||||
|
||||
---A handler to setup all clients defined under `tool/dap/clients/*.lua`
|
||||
---@param config table
|
||||
local function mason_dap_handler(config)
|
||||
local dap_name = config.name
|
||||
local ok, custom_handler = pcall(require, "user.configs.dap-clients." .. dap_name)
|
||||
if not ok then
|
||||
-- Use preset if there is no user definition
|
||||
ok, custom_handler = pcall(require, "tool.dap.clients." .. dap_name)
|
||||
end
|
||||
if not ok then
|
||||
-- Default to use factory config for clients(s) that doesn't include a spec
|
||||
mason_dap.default_setup(config)
|
||||
return
|
||||
elseif type(custom_handler) == "function" then
|
||||
-- Case where the protocol requires its own setup
|
||||
-- Make sure to set
|
||||
-- * dap.adpaters.<dap_name> = { your config }
|
||||
-- * dap.configurations.<lang> = { your config }
|
||||
-- See `codelldb.lua` for a concrete example.
|
||||
custom_handler(config)
|
||||
else
|
||||
vim.notify(
|
||||
string.format(
|
||||
"Failed to setup [%s].\n\nClient definition under `tool/dap/clients` must return\na fun(opts) (got '%s' instead)",
|
||||
config.name,
|
||||
type(custom_handler)
|
||||
),
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "nvim-dap" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
require("modules.utils").load_plugin("mason-nvim-dap", {
|
||||
ensure_installed = require("core.settings").dap_deps,
|
||||
automatic_installation = true,
|
||||
handlers = { mason_dap_handler },
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,109 @@
|
||||
return function()
|
||||
local icons = {
|
||||
kind = require("modules.utils.icons").get("kind", true),
|
||||
type = require("modules.utils.icons").get("type", true),
|
||||
misc = require("modules.utils.icons").get("misc", true),
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("dropbar", {
|
||||
bar = {
|
||||
hover = false,
|
||||
truncate = true,
|
||||
pick = { pivots = "etovxqpdygfblzhckisuran" },
|
||||
},
|
||||
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)
|
||||
local term = select(2, require("toggleterm.terminal").identify(name))
|
||||
-- Trying to "snag" a display name from toggleterm
|
||||
if term then
|
||||
return term.display_name or term.name
|
||||
else
|
||||
return name
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
enable = true,
|
||||
kinds = {
|
||||
use_devicons = true,
|
||||
symbols = {
|
||||
-- Type
|
||||
Array = icons.type.Array,
|
||||
Boolean = icons.type.Boolean,
|
||||
Null = icons.type.Null,
|
||||
Number = icons.type.Number,
|
||||
Object = icons.type.Object,
|
||||
String = icons.type.String,
|
||||
Text = icons.type.String,
|
||||
|
||||
-- Kind
|
||||
BreakStatement = icons.kind.Break,
|
||||
Call = icons.kind.Call,
|
||||
CaseStatement = icons.kind.Case,
|
||||
Class = icons.kind.Class,
|
||||
Color = icons.kind.Color,
|
||||
Constant = icons.kind.Constant,
|
||||
Constructor = icons.kind.Constructor,
|
||||
ContinueStatement = icons.kind.Continue,
|
||||
Declaration = icons.kind.Declaration,
|
||||
Delete = icons.kind.Delete,
|
||||
DoStatement = icons.kind.Loop,
|
||||
Enum = icons.kind.Enum,
|
||||
EnumMember = icons.kind.EnumMember,
|
||||
Event = icons.kind.Event,
|
||||
Field = icons.kind.Field,
|
||||
File = icons.kind.File,
|
||||
ForStatement = icons.kind.Loop,
|
||||
Function = icons.kind.Function,
|
||||
Identifier = icons.kind.Variable,
|
||||
Interface = icons.kind.Interface,
|
||||
Keyword = icons.kind.Keyword,
|
||||
List = icons.kind.List,
|
||||
Lsp = icons.misc.LspAvailable,
|
||||
Method = icons.kind.Method,
|
||||
Module = icons.kind.Module,
|
||||
Namespace = icons.kind.Namespace,
|
||||
Operator = icons.kind.Operator,
|
||||
Package = icons.kind.Package,
|
||||
Pair = icons.kind.List,
|
||||
Property = icons.kind.Property,
|
||||
Reference = icons.kind.Reference,
|
||||
Regex = icons.kind.Regex,
|
||||
Repeat = icons.kind.Loop,
|
||||
Scope = icons.kind.Statement,
|
||||
Snippet = icons.kind.Snippet,
|
||||
Statement = icons.kind.Statement,
|
||||
Struct = icons.kind.Struct,
|
||||
SwitchStatement = icons.kind.Switch,
|
||||
Type = icons.kind.Interface,
|
||||
TypeParameter = icons.kind.TypeParameter,
|
||||
Unit = icons.kind.Unit,
|
||||
Value = icons.kind.Value,
|
||||
Variable = icons.kind.Variable,
|
||||
WhileStatement = icons.kind.Loop,
|
||||
|
||||
-- Microsoft-specific icons
|
||||
Folder = icons.kind.Folder,
|
||||
|
||||
-- ccls-specific icons
|
||||
Macro = icons.kind.Macro,
|
||||
Terminal = icons.kind.Terminal,
|
||||
},
|
||||
},
|
||||
ui = {
|
||||
bar = { separator = " " },
|
||||
menu = { indicator = icons.ui.ArrowClosed },
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("fcitx5", {
|
||||
msg = nil, -- string | nil: printed when startup is completed
|
||||
imname = { -- fcitx5.Imname | nil: imnames on each mode set as prior. See `:h map-table` for more in-depth information.
|
||||
norm = nil, -- string | nil: imname to set in normal mode. if nil, will restore the mode on exit.
|
||||
ins = nil,
|
||||
cmd = nil,
|
||||
vis = nil,
|
||||
sel = nil,
|
||||
opr = nil,
|
||||
term = nil,
|
||||
lang = nil,
|
||||
},
|
||||
remember_prior = true, -- boolean: if true, it remembers the mode on exit and restore it when entering the mode again.
|
||||
-- if false, uses what was set in config.
|
||||
define_autocmd = true, -- boolean: if true, defines autocmd at `ModeChanged` to switch fcitx5 mode.
|
||||
log = "warn", -- string: log level (default: warn)
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,201 @@
|
||||
return function()
|
||||
local icons = {
|
||||
diagnostics = require("modules.utils.icons").get("diagnostics"),
|
||||
documents = require("modules.utils.icons").get("documents"),
|
||||
git = require("modules.utils.icons").get("git"),
|
||||
ui = require("modules.utils.icons").get("ui"),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("nvim-tree", {
|
||||
auto_reload_on_write = true,
|
||||
create_in_closed_folder = false,
|
||||
disable_netrw = false,
|
||||
hijack_cursor = true,
|
||||
hijack_netrw = true,
|
||||
hijack_unnamed_buffer_when_opening = true,
|
||||
open_on_tab = false,
|
||||
respect_buf_cwd = false,
|
||||
sort_by = "name",
|
||||
sync_root_with_cwd = true,
|
||||
on_attach = function(bufnr)
|
||||
require("nvim-tree.api").config.mappings.default_on_attach(bufnr)
|
||||
vim.keymap.del("n", "<C-e>", { buffer = bufnr })
|
||||
end,
|
||||
view = {
|
||||
adaptive_size = false,
|
||||
centralize_selection = false,
|
||||
width = 30,
|
||||
side = "left",
|
||||
preserve_window_proportions = false,
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
signcolumn = "yes",
|
||||
float = {
|
||||
enable = false,
|
||||
open_win_config = {
|
||||
relative = "editor",
|
||||
border = "rounded",
|
||||
width = 30,
|
||||
height = 30,
|
||||
row = 1,
|
||||
col = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
add_trailing = false,
|
||||
group_empty = true,
|
||||
highlight_git = true,
|
||||
full_name = false,
|
||||
highlight_opened_files = "none",
|
||||
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md", "CMakeLists.txt" },
|
||||
symlink_destination = true,
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
icons = {
|
||||
corner = "└ ",
|
||||
edge = "│ ",
|
||||
item = "│ ",
|
||||
none = " ",
|
||||
},
|
||||
},
|
||||
root_folder_label = ":.:s?.*?/..?",
|
||||
icons = {
|
||||
webdev_colors = true,
|
||||
git_placement = "after",
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true,
|
||||
},
|
||||
padding = " ",
|
||||
symlink_arrow = " ",
|
||||
glyphs = {
|
||||
default = icons.documents.Default, --
|
||||
symlink = icons.documents.Symlink, --
|
||||
bookmark = icons.ui.Bookmark,
|
||||
git = {
|
||||
unstaged = icons.git.Mod_alt,
|
||||
staged = icons.git.Add, --
|
||||
unmerged = icons.git.Unmerged,
|
||||
renamed = icons.git.Rename, --
|
||||
untracked = icons.git.Untracked, -- ""
|
||||
deleted = icons.git.Remove, --
|
||||
ignored = icons.git.Ignore, --◌
|
||||
},
|
||||
folder = {
|
||||
arrow_open = icons.ui.ArrowOpen,
|
||||
arrow_closed = icons.ui.ArrowClosed,
|
||||
-- arrow_open = "",
|
||||
-- arrow_closed = "",
|
||||
default = icons.ui.Folder,
|
||||
open = icons.ui.FolderOpen,
|
||||
empty = icons.ui.EmptyFolder,
|
||||
empty_open = icons.ui.EmptyFolderOpen,
|
||||
symlink = icons.ui.SymlinkFolder,
|
||||
symlink_open = icons.ui.FolderOpen,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = true,
|
||||
ignore_list = {},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = { ".DS_Store" },
|
||||
exclude = {},
|
||||
},
|
||||
actions = {
|
||||
use_system_clipboard = true,
|
||||
change_dir = {
|
||||
enable = true,
|
||||
global = false,
|
||||
},
|
||||
open_file = {
|
||||
quit_on_open = false,
|
||||
resize_window = false,
|
||||
window_picker = {
|
||||
enable = true,
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||
exclude = {
|
||||
buftype = {
|
||||
"help",
|
||||
"nofile",
|
||||
"prompt",
|
||||
"quickfix",
|
||||
"terminal",
|
||||
},
|
||||
filetype = {
|
||||
"dap-repl",
|
||||
"diff",
|
||||
"fugitive",
|
||||
"fugitiveblame",
|
||||
"git",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"qf",
|
||||
"TelescopePrompt",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
remove_file = {
|
||||
close_window = true,
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
show_on_dirs = false,
|
||||
debounce_delay = 50,
|
||||
icons = {
|
||||
hint = icons.diagnostics.Hint_alt,
|
||||
info = icons.diagnostics.Information_alt,
|
||||
warning = icons.diagnostics.Warning_alt,
|
||||
error = icons.diagnostics.Error_alt,
|
||||
},
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true,
|
||||
debounce_delay = 50,
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = false,
|
||||
show_on_dirs = true,
|
||||
timeout = 400,
|
||||
},
|
||||
trash = {
|
||||
cmd = "gio trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
live_filter = {
|
||||
prefix = "[FILTER]: ",
|
||||
always_show_folders = true,
|
||||
},
|
||||
log = {
|
||||
enable = false,
|
||||
truncate = false,
|
||||
types = {
|
||||
all = false,
|
||||
config = false,
|
||||
copy_paste = false,
|
||||
dev = false,
|
||||
diagnostics = false,
|
||||
git = false,
|
||||
profile = false,
|
||||
watcher = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("project_nvim", {
|
||||
manual_mode = false,
|
||||
detection_methods = { "lsp", "pattern" },
|
||||
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
|
||||
ignore_lsp = { "null-ls", "copilot" },
|
||||
exclude_dirs = {},
|
||||
show_hidden = false,
|
||||
silent_chdir = true,
|
||||
scope_chdir = "global",
|
||||
datapath = vim.fn.stdpath("data"),
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,141 @@
|
||||
return function()
|
||||
local builtin = require("telescope.builtin")
|
||||
local extensions = require("telescope").extensions
|
||||
|
||||
require("modules.utils").load_plugin("search", {
|
||||
collections = {
|
||||
-- Search using filenames
|
||||
file = {
|
||||
initial_tab = 1,
|
||||
tabs = {
|
||||
{
|
||||
name = "Files",
|
||||
tele_func = function(opts)
|
||||
opts = opts or {}
|
||||
if vim.fn.isdirectory(".git") == 1 then
|
||||
builtin.git_files(opts)
|
||||
else
|
||||
builtin.find_files(opts)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Frecency",
|
||||
tele_func = function()
|
||||
extensions.frecency.frecency()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Oldfiles",
|
||||
tele_func = function()
|
||||
builtin.oldfiles()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Buffers",
|
||||
tele_func = function()
|
||||
builtin.buffers()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Search using patterns
|
||||
pattern = {
|
||||
initial_tab = 1,
|
||||
tabs = {
|
||||
{
|
||||
name = "Word in project",
|
||||
tele_func = function()
|
||||
extensions.live_grep_args.live_grep_args()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Word under cursor",
|
||||
tele_func = function(opts)
|
||||
opts = opts or {}
|
||||
builtin.grep_string(opts)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Search Git objects (branches, commits)
|
||||
git = {
|
||||
initial_tab = 1,
|
||||
tabs = {
|
||||
{
|
||||
name = "Branches",
|
||||
tele_func = function()
|
||||
builtin.git_branches()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Commits",
|
||||
tele_func = function()
|
||||
builtin.git_commits()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Commit content",
|
||||
tele_func = function()
|
||||
extensions.advanced_git_search.search_log_content()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Diff current file with commit",
|
||||
tele_func = function()
|
||||
extensions.advanced_git_search.diff_commit_file()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Retrieve dossiers
|
||||
dossier = {
|
||||
initial_tab = 1,
|
||||
tabs = {
|
||||
{
|
||||
name = "Sessions",
|
||||
tele_func = function()
|
||||
extensions.persisted.persisted()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Projects",
|
||||
tele_func = function()
|
||||
extensions.projects.projects({})
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Zoxide",
|
||||
tele_func = function()
|
||||
extensions.zoxide.list()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Miscellaneous
|
||||
misc = {
|
||||
initial_tab = 1,
|
||||
tabs = {
|
||||
{
|
||||
name = "Colorschemes",
|
||||
tele_func = function()
|
||||
builtin.colorscheme({ enable_preview = true })
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Notify",
|
||||
tele_func = function()
|
||||
extensions.notify.notify()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Undo History",
|
||||
tele_func = function()
|
||||
extensions.undo.undo()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("smartyank", {
|
||||
highlight = {
|
||||
enabled = false, -- highlight yanked text
|
||||
higroup = "IncSearch", -- highlight group of yanked text
|
||||
timeout = 2000, -- timeout for clearing the highlight
|
||||
},
|
||||
clipboard = {
|
||||
enabled = true,
|
||||
},
|
||||
tmux = {
|
||||
enabled = true,
|
||||
-- remove `-w` to disable copy to host client's clipboard
|
||||
cmd = { "tmux", "set-buffer", "-w" },
|
||||
},
|
||||
osc52 = {
|
||||
enabled = true,
|
||||
escseq = "tmux", -- use tmux escape sequence, only enable if you're using remote tmux and have issues (see #4)
|
||||
ssh_only = true, -- false to OSC52 yank also in local sessions
|
||||
silent = false, -- true to disable the "n chars copied" echo
|
||||
echo_hl = "Directory", -- highlight group of the OSC52 echo message
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("sniprun", {
|
||||
selected_interpreters = {}, -- " use those instead of the default for the current filetype
|
||||
repl_enable = {}, -- " enable REPL-like behavior for the given interpreters
|
||||
repl_disable = {}, -- " disable REPL-like behavior for the given interpreters
|
||||
interpreter_options = {}, -- " intepreter-specific options, consult docs / :SnipInfo <name>
|
||||
-- " you can combo different display modes as desired
|
||||
display = {
|
||||
"TempFloatingWindowOk", -- display ok results in the floating window
|
||||
"NvimNotifyErr", -- display err results with the nvim-notify plugin
|
||||
-- "Classic", -- display results in the command line"
|
||||
-- "VirtualText", -- display results in virtual text"
|
||||
-- "LongTempFloatingWindow", -- display results in the long floating window
|
||||
-- "Terminal" -- display results in a vertical split
|
||||
-- "TerminalWithCode" -- display results and code history in a vertical split
|
||||
},
|
||||
display_options = {
|
||||
terminal_width = 45,
|
||||
notification_timeout = 5000,
|
||||
},
|
||||
-- " miscellaneous compatibility/adjustement settings
|
||||
inline_messages = 0, -- " inline_message (0/1) is a one-line way to display messages
|
||||
-- " to workaround sniprun not being able to display anything
|
||||
borders = "single", -- " display borders around floating windows
|
||||
-- " possible values are 'none', 'single', 'double', or 'shadow'
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,102 @@
|
||||
return function()
|
||||
local icons = { ui = require("modules.utils.icons").get("ui", true) }
|
||||
local lga_actions = require("telescope-live-grep-args.actions")
|
||||
|
||||
require("modules.utils").load_plugin("telescope", {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
initial_mode = "insert",
|
||||
prompt_prefix = " " .. icons.ui.Telescope .. " ",
|
||||
selection_caret = icons.ui.ChevronRight,
|
||||
scroll_strategy = "limit",
|
||||
results_title = false,
|
||||
layout_strategy = "horizontal",
|
||||
path_display = { "absolute" },
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "ascending",
|
||||
color_devicons = true,
|
||||
file_ignore_patterns = { ".git/", ".cache", "build/", "%.class", "%.pdf", "%.mkv", "%.mp4", "%.zip" },
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = {
|
||||
mirror = false,
|
||||
},
|
||||
width = 0.85,
|
||||
height = 0.92,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
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,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
},
|
||||
frecency = {
|
||||
show_scores = true,
|
||||
show_unindexed = true,
|
||||
ignore_patterns = { "*.git/*", "*/tmp/*" },
|
||||
},
|
||||
live_grep_args = {
|
||||
auto_quoting = true, -- enable/disable auto-quoting
|
||||
mappings = { -- extend mappings
|
||||
i = {
|
||||
["<C-k>"] = lga_actions.quote_prompt(),
|
||||
["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob " }),
|
||||
},
|
||||
},
|
||||
},
|
||||
undo = {
|
||||
side_by_side = true,
|
||||
mappings = {
|
||||
i = {
|
||||
["<cr>"] = require("telescope-undo.actions").yank_additions,
|
||||
["<S-cr>"] = require("telescope-undo.actions").yank_deletions,
|
||||
["<C-cr>"] = require("telescope-undo.actions").restore,
|
||||
},
|
||||
},
|
||||
},
|
||||
advanced_git_search = {
|
||||
diff_plugin = "diffview",
|
||||
git_flags = { "-c", "delta.side-by-side=true" },
|
||||
entry_default_author_or_date = "author", -- one of "author" or "date"
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("telescope").load_extension("frecency")
|
||||
require("telescope").load_extension("fzf")
|
||||
require("telescope").load_extension("live_grep_args")
|
||||
require("telescope").load_extension("notify")
|
||||
require("telescope").load_extension("projects")
|
||||
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
|
||||
@@ -0,0 +1,51 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("toggleterm", {
|
||||
-- size can be a number or function which is passed the current terminal
|
||||
size = function(term)
|
||||
if term.direction == "horizontal" then
|
||||
return vim.o.lines * 0.30
|
||||
elseif term.direction == "vertical" then
|
||||
return vim.o.columns * 0.40
|
||||
end
|
||||
end,
|
||||
on_open = function(term)
|
||||
-- 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 = {
|
||||
link = "Normal",
|
||||
},
|
||||
NormalFloat = {
|
||||
link = "NormalFloat",
|
||||
},
|
||||
FloatBorder = {
|
||||
link = "FloatBorder",
|
||||
},
|
||||
},
|
||||
open_mapping = false, -- [[<c-\>]],
|
||||
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||
shade_filetypes = {},
|
||||
shade_terminals = false,
|
||||
shading_factor = "1", -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
|
||||
start_in_insert = true,
|
||||
persist_mode = false,
|
||||
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||
persist_size = true,
|
||||
direction = "horizontal",
|
||||
close_on_exit = true, -- close the terminal window when the process exits
|
||||
shell = vim.o.shell, -- change the default shell
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,38 @@
|
||||
return function()
|
||||
local icons = {
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("trouble", {
|
||||
auto_open = false,
|
||||
auto_close = false,
|
||||
auto_jump = false,
|
||||
auto_preview = true,
|
||||
auto_refresh = true,
|
||||
focus = false, -- do not focus the window when opened
|
||||
follow = true,
|
||||
restore = true,
|
||||
icons = {
|
||||
indent = {
|
||||
fold_open = icons.ui.ArrowOpen,
|
||||
fold_closed = icons.ui.ArrowClosed,
|
||||
},
|
||||
folder_closed = icons.ui.Folder,
|
||||
folder_open = icons.ui.FolderOpen,
|
||||
},
|
||||
modes = {
|
||||
project_diagnostics = {
|
||||
mode = "diagnostics",
|
||||
filter = {
|
||||
any = {
|
||||
{
|
||||
function(item)
|
||||
return item.filename:find(vim.fn.getcwd(), 1, true)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,75 @@
|
||||
return function()
|
||||
local icons = {
|
||||
ui = require("modules.utils.icons").get("ui"),
|
||||
misc = require("modules.utils.icons").get("misc"),
|
||||
git = require("modules.utils.icons").get("git", true),
|
||||
cmp = require("modules.utils.icons").get("cmp", true),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("which-key", {
|
||||
preset = "classic",
|
||||
delay = vim.o.timeoutlen,
|
||||
triggers = {
|
||||
{ "<auto>", mode = "nixso" },
|
||||
},
|
||||
plugins = {
|
||||
marks = true,
|
||||
registers = true,
|
||||
spelling = {
|
||||
enabled = true,
|
||||
suggestions = 20,
|
||||
},
|
||||
presets = {
|
||||
motions = false,
|
||||
operators = false,
|
||||
text_objects = true,
|
||||
windows = true,
|
||||
nav = true,
|
||||
z = true,
|
||||
g = true,
|
||||
},
|
||||
},
|
||||
win = {
|
||||
border = "none",
|
||||
padding = { 1, 2 },
|
||||
wo = { winblend = 0 },
|
||||
},
|
||||
expand = 1,
|
||||
icons = {
|
||||
group = "",
|
||||
rules = false,
|
||||
colors = false,
|
||||
breadcrumb = icons.ui.Separator,
|
||||
separator = icons.misc.Vbar,
|
||||
keys = {
|
||||
C = "C-",
|
||||
M = "A-",
|
||||
S = "S-",
|
||||
BS = "<BS> ",
|
||||
CR = "<CR> ",
|
||||
NL = "<NL> ",
|
||||
Esc = "<Esc> ",
|
||||
Tab = "<Tab> ",
|
||||
Up = "<Up> ",
|
||||
Down = "<Down> ",
|
||||
Left = "<Left> ",
|
||||
Right = "<Right> ",
|
||||
Space = "<Space> ",
|
||||
ScrollWheelUp = "<ScrollWheelUp> ",
|
||||
ScrollWheelDown = "<ScrollWheelDown> ",
|
||||
},
|
||||
},
|
||||
spec = {
|
||||
{ "<leader>g", group = icons.git.Git .. "Git" },
|
||||
{ "<leader>d", group = icons.ui.Bug .. " Debug" },
|
||||
{ "<leader>s", group = icons.cmp.tmux .. "Session" },
|
||||
{ "<leader>b", group = icons.ui.Buffer .. " Buffer" },
|
||||
{ "<leader>S", group = icons.ui.Search .. " Search" },
|
||||
{ "<leader>W", group = icons.ui.Window .. " Window" },
|
||||
{ "<leader>p", group = icons.ui.Package .. " Package" },
|
||||
{ "<leader>l", group = icons.misc.LspAvailable .. " Lsp" },
|
||||
{ "<leader>f", group = icons.ui.Telescope .. " Fuzzy Find" },
|
||||
{ "<leader>n", group = icons.ui.FolderOpen .. " Nvim Tree" },
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,65 @@
|
||||
return function()
|
||||
local wilder = require("wilder")
|
||||
local icons = { ui = require("modules.utils.icons").get("ui") }
|
||||
|
||||
wilder.set_option("use_python_remote_plugin", 0)
|
||||
wilder.set_option("pipeline", {
|
||||
wilder.branch(
|
||||
wilder.cmdline_pipeline({ use_python = 0, fuzzy = 1, fuzzy_filter = wilder.lua_fzy_filter() }),
|
||||
wilder.vim_search_pipeline(),
|
||||
{
|
||||
wilder.check(function(_, x)
|
||||
return x == ""
|
||||
end),
|
||||
wilder.history(),
|
||||
wilder.result({
|
||||
draw = {
|
||||
function(_, x)
|
||||
return icons.ui.Calendar .. " " .. x
|
||||
end,
|
||||
},
|
||||
}),
|
||||
}
|
||||
),
|
||||
})
|
||||
|
||||
local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_border_theme({
|
||||
border = "rounded",
|
||||
highlights = {
|
||||
default = "Pmenu",
|
||||
border = "PmenuBorder", -- highlight to use for the border
|
||||
accent = wilder.make_hl("WilderAccent", "CmpItemAbbr", "CmpItemAbbrMatch"),
|
||||
},
|
||||
empty_message = wilder.popupmenu_empty_message_with_spinner(),
|
||||
highlighter = wilder.lua_fzy_highlighter(),
|
||||
left = {
|
||||
" ",
|
||||
wilder.popupmenu_devicons(),
|
||||
wilder.popupmenu_buffer_flags({
|
||||
flags = " a + ",
|
||||
icons = { ["+"] = icons.ui.Pencil, a = icons.ui.Indicator, h = icons.ui.File },
|
||||
}),
|
||||
},
|
||||
right = {
|
||||
" ",
|
||||
wilder.popupmenu_scrollbar(),
|
||||
},
|
||||
}))
|
||||
local wildmenu_renderer = wilder.wildmenu_renderer({
|
||||
apply_incsearch_fix = false,
|
||||
highlighter = wilder.lua_fzy_highlighter(),
|
||||
separator = " | ",
|
||||
left = { " ", wilder.wildmenu_spinner(), " " },
|
||||
right = { " ", wilder.wildmenu_index() },
|
||||
})
|
||||
wilder.set_option(
|
||||
"renderer",
|
||||
wilder.renderer_mux({
|
||||
[":"] = popupmenu_renderer,
|
||||
["/"] = wildmenu_renderer,
|
||||
substitute = wildmenu_renderer,
|
||||
})
|
||||
)
|
||||
|
||||
require("modules.utils").load_plugin("wilder", { modes = { ":", "/", "?" } })
|
||||
end
|
||||
@@ -0,0 +1,138 @@
|
||||
return function()
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
require("modules.utils").gen_alpha_hl()
|
||||
|
||||
dashboard.section.header.val = require("core.settings").dashboard_image
|
||||
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||
|
||||
local function button(sc, txt, leader_txt, keybind, keybind_opts)
|
||||
local sc_after = sc:gsub("%s", ""):gsub(leader_txt, "<leader>")
|
||||
|
||||
local opts = {
|
||||
position = "center",
|
||||
shortcut = sc,
|
||||
cursor = 5,
|
||||
width = 50,
|
||||
align_shortcut = "right",
|
||||
hl = "AlphaButtons",
|
||||
hl_shortcut = "AlphaShortcut",
|
||||
}
|
||||
|
||||
if nil == keybind then
|
||||
keybind = sc_after
|
||||
end
|
||||
keybind_opts = vim.F.if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
|
||||
opts.keymap = { "n", sc_after, keybind, keybind_opts }
|
||||
|
||||
local function on_press()
|
||||
-- local key = vim.api.nvim_replace_termcodes(keybind .. '<Ignore>', true, false, true)
|
||||
local key = vim.api.nvim_replace_termcodes(sc_after .. "<Ignore>", true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "t", false)
|
||||
end
|
||||
|
||||
return {
|
||||
type = "button",
|
||||
val = txt,
|
||||
on_press = on_press,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
local leader = " "
|
||||
local icons = {
|
||||
documents = require("modules.utils.icons").get("documents", true),
|
||||
git = require("modules.utils.icons").get("git", true),
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
misc = require("modules.utils.icons").get("misc", true),
|
||||
}
|
||||
|
||||
dashboard.section.buttons.val = {
|
||||
button(
|
||||
"space f c",
|
||||
icons.misc.Neovim .. "Telescope collections",
|
||||
leader,
|
||||
nil,
|
||||
{ noremap = true, silent = true, nowait = true }
|
||||
),
|
||||
button(
|
||||
"space f f",
|
||||
icons.documents.FileFind .. "Find files",
|
||||
leader,
|
||||
nil,
|
||||
{ noremap = true, silent = true, nowait = true }
|
||||
),
|
||||
button(
|
||||
"space f d",
|
||||
icons.ui.FolderWithHeart .. "Retrieve dossiers",
|
||||
leader,
|
||||
nil,
|
||||
{ noremap = true, silent = true, nowait = true }
|
||||
),
|
||||
button(
|
||||
"space f p",
|
||||
icons.documents.Word .. "Find patterns",
|
||||
leader,
|
||||
nil,
|
||||
{ noremap = true, silent = true, nowait = true }
|
||||
),
|
||||
button(
|
||||
"space f g",
|
||||
icons.git.Git .. "Locate Git objects",
|
||||
leader,
|
||||
nil,
|
||||
{ noremap = true, silent = true, nowait = true }
|
||||
),
|
||||
button(
|
||||
"space f m",
|
||||
icons.misc.Ghost .. "Miscellaneous artifacts",
|
||||
leader,
|
||||
nil,
|
||||
{ noremap = true, silent = true, nowait = true }
|
||||
),
|
||||
}
|
||||
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||
|
||||
local function footer()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return " Have Fun with neovim"
|
||||
.. " v"
|
||||
.. vim.version().major
|
||||
.. "."
|
||||
.. vim.version().minor
|
||||
.. "."
|
||||
.. vim.version().patch
|
||||
.. " "
|
||||
.. stats.count
|
||||
.. " plugins in "
|
||||
.. ms
|
||||
.. "ms"
|
||||
end
|
||||
|
||||
dashboard.section.footer.val = footer()
|
||||
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||
|
||||
local head_butt_padding = 2
|
||||
local occu_height = #dashboard.section.header.val + 2 * #dashboard.section.buttons.val + head_butt_padding
|
||||
local header_padding = math.max(0, math.ceil((vim.fn.winheight(0) - occu_height) * 0.25))
|
||||
local foot_butt_padding = 1
|
||||
|
||||
dashboard.config.layout = {
|
||||
{ type = "padding", val = header_padding },
|
||||
dashboard.section.header,
|
||||
{ type = "padding", val = head_butt_padding },
|
||||
dashboard.section.buttons,
|
||||
{ type = "padding", val = foot_butt_padding },
|
||||
dashboard.section.footer,
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("alpha", dashboard.opts)
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimStarted",
|
||||
callback = function()
|
||||
dashboard.section.footer.val = footer()
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,73 @@
|
||||
return function()
|
||||
local icons = { ui = require("modules.utils.icons").get("ui") }
|
||||
|
||||
local opts = {
|
||||
options = {
|
||||
number = nil,
|
||||
close_command = "BufDel! %d",
|
||||
right_mouse_command = "BufDel! %d",
|
||||
modified_icon = icons.ui.Modified,
|
||||
buffer_close_icon = icons.ui.Close,
|
||||
left_trunc_marker = icons.ui.Left,
|
||||
right_trunc_marker = icons.ui.Right,
|
||||
max_name_length = 20,
|
||||
max_prefix_length = 13,
|
||||
tab_size = 20,
|
||||
color_icons = true,
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
enforce_regular_tabs = false,
|
||||
persist_buffer_sort = true,
|
||||
always_show_bufferline = true,
|
||||
separator_style = "thin",
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count)
|
||||
return "(" .. count .. ")"
|
||||
end,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",
|
||||
text_align = "center",
|
||||
padding = 0,
|
||||
},
|
||||
{
|
||||
filetype = "aerial",
|
||||
text = "Symbol Outline",
|
||||
text_align = "center",
|
||||
padding = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Change bufferline's highlights here! See `:h bufferline-highlights` for detailed explanation.
|
||||
-- Note: If you use catppuccin then modify the colors below!
|
||||
highlights = {},
|
||||
}
|
||||
|
||||
if vim.g.colors_name:find("catppuccin") then
|
||||
local cp = require("modules.utils").get_palette() -- Get the palette.
|
||||
|
||||
local catppuccin_hl_overwrite = {
|
||||
highlights = require("catppuccin.groups.integrations.bufferline").get({
|
||||
styles = { "italic", "bold" },
|
||||
custom = {
|
||||
all = {
|
||||
-- Hint
|
||||
hint = { fg = cp.rosewater },
|
||||
hint_visible = { fg = cp.rosewater },
|
||||
hint_selected = { fg = cp.rosewater },
|
||||
hint_diagnostic = { fg = cp.rosewater },
|
||||
hint_diagnostic_visible = { fg = cp.rosewater },
|
||||
hint_diagnostic_selected = { fg = cp.rosewater },
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
|
||||
opts = vim.tbl_deep_extend("force", opts, catppuccin_hl_overwrite)
|
||||
end
|
||||
|
||||
require("modules.utils").load_plugin("bufferline", opts)
|
||||
end
|
||||
@@ -0,0 +1,183 @@
|
||||
return function()
|
||||
local transparent_background = require("core.settings").transparent_background
|
||||
local clear = {}
|
||||
|
||||
require("modules.utils").load_plugin("catppuccin", {
|
||||
background = { light = "latte", dark = "mocha" }, -- latte, frappe, macchiato, mocha
|
||||
dim_inactive = {
|
||||
enabled = false,
|
||||
-- Dim inactive splits/windows/buffers.
|
||||
-- NOT recommended if you use old palette (a.k.a., mocha).
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
transparent_background = transparent_background,
|
||||
show_end_of_buffer = false, -- show the '~' characters after the end of buffers
|
||||
term_colors = true,
|
||||
compile_path = vim.fn.stdpath("cache") .. "/catppuccin",
|
||||
styles = {
|
||||
comments = { "italic" },
|
||||
functions = { "bold" },
|
||||
keywords = { "italic" },
|
||||
operators = { "bold" },
|
||||
conditionals = { "bold" },
|
||||
loops = { "bold" },
|
||||
booleans = { "bold", "italic" },
|
||||
numbers = {},
|
||||
types = {},
|
||||
strings = {},
|
||||
variables = {},
|
||||
properties = {},
|
||||
},
|
||||
integrations = {
|
||||
treesitter = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = { "italic" },
|
||||
hints = { "italic" },
|
||||
warnings = { "italic" },
|
||||
information = { "italic" },
|
||||
},
|
||||
underlines = {
|
||||
errors = { "underline" },
|
||||
hints = { "underline" },
|
||||
warnings = { "underline" },
|
||||
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_context = true,
|
||||
ts_rainbow = false,
|
||||
vim_sneak = false,
|
||||
vimwiki = false,
|
||||
which_key = true,
|
||||
},
|
||||
color_overrides = {},
|
||||
highlight_overrides = {
|
||||
---@param cp palette
|
||||
all = function(cp)
|
||||
return {
|
||||
-- For base configs
|
||||
NormalFloat = { fg = cp.text, bg = transparent_background and cp.none or cp.mantle },
|
||||
FloatBorder = {
|
||||
fg = transparent_background and cp.blue or cp.mantle,
|
||||
bg = transparent_background and cp.none or cp.mantle,
|
||||
},
|
||||
CursorLineNr = { fg = cp.green },
|
||||
|
||||
-- For native lsp configs
|
||||
DiagnosticVirtualTextError = { bg = cp.none },
|
||||
DiagnosticVirtualTextWarn = { bg = cp.none },
|
||||
DiagnosticVirtualTextInfo = { bg = cp.none },
|
||||
DiagnosticVirtualTextHint = { bg = cp.none },
|
||||
LspInfoBorder = { link = "FloatBorder" },
|
||||
|
||||
-- For mason.nvim
|
||||
MasonNormal = { link = "NormalFloat" },
|
||||
|
||||
-- For indent-blankline
|
||||
IblIndent = { fg = cp.surface0 },
|
||||
IblScope = { fg = cp.surface2, style = { "bold" } },
|
||||
|
||||
-- For nvim-cmp and wilder.nvim
|
||||
Pmenu = { fg = cp.overlay2, bg = transparent_background and cp.none or cp.base },
|
||||
PmenuBorder = { fg = cp.surface1, bg = transparent_background and cp.none or cp.base },
|
||||
PmenuSel = { bg = cp.green, fg = cp.base },
|
||||
CmpItemAbbr = { fg = cp.overlay2 },
|
||||
CmpItemAbbrMatch = { fg = cp.blue, style = { "bold" } },
|
||||
CmpDoc = { link = "NormalFloat" },
|
||||
CmpDocBorder = {
|
||||
fg = transparent_background and cp.surface1 or cp.mantle,
|
||||
bg = transparent_background and cp.none or cp.mantle,
|
||||
},
|
||||
|
||||
-- For fidget
|
||||
FidgetTask = { bg = cp.none, fg = cp.surface2 },
|
||||
FidgetTitle = { fg = cp.blue, style = { "bold" } },
|
||||
|
||||
-- For nvim-notify
|
||||
NotifyBackground = { bg = cp.base },
|
||||
|
||||
-- For nvim-tree
|
||||
NvimTreeRootFolder = { fg = cp.pink },
|
||||
NvimTreeIndentMarker = { fg = cp.surface2 },
|
||||
|
||||
-- For trouble.nvim
|
||||
TroubleNormal = { bg = transparent_background and cp.none or cp.base },
|
||||
TroubleNormalNC = { bg = transparent_background and cp.none or cp.base },
|
||||
|
||||
-- For telescope.nvim
|
||||
TelescopeMatching = { fg = cp.lavender },
|
||||
TelescopeResultsDiffAdd = { fg = cp.green },
|
||||
TelescopeResultsDiffChange = { fg = cp.yellow },
|
||||
TelescopeResultsDiffDelete = { fg = cp.red },
|
||||
|
||||
-- For glance.nvim
|
||||
GlanceWinBarFilename = { fg = cp.subtext1, style = { "bold" } },
|
||||
GlanceWinBarFilepath = { fg = cp.subtext0, style = { "italic" } },
|
||||
GlanceWinBarTitle = { fg = cp.teal, style = { "bold" } },
|
||||
GlanceListCount = { fg = cp.lavender },
|
||||
GlanceListFilepath = { link = "Comment" },
|
||||
GlanceListFilename = { fg = cp.blue },
|
||||
GlanceListMatch = { fg = cp.lavender, style = { "bold" } },
|
||||
GlanceFoldIcon = { fg = cp.green },
|
||||
|
||||
-- For nvim-treehopper
|
||||
TSNodeKey = {
|
||||
fg = cp.peach,
|
||||
bg = transparent_background and cp.none or cp.base,
|
||||
style = { "bold", "underline" },
|
||||
},
|
||||
|
||||
-- For treesitter
|
||||
["@keyword.return"] = { fg = cp.pink, style = clear },
|
||||
["@error.c"] = { fg = cp.none, style = clear },
|
||||
["@error.cpp"] = { fg = cp.none, style = clear },
|
||||
}
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
return function()
|
||||
local icons = {
|
||||
ui = require("modules.utils.icons").get("ui"),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("fidget", {
|
||||
progress = {
|
||||
suppress_on_insert = false, -- Suppress new messages while in insert mode
|
||||
ignore_done_already = false, -- Ignore new tasks that are already complete
|
||||
ignore = { "null-ls" }, -- List of LSP servers to ignore
|
||||
display = {
|
||||
render_limit = 5, -- How many LSP messages to show at once
|
||||
done_ttl = 2, -- How long a message should persist after completion
|
||||
done_icon = icons.ui.Accepted, -- Icon shown when all LSP progress tasks are complete
|
||||
},
|
||||
},
|
||||
notification = {
|
||||
override_vim_notify = false, -- Automatically override vim.notify() with Fidget
|
||||
window = {
|
||||
winblend = 0, -- Background color opacity in the notification window
|
||||
zindex = 75, -- Stacking priority of the notification window
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
return function()
|
||||
local mapping = require("keymap.ui")
|
||||
require("modules.utils").load_plugin("gitsigns", {
|
||||
signs = {
|
||||
add = { text = "┃" },
|
||||
change = { text = "┃" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "┆" },
|
||||
},
|
||||
auto_attach = true,
|
||||
on_attach = mapping.gitsigns,
|
||||
signcolumn = true,
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
word_diff = false,
|
||||
current_line_blame = true,
|
||||
diff_opts = { internal = true },
|
||||
watch_gitdir = { follow_files = true },
|
||||
current_line_blame_opts = { delay = 1000, virt_text = true, virtual_text_pos = "eol" },
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,578 @@
|
||||
return function()
|
||||
-- This list delineates the per-language nodes used for guiding |ibl| in highlighting the current scope
|
||||
-- It is extracted from each language's `indents.scm` file
|
||||
-- NOTE: Only a subset of the supported programming languages is included
|
||||
-- If your preferred language isn't listed, you can add it to the user config
|
||||
local nodes = {
|
||||
bibtex = {
|
||||
"entry",
|
||||
},
|
||||
c = {
|
||||
"case_statement",
|
||||
"compound_literal_expression",
|
||||
"enumerator_list",
|
||||
"field_declaration_list",
|
||||
"initializer_list",
|
||||
"init_declarator",
|
||||
},
|
||||
cmake = {
|
||||
"block_def",
|
||||
"foreach_loop",
|
||||
"function_def",
|
||||
"if_condition",
|
||||
"macro_def",
|
||||
"normal_command",
|
||||
"while_loop",
|
||||
},
|
||||
cpp = {
|
||||
"case_statement",
|
||||
"compound_literal_expression",
|
||||
"condition_clause",
|
||||
"enumerator_list",
|
||||
"field_declaration_list",
|
||||
"field_initializer_list",
|
||||
"init_declarator",
|
||||
"initializer_list",
|
||||
"namespace_definition",
|
||||
},
|
||||
css = {
|
||||
"block",
|
||||
"declaration",
|
||||
},
|
||||
d = {
|
||||
"aggregate_body",
|
||||
"block_statement",
|
||||
"case_statement",
|
||||
"expression_statement",
|
||||
"function_body",
|
||||
"parameters",
|
||||
"scope_statement",
|
||||
"template_parameters",
|
||||
},
|
||||
dart = {
|
||||
"arguments",
|
||||
"class_body",
|
||||
"formal_parameter",
|
||||
"formal_parameter_list",
|
||||
"function_body",
|
||||
"function_expression_body",
|
||||
"initializers",
|
||||
"list_literal",
|
||||
"return_statement",
|
||||
"switch_block",
|
||||
},
|
||||
dot = {
|
||||
"block",
|
||||
"attr_list",
|
||||
},
|
||||
ecma = {
|
||||
"arguments",
|
||||
"array",
|
||||
"binary_expression",
|
||||
"call_expression",
|
||||
"class_body",
|
||||
"export_clause",
|
||||
"formal_parameters",
|
||||
"named_imports",
|
||||
"object",
|
||||
"object_pattern",
|
||||
"parenthesized_expression",
|
||||
"return_statement",
|
||||
"switch_case",
|
||||
"switch_default",
|
||||
"switch_statement",
|
||||
"template_substitution",
|
||||
"ternary_expression",
|
||||
},
|
||||
elixir = {
|
||||
"arguments",
|
||||
"block",
|
||||
"do_block",
|
||||
"list",
|
||||
"map",
|
||||
"tuple",
|
||||
},
|
||||
firrtl = {
|
||||
"memory",
|
||||
},
|
||||
fortran = {
|
||||
"derived_type_definition",
|
||||
"do_loop_statement",
|
||||
"enum",
|
||||
"function",
|
||||
"if_statement",
|
||||
"module",
|
||||
"program",
|
||||
"subroutine",
|
||||
"where_statement",
|
||||
},
|
||||
gleam = {
|
||||
"anonymous_function",
|
||||
"assert",
|
||||
"case",
|
||||
"constant",
|
||||
"external_function",
|
||||
"function",
|
||||
"import",
|
||||
"let",
|
||||
"list",
|
||||
"constant",
|
||||
"function",
|
||||
"type_definition",
|
||||
"type_alias",
|
||||
"todo",
|
||||
"tuple",
|
||||
},
|
||||
go = {
|
||||
"call_expression",
|
||||
"communication_case",
|
||||
"const_declaration",
|
||||
"default_case",
|
||||
"expression_case",
|
||||
"import_declaration",
|
||||
"literal_value",
|
||||
"parameter_list",
|
||||
"struct_type",
|
||||
"type_case",
|
||||
"type_declaration",
|
||||
"var_declaration",
|
||||
},
|
||||
html = {
|
||||
"start_tag",
|
||||
"self_closing_tag",
|
||||
},
|
||||
java = {
|
||||
"annotation_argument_list",
|
||||
"annotation_type_body",
|
||||
"argument_list",
|
||||
"array_initializer",
|
||||
"class_body",
|
||||
"constructor_body",
|
||||
"element_value_array_initializer",
|
||||
"enum_body",
|
||||
"formal_parameters",
|
||||
"interface_body",
|
||||
"method_invocation",
|
||||
"switch_block",
|
||||
},
|
||||
javascript = {
|
||||
"arguments",
|
||||
"array",
|
||||
"binary_expression",
|
||||
"call_expression",
|
||||
"class_body",
|
||||
"export_clause",
|
||||
"formal_parameters",
|
||||
"jsx_expression",
|
||||
"jsx_self_closing_element",
|
||||
"named_imports",
|
||||
"object",
|
||||
"object_pattern",
|
||||
"parenthesized_expression",
|
||||
"return_statement",
|
||||
"switch_case",
|
||||
"switch_default",
|
||||
"switch_statement",
|
||||
"template_substitution",
|
||||
"ternary_expression",
|
||||
},
|
||||
julia = {
|
||||
"assignment",
|
||||
"call_expression",
|
||||
"compound_statement",
|
||||
"comprehension_expression",
|
||||
"for_binding",
|
||||
"if_statement",
|
||||
"matrix_expression",
|
||||
"parenthesized_expression",
|
||||
"struct_definition",
|
||||
"tuple_expression",
|
||||
"vector_expression",
|
||||
},
|
||||
just = {
|
||||
"external_command",
|
||||
"recipe",
|
||||
"string",
|
||||
},
|
||||
linkerscript = {
|
||||
"memory_command",
|
||||
"output_section",
|
||||
"phdrs_command",
|
||||
"sections_command",
|
||||
},
|
||||
lua = {
|
||||
"arguments",
|
||||
"field",
|
||||
"method_index_expression",
|
||||
"return_statement",
|
||||
"table_constructor",
|
||||
},
|
||||
matlab = {
|
||||
"class_definition",
|
||||
"enumeration",
|
||||
"events",
|
||||
"for_statement",
|
||||
"if_statement",
|
||||
"methods",
|
||||
"properties",
|
||||
"switch_statement",
|
||||
"try_statement",
|
||||
"while_statement",
|
||||
},
|
||||
ninja = {
|
||||
"build",
|
||||
"pool",
|
||||
"rule",
|
||||
},
|
||||
ocaml = {
|
||||
"application_expression",
|
||||
"do_clause",
|
||||
"external",
|
||||
"field_expression",
|
||||
"if_expression",
|
||||
"list_expression",
|
||||
"parenthesized_expression",
|
||||
"record_declaration",
|
||||
"record_expression",
|
||||
"try_expression",
|
||||
"type_binding",
|
||||
"value_specification",
|
||||
},
|
||||
pascal = {
|
||||
"arrInitializer",
|
||||
"block",
|
||||
"declArgs",
|
||||
"declClass",
|
||||
"declConsts",
|
||||
"declProc",
|
||||
"declTypes",
|
||||
"declUses",
|
||||
"declVars",
|
||||
"defaultValue",
|
||||
"exprArgs",
|
||||
"exprBrackets",
|
||||
"exprParens",
|
||||
"exprSubscript",
|
||||
"recInitializer",
|
||||
"statement",
|
||||
},
|
||||
php = {
|
||||
"arguments",
|
||||
"array_creation_expression",
|
||||
"binary_expression",
|
||||
"case_statement",
|
||||
"compound_statement",
|
||||
"declaration_list",
|
||||
"default_statement",
|
||||
"enum_declaration_list",
|
||||
"formal_parameters",
|
||||
"match_block",
|
||||
"member_call_expression",
|
||||
"parenthesized_expression",
|
||||
"return_statement",
|
||||
"switch_block",
|
||||
},
|
||||
python = {
|
||||
"binary_operator",
|
||||
"case_clause",
|
||||
"concatenated_string",
|
||||
"for_statement",
|
||||
"generator_expression",
|
||||
"if_statement",
|
||||
"import_from_statement",
|
||||
"lambda",
|
||||
"list_pattern",
|
||||
"match_statement",
|
||||
"parenthesized_expression",
|
||||
"try_statement",
|
||||
"tuple_pattern",
|
||||
"while_statement",
|
||||
"with_statement",
|
||||
},
|
||||
query = {
|
||||
"list",
|
||||
"predicate",
|
||||
},
|
||||
r = {
|
||||
"brace_list",
|
||||
"call",
|
||||
"paren_list",
|
||||
"pipe",
|
||||
"special",
|
||||
},
|
||||
readline = {
|
||||
"conditional_construct",
|
||||
},
|
||||
ruby = {
|
||||
"argument_list",
|
||||
"array",
|
||||
"assignment",
|
||||
"begin",
|
||||
"call",
|
||||
"case",
|
||||
"for",
|
||||
"hash",
|
||||
"if",
|
||||
"module",
|
||||
"parenthesized_statements",
|
||||
"singleton_class",
|
||||
"singleton_method",
|
||||
"unless",
|
||||
"until",
|
||||
"while",
|
||||
},
|
||||
rust = {
|
||||
"arguments",
|
||||
"array_expression",
|
||||
"assignment_expression",
|
||||
"call_expression",
|
||||
"enum_variant_list",
|
||||
"field_declaration_list",
|
||||
"macro_definition",
|
||||
"match_block",
|
||||
"mod_item",
|
||||
"ordered_field_declaration_list",
|
||||
"parameters",
|
||||
"struct_expression",
|
||||
"struct_pattern",
|
||||
"token_repetition",
|
||||
"token_tree",
|
||||
"trait_item",
|
||||
"tuple_expression",
|
||||
"tuple_pattern",
|
||||
"tuple_struct_pattern",
|
||||
"tuple_type",
|
||||
"use_list",
|
||||
"where_clause",
|
||||
},
|
||||
scss = {
|
||||
"block",
|
||||
"declaration",
|
||||
"each_statement",
|
||||
"mixin_statement",
|
||||
"while_statement",
|
||||
},
|
||||
sql = {
|
||||
"case",
|
||||
"column_definitions",
|
||||
"cte",
|
||||
"insert",
|
||||
"select",
|
||||
"subquery",
|
||||
"when_clause",
|
||||
},
|
||||
ssh_config = {
|
||||
"host_declaration",
|
||||
"match_declaration",
|
||||
},
|
||||
swift = {
|
||||
"array_literal",
|
||||
"array_type",
|
||||
"assignment",
|
||||
"call_expression",
|
||||
"class_body",
|
||||
"computed_getter",
|
||||
"computed_property",
|
||||
"computed_setter",
|
||||
"control_transfer_statement",
|
||||
"deinit_declaration",
|
||||
"dictionary_literal",
|
||||
"dictionary_type",
|
||||
"didset_clause",
|
||||
"enum_class_body",
|
||||
"init_declaration",
|
||||
"lambda_literal",
|
||||
"protocol_body",
|
||||
"subscript_declaration",
|
||||
"tuple_expression",
|
||||
"tuple_type",
|
||||
"type_parameters",
|
||||
"willset_clause",
|
||||
"willset_didset_block",
|
||||
},
|
||||
tablegen = {
|
||||
"assert",
|
||||
"value_suffix",
|
||||
},
|
||||
tcl = {
|
||||
"braced_word_simple",
|
||||
"command",
|
||||
"command_substitution",
|
||||
"conditional",
|
||||
"foreach",
|
||||
"namespace",
|
||||
"procedure",
|
||||
"try",
|
||||
"while",
|
||||
},
|
||||
teal = {
|
||||
"record_declaration",
|
||||
"function_body",
|
||||
"table_constructor",
|
||||
"return_statement",
|
||||
"while_statement",
|
||||
},
|
||||
terraform = {
|
||||
"block",
|
||||
"function_call",
|
||||
"object",
|
||||
"tuple",
|
||||
},
|
||||
textproto = {
|
||||
"message_list",
|
||||
"message_value",
|
||||
"scalar_list",
|
||||
},
|
||||
toml = {
|
||||
"array",
|
||||
"inline_table",
|
||||
},
|
||||
typescript = {
|
||||
"arguments",
|
||||
"array",
|
||||
"binary_expression",
|
||||
"call_expression",
|
||||
"class_body",
|
||||
"enum_declaration",
|
||||
"export_clause",
|
||||
"formal_parameters",
|
||||
"interface_declaration",
|
||||
"named_imports",
|
||||
"object",
|
||||
"object_pattern",
|
||||
"object_type",
|
||||
"parenthesized_expression",
|
||||
"return_statement",
|
||||
"switch_case",
|
||||
"switch_default",
|
||||
"switch_statement",
|
||||
"template_substitution",
|
||||
"ternary_expression",
|
||||
},
|
||||
vue = {
|
||||
"start_tag",
|
||||
},
|
||||
xml = {
|
||||
"element",
|
||||
},
|
||||
zig = {
|
||||
"Block",
|
||||
"ContainerDecl",
|
||||
"InitList",
|
||||
"SwitchExpr",
|
||||
},
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("ibl", {
|
||||
enabled = true,
|
||||
debounce = 200,
|
||||
indent = {
|
||||
char = "│",
|
||||
tab_char = "│",
|
||||
smart_indent_cap = true,
|
||||
priority = 2,
|
||||
},
|
||||
whitespace = { remove_blankline_trail = true },
|
||||
-- Note: The `scope` field requires treesitter to be set up
|
||||
scope = {
|
||||
enabled = true,
|
||||
char = "┃",
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
injected_languages = true,
|
||||
priority = 1000,
|
||||
include = {
|
||||
node_type = {
|
||||
angular = nodes.html,
|
||||
arduino = nodes.cpp,
|
||||
astro = nodes.html,
|
||||
bibtex = nodes.bibtex,
|
||||
c = nodes.c,
|
||||
cmake = nodes.cmake,
|
||||
cpp = nodes.cpp,
|
||||
css = nodes.css,
|
||||
cuda = nodes.cpp,
|
||||
d = nodes.d,
|
||||
dart = nodes.dart,
|
||||
dot = nodes.dot,
|
||||
ecma = nodes.ecma,
|
||||
elixir = nodes.elixir,
|
||||
firrtl = nodes.firrtl,
|
||||
fortran = nodes.fortran,
|
||||
glsl = nodes.c,
|
||||
gleam = nodes.gleam,
|
||||
go = nodes.go,
|
||||
hlsl = nodes.cpp,
|
||||
html = nodes.html,
|
||||
java = nodes.java,
|
||||
javascript = nodes.javascript,
|
||||
julia = nodes.julia,
|
||||
just = nodes.just,
|
||||
linkerscript = nodes.linkerscript,
|
||||
lua = nodes.lua,
|
||||
luau = nodes.lua,
|
||||
matlab = nodes.matlab,
|
||||
ninja = nodes.ninja,
|
||||
objc = nodes.c,
|
||||
ocaml = nodes.ocaml,
|
||||
ocaml_interface = nodes.ocaml,
|
||||
pascal = nodes.pascal,
|
||||
php = nodes.php,
|
||||
python = nodes.python,
|
||||
query = nodes.query,
|
||||
r = nodes.r,
|
||||
readline = nodes.readline,
|
||||
ruby = nodes.ruby,
|
||||
rust = nodes.rust,
|
||||
scss = nodes.scss,
|
||||
sql = nodes.sql,
|
||||
ssh_config = nodes.ssh_config,
|
||||
swift = nodes.swift,
|
||||
tablegen = nodes.tablegen,
|
||||
tcl = nodes.tcl,
|
||||
teal = nodes.teal,
|
||||
terraform = nodes.terraform,
|
||||
textproto = nodes.textproto,
|
||||
toml = nodes.toml,
|
||||
typescript = nodes.typescript,
|
||||
vue = nodes.vue,
|
||||
xml = nodes.xml,
|
||||
zig = nodes.zig,
|
||||
},
|
||||
},
|
||||
},
|
||||
exclude = {
|
||||
buftypes = {
|
||||
"help",
|
||||
"nofile",
|
||||
"prompt",
|
||||
"quickfix",
|
||||
"terminal",
|
||||
},
|
||||
filetypes = {
|
||||
"", -- for all buffers without a file type
|
||||
"alpha",
|
||||
"bigfile",
|
||||
"checkhealth",
|
||||
"dap-repl",
|
||||
"diff",
|
||||
"fugitive",
|
||||
"fugitiveblame",
|
||||
"git",
|
||||
"gitcommit",
|
||||
"help",
|
||||
"log",
|
||||
"markdown",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"qf",
|
||||
"TelescopePrompt",
|
||||
"text",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
"vimwiki",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,348 @@
|
||||
return function()
|
||||
local has_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
|
||||
local colors = require("modules.utils").get_palette()
|
||||
local icons = {
|
||||
diagnostics = require("modules.utils.icons").get("diagnostics", true),
|
||||
git = require("modules.utils.icons").get("git", true),
|
||||
git_nosep = require("modules.utils.icons").get("git"),
|
||||
misc = require("modules.utils.icons").get("misc", true),
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
}
|
||||
|
||||
local function custom_theme()
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
group = vim.api.nvim_create_augroup("LualineColorScheme", { clear = true }),
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
has_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
|
||||
require("lualine").setup({ options = { theme = custom_theme() } })
|
||||
end,
|
||||
})
|
||||
|
||||
if has_catppuccin then
|
||||
colors = require("modules.utils").get_palette()
|
||||
local universal_bg = require("core.settings").transparent_background and "NONE" or colors.mantle
|
||||
return {
|
||||
normal = {
|
||||
a = { fg = colors.lavender, bg = colors.surface0, gui = "bold" },
|
||||
b = { fg = colors.text, bg = universal_bg },
|
||||
c = { fg = colors.text, bg = universal_bg },
|
||||
},
|
||||
command = {
|
||||
a = { fg = colors.peach, bg = colors.surface0, gui = "bold" },
|
||||
},
|
||||
insert = {
|
||||
a = { fg = colors.green, bg = colors.surface0, gui = "bold" },
|
||||
},
|
||||
visual = {
|
||||
a = { fg = colors.flamingo, bg = colors.surface0, gui = "bold" },
|
||||
},
|
||||
terminal = {
|
||||
a = { fg = colors.teal, bg = colors.surface0, gui = "bold" },
|
||||
},
|
||||
replace = {
|
||||
a = { fg = colors.red, bg = colors.surface0, gui = "bold" },
|
||||
},
|
||||
inactive = {
|
||||
a = { fg = colors.subtext0, bg = universal_bg, gui = "bold" },
|
||||
b = { fg = colors.subtext0, bg = universal_bg },
|
||||
c = { fg = colors.subtext0, bg = universal_bg },
|
||||
},
|
||||
}
|
||||
else
|
||||
return "auto"
|
||||
end
|
||||
end
|
||||
|
||||
local conditionals = {
|
||||
has_enough_room = function()
|
||||
return vim.o.columns > 100
|
||||
end,
|
||||
has_comp_before = function()
|
||||
return vim.bo.filetype ~= ""
|
||||
end,
|
||||
has_git = function()
|
||||
local gitdir = vim.fs.find(".git", {
|
||||
limit = 1,
|
||||
upward = true,
|
||||
type = "directory",
|
||||
path = vim.fn.expand("%:p:h"),
|
||||
})
|
||||
return #gitdir > 0
|
||||
end,
|
||||
}
|
||||
|
||||
---@class lualine_hlgrp
|
||||
---@field fg string
|
||||
---@field bg string
|
||||
---@field gui string?
|
||||
local utils = {
|
||||
force_centering = function()
|
||||
return "%="
|
||||
end,
|
||||
abbreviate_path = function(path)
|
||||
local home = require("core.global").home
|
||||
if path:find(home, 1, true) == 1 then
|
||||
path = "~" .. path:sub(#home + 1)
|
||||
end
|
||||
return path
|
||||
end,
|
||||
---Generate <func>`color` for any component
|
||||
---@param fg string @Foreground hl group
|
||||
---@param gen_bg boolean @Generate guibg from hl group |StatusLine|?
|
||||
---@param special_nobg boolean @Disable guibg for transparent backgrounds?
|
||||
---@param bg string? @Background hl group
|
||||
---@param gui string? @GUI highlight arguments
|
||||
---@return nil|fun():lualine_hlgrp
|
||||
gen_hl = function(fg, gen_bg, special_nobg, bg, gui)
|
||||
if has_catppuccin then
|
||||
return function()
|
||||
local guifg = colors[fg]
|
||||
local guibg = gen_bg and require("modules.utils").hl_to_rgb("StatusLine", true, colors.mantle)
|
||||
or colors[bg]
|
||||
local nobg = special_nobg and require("core.settings").transparent_background
|
||||
return {
|
||||
fg = guifg and guifg or colors.none,
|
||||
bg = (guibg and not nobg) and guibg or colors.none,
|
||||
gui = gui and gui or nil,
|
||||
}
|
||||
end
|
||||
else
|
||||
-- Return `nil` if the theme is user-defined
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
local function diff_source()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local components = {
|
||||
separator = { -- use as section separators
|
||||
function()
|
||||
return "│"
|
||||
end,
|
||||
padding = 0,
|
||||
color = utils.gen_hl("surface1", true, true),
|
||||
separator = { left = "", right = "" },
|
||||
},
|
||||
|
||||
file_status = {
|
||||
function()
|
||||
local function is_new_file()
|
||||
local filename = vim.fn.expand("%")
|
||||
return filename ~= "" and vim.bo.buftype == "" and vim.fn.filereadable(filename) == 0
|
||||
end
|
||||
|
||||
local symbols = {}
|
||||
if vim.bo.modified then
|
||||
table.insert(symbols, "[+]")
|
||||
end
|
||||
if vim.bo.modifiable == false then
|
||||
table.insert(symbols, "[-]")
|
||||
end
|
||||
if vim.bo.readonly == true then
|
||||
table.insert(symbols, "[RO]")
|
||||
end
|
||||
if is_new_file() then
|
||||
table.insert(symbols, "[New]")
|
||||
end
|
||||
return #symbols > 0 and table.concat(symbols, "") or ""
|
||||
end,
|
||||
padding = { left = -1, right = 1 },
|
||||
cond = conditionals.has_comp_before,
|
||||
},
|
||||
|
||||
lsp = {
|
||||
function()
|
||||
local buf_ft = vim.bo.filetype
|
||||
local clients = vim.lsp.get_clients({ buffer = vim.api.nvim_get_current_buf() })
|
||||
local lsp_lists = {}
|
||||
local available_servers = {}
|
||||
if next(clients) == nil then
|
||||
return icons.misc.NoActiveLsp -- No server available
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
local client_name = client.name
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
-- Avoid adding servers that already exists.
|
||||
if not lsp_lists[client_name] then
|
||||
lsp_lists[client_name] = true
|
||||
table.insert(available_servers, client_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
return next(available_servers) == nil and icons.misc.NoActiveLsp
|
||||
or string.format("%s[%s]", icons.misc.LspAvailable, table.concat(available_servers, ", "))
|
||||
end,
|
||||
color = utils.gen_hl("blue", true, true, nil, "bold"),
|
||||
cond = conditionals.has_enough_room,
|
||||
},
|
||||
|
||||
python_venv = {
|
||||
function()
|
||||
local function env_cleanup(venv)
|
||||
if string.find(venv, "/") then
|
||||
local final_venv = venv
|
||||
for w in venv:gmatch("([^/]+)") do
|
||||
final_venv = w
|
||||
end
|
||||
venv = final_venv
|
||||
end
|
||||
return venv
|
||||
end
|
||||
|
||||
if vim.bo.filetype == "python" then
|
||||
local venv = os.getenv("CONDA_DEFAULT_ENV")
|
||||
if venv then
|
||||
return icons.misc.PyEnv .. env_cleanup(venv)
|
||||
end
|
||||
venv = os.getenv("VIRTUAL_ENV")
|
||||
if venv then
|
||||
return icons.misc.PyEnv .. env_cleanup(venv)
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
color = utils.gen_hl("green", true, true),
|
||||
cond = conditionals.has_enough_room,
|
||||
},
|
||||
|
||||
tabwidth = {
|
||||
function()
|
||||
return icons.ui.Tab .. vim.bo.tabstop
|
||||
end,
|
||||
padding = 1,
|
||||
},
|
||||
|
||||
cwd = {
|
||||
function()
|
||||
return icons.ui.FolderWithHeart .. utils.abbreviate_path(vim.fs.normalize(vim.fn.getcwd()))
|
||||
end,
|
||||
color = utils.gen_hl("subtext0", true, true, nil, "bold"),
|
||||
},
|
||||
|
||||
file_location = {
|
||||
function()
|
||||
local cursorline = vim.fn.line(".")
|
||||
local cursorcol = vim.fn.virtcol(".")
|
||||
local filelines = vim.fn.line("$")
|
||||
local position
|
||||
if cursorline == 1 then
|
||||
position = "Top"
|
||||
elseif cursorline == filelines then
|
||||
position = "Bot"
|
||||
else
|
||||
position = string.format("%2d%%%%", math.floor(cursorline / filelines * 100))
|
||||
end
|
||||
return string.format("%s · %3d:%-2d", position, cursorline, cursorcol)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("lualine", {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = custom_theme(),
|
||||
disabled_filetypes = { statusline = { "alpha" } },
|
||||
component_separators = "",
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
{
|
||||
"filetype",
|
||||
colored = true,
|
||||
icon_only = false,
|
||||
icon = { align = "left" },
|
||||
},
|
||||
components.file_status,
|
||||
vim.tbl_extend("force", components.separator, {
|
||||
cond = function()
|
||||
return conditionals.has_git() and conditionals.has_comp_before()
|
||||
end,
|
||||
}),
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"branch",
|
||||
icon = icons.git_nosep.Branch,
|
||||
color = utils.gen_hl("subtext0", true, true, nil, "bold"),
|
||||
cond = conditionals.has_git,
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = icons.git.Add,
|
||||
modified = icons.git.Mod_alt,
|
||||
removed = icons.git.Remove,
|
||||
},
|
||||
source = diff_source,
|
||||
colored = false,
|
||||
color = utils.gen_hl("subtext0", true, true),
|
||||
cond = conditionals.has_git,
|
||||
padding = { right = 1 },
|
||||
},
|
||||
|
||||
{ utils.force_centering },
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
sections = { "error", "warn", "info", "hint" },
|
||||
symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warn = icons.diagnostics.Warning,
|
||||
info = icons.diagnostics.Information,
|
||||
hint = icons.diagnostics.Hint_alt,
|
||||
},
|
||||
},
|
||||
components.lsp,
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
"encoding",
|
||||
show_bomb = true,
|
||||
fmt = string.upper,
|
||||
padding = { left = 1 },
|
||||
cond = conditionals.has_enough_room,
|
||||
},
|
||||
{
|
||||
"fileformat",
|
||||
symbols = {
|
||||
unix = "LF",
|
||||
dos = "CRLF",
|
||||
mac = "CR", -- Legacy macOS
|
||||
},
|
||||
padding = { left = 1 },
|
||||
},
|
||||
components.tabwidth,
|
||||
},
|
||||
lualine_y = {
|
||||
components.separator,
|
||||
components.python_venv,
|
||||
components.cwd,
|
||||
},
|
||||
lualine_z = { components.file_location },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
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
|
||||
@@ -0,0 +1,24 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("neoscroll", {
|
||||
-- All these keys will be mapped to their corresponding default scrolling animation
|
||||
mappings = {
|
||||
"<C-u>",
|
||||
"<C-d>",
|
||||
"<C-b>",
|
||||
"<C-f>",
|
||||
"<C-y>",
|
||||
"<C-e>",
|
||||
"zt",
|
||||
"zz",
|
||||
"zb",
|
||||
},
|
||||
hide_cursor = true, -- Hide cursor while scrolling
|
||||
stop_eof = true, -- Stop at <EOF> when scrolling downwards
|
||||
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
|
||||
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
|
||||
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
|
||||
easing_function = nil, -- Default easing function
|
||||
pre_hook = nil, -- Function to run before the scrolling animation starts
|
||||
post_hook = nil, -- Function to run after the scrolling animation ends
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
return function()
|
||||
local notify = require("notify")
|
||||
local icons = {
|
||||
diagnostics = require("modules.utils.icons").get("diagnostics"),
|
||||
ui = require("modules.utils.icons").get("ui"),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("notify", {
|
||||
---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" }
|
||||
stages = "fade",
|
||||
---@usage Function called when a new window is opened, use for changing win settings/config
|
||||
on_open = function(win)
|
||||
vim.api.nvim_set_option_value("winblend", 0, { scope = "local", win = win })
|
||||
vim.api.nvim_win_set_config(win, { zindex = 90 })
|
||||
end,
|
||||
---@usage Function called when a window is closed
|
||||
on_close = nil,
|
||||
---@usage timeout for notifications in ms, default 5000
|
||||
timeout = 2000,
|
||||
-- @usage User render fps value
|
||||
fps = 20,
|
||||
-- Render function for notifications. See notify-render()
|
||||
render = "default",
|
||||
---@usage highlight behind the window for stages that change opacity
|
||||
background_colour = "NotifyBackground",
|
||||
---@usage minimum width for notification windows
|
||||
minimum_width = 50,
|
||||
---@usage notifications with level lower than this would be ignored. [ERROR > WARN > INFO > DEBUG > TRACE]
|
||||
level = "INFO",
|
||||
---@usage Icons for the different levels
|
||||
icons = {
|
||||
ERROR = icons.diagnostics.Error,
|
||||
WARN = icons.diagnostics.Warning,
|
||||
INFO = icons.diagnostics.Information,
|
||||
DEBUG = icons.ui.Bug,
|
||||
TRACE = icons.ui.Pencil,
|
||||
},
|
||||
})
|
||||
|
||||
vim.notify = notify
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("paint", {
|
||||
---type PaintHighlight[]
|
||||
highlights = {
|
||||
{
|
||||
-- filter can be a table of buffer options that should match,
|
||||
-- or a function called with buf as param that should return true.
|
||||
-- The example below will paint @something in comments with Constant
|
||||
filter = { filetype = "lua" },
|
||||
pattern = "%s*%-%-%-%s*(@%w+)",
|
||||
hl = "Constant",
|
||||
},
|
||||
{
|
||||
filter = { filetype = "python" },
|
||||
pattern = "%s*([_%w]+:)",
|
||||
hl = "Constant",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
return function()
|
||||
local icons = { diagnostics = require("modules.utils.icons").get("diagnostics", true) }
|
||||
|
||||
require("modules.utils").load_plugin("scrollview", {
|
||||
mode = "virtual",
|
||||
winblend = 0,
|
||||
signs_on_startup = { "diagnostics", "folds", "marks", "search", "spell" },
|
||||
diagnostics_error_symbol = icons.diagnostics.Error,
|
||||
diagnostics_warn_symbol = icons.diagnostics.Warning,
|
||||
diagnostics_info_symbol = icons.diagnostics.Information,
|
||||
diagnostics_hint_symbol = icons.diagnostics.Hint,
|
||||
excluded_filetypes = {
|
||||
"alpha",
|
||||
"fugitive",
|
||||
"git",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"TelescopePrompt",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
return function()
|
||||
local icons = {
|
||||
diagnostics = require("modules.utils.icons").get("diagnostics"),
|
||||
ui = require("modules.utils.icons").get("ui"),
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("todo-comments", {
|
||||
signs = false, -- show icons in the signs column
|
||||
keywords = {
|
||||
FIX = {
|
||||
icon = icons.ui.Bug,
|
||||
color = "error",
|
||||
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" },
|
||||
},
|
||||
TODO = { icon = icons.ui.Accepted, color = "info" },
|
||||
-- HACK = { icon = icons.ui.Fire, color = "warning" },
|
||||
WARN = { icon = icons.diagnostics.Warning, color = "warning", alt = { "WARNING", "XXX" } },
|
||||
PERF = { icon = icons.ui.Perf, alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||
NOTE = { icon = icons.ui.Note, color = "hint", alt = { "INFO" } },
|
||||
TEST = { icon = icons.ui.Lock, color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
},
|
||||
gui_style = {
|
||||
fg = "NONE",
|
||||
bg = "BOLD",
|
||||
},
|
||||
merge_keywords = true,
|
||||
highlight = {
|
||||
multiline = false,
|
||||
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty.
|
||||
after = "",
|
||||
comments_only = true,
|
||||
max_line_len = 500,
|
||||
exclude = {
|
||||
"alpha",
|
||||
"bigfile",
|
||||
"checkhealth",
|
||||
"dap-repl",
|
||||
"diff",
|
||||
"help",
|
||||
"log",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"qf",
|
||||
"TelescopePrompt",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
},
|
||||
},
|
||||
colors = {
|
||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||
info = { "DiagnosticInfo", "#2563EB" },
|
||||
hint = { "DiagnosticHint", "#F5C2E7" },
|
||||
default = { "Conditional", "#7C3AED" },
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,94 @@
|
||||
local completion = {}
|
||||
local use_copilot = require("core.settings").use_copilot
|
||||
|
||||
completion["neovim/nvim-lspconfig"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("completion.lsp"),
|
||||
dependencies = {
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
{ "folke/neoconf.nvim" },
|
||||
{
|
||||
"Jint-lzxy/lsp_signature.nvim",
|
||||
config = require("completion.lsp-signature"),
|
||||
},
|
||||
},
|
||||
}
|
||||
completion["nvimdev/lspsaga.nvim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
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",
|
||||
config = require("completion.glance"),
|
||||
}
|
||||
completion["joechrisellis/lsp-format-modifications.nvim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
}
|
||||
completion["nvimtools/none-ls.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("completion.null-ls"),
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
},
|
||||
}
|
||||
completion["hrsh7th/nvim-cmp"] = {
|
||||
lazy = true,
|
||||
event = "InsertEnter",
|
||||
config = require("completion.cmp"),
|
||||
dependencies = {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = "make install_jsregexp",
|
||||
config = require("completion.luasnip"),
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
},
|
||||
{ "lukas-reineke/cmp-under-comparator" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
{ "andersevenrud/cmp-tmux" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "f3fora/cmp-spell" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "kdheepak/cmp-latex-symbols" },
|
||||
{ "ray-x/cmp-treesitter", commit = "c8e3a74" },
|
||||
-- { "tzachar/cmp-tabnine", build = "./install.sh", config = require("completion.tabnine") },
|
||||
-- {
|
||||
-- "jcdickinson/codeium.nvim",
|
||||
-- dependencies = {
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- "MunifTanjim/nui.nvim",
|
||||
-- },
|
||||
-- config = require("completion.codeium"),
|
||||
-- },
|
||||
},
|
||||
}
|
||||
if use_copilot then
|
||||
completion["zbirenbaum/copilot.lua"] = {
|
||||
lazy = true,
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = require("completion.copilot"),
|
||||
dependencies = {
|
||||
{
|
||||
"zbirenbaum/copilot-cmp",
|
||||
config = require("completion.copilot-cmp"),
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return completion
|
||||
@@ -0,0 +1,132 @@
|
||||
local editor = {}
|
||||
|
||||
editor["olimorris/persisted.nvim"] = {
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"SessionToggle",
|
||||
"SessionStart",
|
||||
"SessionStop",
|
||||
"SessionSave",
|
||||
"SessionLoad",
|
||||
"SessionLoadLast",
|
||||
"SessionLoadFromFile",
|
||||
"SessionDelete",
|
||||
},
|
||||
config = require("editor.persisted"),
|
||||
}
|
||||
editor["m4xshen/autoclose.nvim"] = {
|
||||
lazy = true,
|
||||
event = "InsertEnter",
|
||||
config = require("editor.autoclose"),
|
||||
}
|
||||
editor["LunarVim/bigfile.nvim"] = {
|
||||
lazy = false,
|
||||
config = require("editor.bigfile"),
|
||||
cond = require("core.settings").load_big_files_faster,
|
||||
}
|
||||
editor["ojroques/nvim-bufdel"] = {
|
||||
lazy = true,
|
||||
cmd = { "BufDel", "BufDelAll", "BufDelOthers" },
|
||||
}
|
||||
-- NOTE: `flash.nvim` is a powerful plugin that can be used as partial or complete replacements for:
|
||||
-- > `hop.nvim`,
|
||||
-- > `wilder.nvim`
|
||||
-- > `nvim-treehopper`
|
||||
-- Considering its steep learning curve as well as backward compatibility issues...
|
||||
-- > We have no plan to remove the above plugins for the time being.
|
||||
-- But as usual, you can always tweak the plugin to your liking.
|
||||
editor["folke/flash.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("editor.flash"),
|
||||
}
|
||||
editor["numToStr/Comment.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("editor.comment"),
|
||||
}
|
||||
editor["sindrets/diffview.nvim"] = {
|
||||
lazy = true,
|
||||
cmd = { "DiffviewOpen", "DiffviewClose" },
|
||||
config = require("editor.diffview"),
|
||||
}
|
||||
editor["echasnovski/mini.align"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("editor.align"),
|
||||
}
|
||||
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" },
|
||||
config = require("editor.highlight-colors"),
|
||||
}
|
||||
editor["romainl/vim-cool"] = {
|
||||
lazy = true,
|
||||
event = { "CursorMoved", "InsertEnter" },
|
||||
}
|
||||
editor["lambdalisue/suda.vim"] = {
|
||||
lazy = true,
|
||||
cmd = { "SudaRead", "SudaWrite" },
|
||||
init = require("editor.suda"),
|
||||
}
|
||||
editor["tpope/vim-sleuth"] = {
|
||||
lazy = true,
|
||||
event = { "BufNewFile", "BufReadPost", "BufFilePost" },
|
||||
}
|
||||
editor["nvim-pack/nvim-spectre"] = {
|
||||
lazy = true,
|
||||
cmd = "Spectre",
|
||||
}
|
||||
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
|
||||
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" },
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
config = require("editor.autotag"),
|
||||
},
|
||||
{
|
||||
"hiphish/rainbow-delimiters.nvim",
|
||||
config = require("editor.rainbow_delims"),
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
config = require("editor.ts-context"),
|
||||
},
|
||||
{
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
config = require("editor.ts-context-commentstring"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return editor
|
||||
@@ -0,0 +1,49 @@
|
||||
local lang = {}
|
||||
|
||||
lang["kevinhwang91/nvim-bqf"] = {
|
||||
lazy = true,
|
||||
ft = "qf",
|
||||
config = require("lang.bqf"),
|
||||
dependencies = {
|
||||
{ "junegunn/fzf", build = ":call fzf#install()" },
|
||||
},
|
||||
}
|
||||
lang["ray-x/go.nvim"] = {
|
||||
lazy = true,
|
||||
ft = { "go", "gomod", "gosum" },
|
||||
build = ":GoInstallBinaries",
|
||||
config = require("lang.go"),
|
||||
dependencies = { "ray-x/guihua.lua" },
|
||||
}
|
||||
lang["mrcjkb/rustaceanvim"] = {
|
||||
lazy = true,
|
||||
ft = "rust",
|
||||
version = "*",
|
||||
init = require("lang.rust"),
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
lang["Saecki/crates.nvim"] = {
|
||||
lazy = true,
|
||||
event = "BufReadPost Cargo.toml",
|
||||
config = require("lang.crates"),
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
lang["MeanderingProgrammer/render-markdown.nvim"] = {
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
config = require("lang.render-markdown"),
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
}
|
||||
lang["iamcco/markdown-preview.nvim"] = {
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
build = ":call mkdp#util#install()",
|
||||
}
|
||||
lang["chrisbra/csv.vim"] = {
|
||||
lazy = true,
|
||||
ft = "csv",
|
||||
}
|
||||
return lang
|
||||
@@ -0,0 +1,140 @@
|
||||
local tool = {}
|
||||
|
||||
tool["tpope/vim-fugitive"] = {
|
||||
lazy = true,
|
||||
cmd = { "Git", "G" },
|
||||
}
|
||||
-- This is specifically for fcitx5 users who code in languages other than English
|
||||
-- tool["pysan3/fcitx5.nvim"] = {
|
||||
-- lazy = true,
|
||||
-- event = "BufReadPost",
|
||||
-- cond = vim.fn.executable("fcitx5-remote") == 1,
|
||||
-- config = require("tool.fcitx5"),
|
||||
-- }
|
||||
tool["Bekaboo/dropbar.nvim"] = {
|
||||
lazy = false,
|
||||
config = require("tool.dropbar"),
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
},
|
||||
}
|
||||
tool["nvim-tree/nvim-tree.lua"] = {
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"NvimTreeToggle",
|
||||
"NvimTreeOpen",
|
||||
"NvimTreeFindFile",
|
||||
"NvimTreeFindFileToggle",
|
||||
"NvimTreeRefresh",
|
||||
},
|
||||
config = require("tool.nvim-tree"),
|
||||
}
|
||||
tool["ibhagwan/smartyank.nvim"] = {
|
||||
lazy = true,
|
||||
event = "BufReadPost",
|
||||
config = require("tool.smartyank"),
|
||||
}
|
||||
tool["michaelb/sniprun"] = {
|
||||
lazy = true,
|
||||
-- You need to cd to `~/.local/share/nvim/site/lazy/sniprun/` and execute `bash ./install.sh`,
|
||||
-- if you encountered error about no executable sniprun found.
|
||||
build = "bash ./install.sh",
|
||||
cmd = { "SnipRun", "SnipReset", "SnipInfo" },
|
||||
config = require("tool.sniprun"),
|
||||
}
|
||||
tool["akinsho/toggleterm.nvim"] = {
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"ToggleTerm",
|
||||
"ToggleTermSetName",
|
||||
"ToggleTermToggleAll",
|
||||
"ToggleTermSendVisualLines",
|
||||
"ToggleTermSendCurrentLine",
|
||||
"ToggleTermSendVisualSelection",
|
||||
},
|
||||
config = require("tool.toggleterm"),
|
||||
}
|
||||
tool["folke/trouble.nvim"] = {
|
||||
lazy = true,
|
||||
cmd = { "Trouble", "TroubleToggle", "TroubleRefresh" },
|
||||
config = require("tool.trouble"),
|
||||
}
|
||||
tool["folke/which-key.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("tool.which-key"),
|
||||
}
|
||||
tool["gelguy/wilder.nvim"] = {
|
||||
lazy = true,
|
||||
event = "CmdlineEnter",
|
||||
config = require("tool.wilder"),
|
||||
dependencies = { "romgrk/fzy-lua-native" },
|
||||
}
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- Telescope Plugins --
|
||||
----------------------------------------------------------------------
|
||||
tool["nvim-telescope/telescope.nvim"] = {
|
||||
lazy = true,
|
||||
cmd = "Telescope",
|
||||
config = require("tool.telescope"),
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
{ "jvgrootveld/telescope-zoxide" },
|
||||
{ "debugloop/telescope-undo.nvim" },
|
||||
{ "nvim-telescope/telescope-frecency.nvim" },
|
||||
{ "nvim-telescope/telescope-live-grep-args.nvim" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
{
|
||||
"FabianWirth/search.nvim",
|
||||
config = require("tool.search"),
|
||||
},
|
||||
{
|
||||
"ahmedkhalf/project.nvim",
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("tool.project"),
|
||||
},
|
||||
{
|
||||
"aaronhallaert/advanced-git-search.nvim",
|
||||
cmd = { "AdvancedGitSearch" },
|
||||
dependencies = {
|
||||
"tpope/vim-rhubarb",
|
||||
"tpope/vim-fugitive",
|
||||
"sindrets/diffview.nvim",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- DAP Plugins --
|
||||
----------------------------------------------------------------------
|
||||
tool["mfussenegger/nvim-dap"] = {
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"DapSetLogLevel",
|
||||
"DapShowLog",
|
||||
"DapContinue",
|
||||
"DapToggleBreakpoint",
|
||||
"DapToggleRepl",
|
||||
"DapStepOver",
|
||||
"DapStepInto",
|
||||
"DapStepOut",
|
||||
"DapTerminate",
|
||||
},
|
||||
config = require("tool.dap"),
|
||||
dependencies = {
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
config = require("tool.dap.dapui"),
|
||||
dependencies = {
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
},
|
||||
{ "jay-babu/mason-nvim-dap.nvim" },
|
||||
},
|
||||
}
|
||||
|
||||
return tool
|
||||
@@ -0,0 +1,71 @@
|
||||
local ui = {}
|
||||
|
||||
ui["goolord/alpha-nvim"] = {
|
||||
lazy = true,
|
||||
event = "BufWinEnter",
|
||||
config = require("ui.alpha"),
|
||||
}
|
||||
ui["akinsho/bufferline.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.bufferline"),
|
||||
}
|
||||
ui["Jint-lzxy/nvim"] = {
|
||||
lazy = false,
|
||||
branch = "refactor/syntax-highlighting",
|
||||
name = "catppuccin",
|
||||
config = require("ui.catppuccin"),
|
||||
}
|
||||
ui["j-hui/fidget.nvim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
config = require("ui.fidget"),
|
||||
}
|
||||
ui["lewis6991/gitsigns.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("ui.gitsigns"),
|
||||
}
|
||||
ui["lukas-reineke/indent-blankline.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("ui.indent-blankline"),
|
||||
}
|
||||
ui["nvim-lualine/lualine.nvim"] = {
|
||||
lazy = true,
|
||||
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" },
|
||||
config = require("ui.neoscroll"),
|
||||
}
|
||||
ui["rcarriga/nvim-notify"] = {
|
||||
lazy = true,
|
||||
event = "VeryLazy",
|
||||
config = require("ui.notify"),
|
||||
}
|
||||
ui["folke/paint.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("ui.paint"),
|
||||
}
|
||||
ui["folke/todo-comments.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("ui.todo"),
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
ui["dstein64/nvim-scrollview"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.scrollview"),
|
||||
}
|
||||
|
||||
return ui
|
||||
@@ -0,0 +1,32 @@
|
||||
local M = {}
|
||||
|
||||
function M.input_args()
|
||||
local argument_string = vim.fn.input("Program arg(s) (enter nothing to leave it null): ")
|
||||
return vim.fn.split(argument_string, " ", true)
|
||||
end
|
||||
|
||||
function M.input_exec_path()
|
||||
return vim.fn.input('Path to executable (default to "a.out"): ', vim.fn.expand("%:p:h") .. "/a.out", "file")
|
||||
end
|
||||
|
||||
function M.input_file_path()
|
||||
return vim.fn.input("Path to debuggee (default to the current file): ", vim.fn.expand("%:p"), "file")
|
||||
end
|
||||
|
||||
function M.get_env()
|
||||
local variables = {}
|
||||
for k, v in pairs(vim.fn.environ()) do
|
||||
table.insert(variables, string.format("%s=%s", k, v))
|
||||
end
|
||||
return variables
|
||||
end
|
||||
|
||||
return setmetatable({}, {
|
||||
__index = function(_, key)
|
||||
return function()
|
||||
return function()
|
||||
return M[key]()
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -0,0 +1,240 @@
|
||||
local icons = {}
|
||||
|
||||
local data = {
|
||||
kind = {
|
||||
Break = "",
|
||||
Call = "",
|
||||
Case = "",
|
||||
Class = "",
|
||||
Color = "",
|
||||
Constant = "",
|
||||
Constructor = "",
|
||||
Continue = "",
|
||||
Declaration = "",
|
||||
Delete = "",
|
||||
Enum = "",
|
||||
EnumMember = "",
|
||||
Event = "",
|
||||
Field = "",
|
||||
File = "",
|
||||
Folder = "",
|
||||
Fragment = "",
|
||||
Function = "",
|
||||
Implementation = "",
|
||||
Interface = "",
|
||||
Keyword = "",
|
||||
List = "",
|
||||
Loop = "",
|
||||
Method = "",
|
||||
Module = "",
|
||||
Namespace = "",
|
||||
Operator = "",
|
||||
Package = "",
|
||||
Property = "",
|
||||
Reference = "",
|
||||
Regex = "",
|
||||
Snippet = "",
|
||||
Statement = "",
|
||||
Struct = "",
|
||||
Switch = "",
|
||||
Text = "",
|
||||
TypeParameter = "",
|
||||
Undefined = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Variable = "",
|
||||
-- ccls-specific icons
|
||||
Macro = "",
|
||||
Parameter = "",
|
||||
StaticMethod = "",
|
||||
Terminal = "",
|
||||
TypeAlias = "",
|
||||
},
|
||||
type = {
|
||||
Array = "",
|
||||
Boolean = "",
|
||||
Null = "",
|
||||
Number = "",
|
||||
Object = "",
|
||||
String = "",
|
||||
},
|
||||
documents = {
|
||||
Default = "",
|
||||
File = "",
|
||||
Files = "",
|
||||
FileFind = "",
|
||||
FileTree = "",
|
||||
Import = "",
|
||||
Symlink = "",
|
||||
Word = "",
|
||||
},
|
||||
git = {
|
||||
Add = "",
|
||||
Branch = "",
|
||||
Diff = "",
|
||||
Git = "",
|
||||
Ignore = "",
|
||||
Mod = "M",
|
||||
Mod_alt = "",
|
||||
Remove = "",
|
||||
Rename = "",
|
||||
Repo = "",
|
||||
Unmerged = "",
|
||||
Untracked = "",
|
||||
Unstaged = "",
|
||||
Staged = "",
|
||||
Conflict = "",
|
||||
},
|
||||
ui = {
|
||||
Accepted = "",
|
||||
ArrowClosed = "",
|
||||
ArrowOpen = "",
|
||||
BigCircle = "",
|
||||
BigUnfilledCircle = "",
|
||||
BookMark = "",
|
||||
Buffer = "",
|
||||
Bug = "",
|
||||
Calendar = "",
|
||||
Character = "",
|
||||
Check = "",
|
||||
ChevronRight = "",
|
||||
Circle = "",
|
||||
Close = "",
|
||||
Close_alt = "",
|
||||
CloudDownload = "",
|
||||
CodeAction = "",
|
||||
Comment = "",
|
||||
Dashboard = "",
|
||||
DoubleSeparator = "",
|
||||
Emoji = "",
|
||||
EmptyFolder = "",
|
||||
EmptyFolderOpen = "",
|
||||
File = "",
|
||||
Fire = "",
|
||||
Folder = "",
|
||||
FolderOpen = "",
|
||||
FolderWithHeart = "",
|
||||
Gear = "",
|
||||
History = "",
|
||||
Incoming = "",
|
||||
Indicator = "",
|
||||
Keyboard = "",
|
||||
Left = "",
|
||||
List = "",
|
||||
Lock = "",
|
||||
Modified = "✥",
|
||||
Modified_alt = "",
|
||||
NewFile = "",
|
||||
Newspaper = "",
|
||||
Note = "",
|
||||
Outgoing = "",
|
||||
Package = "",
|
||||
Pencil = "",
|
||||
Perf = "",
|
||||
Play = "",
|
||||
Project = "",
|
||||
Right = "",
|
||||
RootFolderOpened = "",
|
||||
Search = "",
|
||||
Separator = "",
|
||||
SignIn = "",
|
||||
SignOut = "",
|
||||
Sort = "",
|
||||
Spell = "",
|
||||
Square = "",
|
||||
Symlink = "",
|
||||
SymlinkFolder = "",
|
||||
Tab = "",
|
||||
Table = "",
|
||||
Telescope = "",
|
||||
Window = "",
|
||||
},
|
||||
diagnostics = {
|
||||
Error = "",
|
||||
Warning = "",
|
||||
Information = "",
|
||||
Question = "",
|
||||
Hint = "",
|
||||
-- Hollow version
|
||||
Error_alt = "",
|
||||
Warning_alt = "",
|
||||
Information_alt = "",
|
||||
Question_alt = "",
|
||||
Hint_alt = "",
|
||||
},
|
||||
misc = {
|
||||
Add = "+",
|
||||
Added = "",
|
||||
Campass = "",
|
||||
Code = "",
|
||||
Gavel = "",
|
||||
Ghost = "",
|
||||
Glass = "",
|
||||
Lego = "",
|
||||
LspAvailable = "",
|
||||
ManUp = "",
|
||||
Neovim = "",
|
||||
NoActiveLsp = "",
|
||||
PyEnv = "",
|
||||
Squirrel = "",
|
||||
Tag = "",
|
||||
Tree = "",
|
||||
Vbar = "│",
|
||||
Vim = "",
|
||||
Watch = "",
|
||||
},
|
||||
cmp = {
|
||||
buffer = "",
|
||||
latex_symbols = "",
|
||||
luasnip = "",
|
||||
nvim_lsp = "",
|
||||
nvim_lua = "",
|
||||
orgmode = "",
|
||||
path = "",
|
||||
spell = "",
|
||||
tmux = "",
|
||||
treesitter = "",
|
||||
undefined = "",
|
||||
-- Add source-specific icons here
|
||||
codeium = "",
|
||||
Codeium = "",
|
||||
copilot = "",
|
||||
copilot_alt = "",
|
||||
Copilot = "",
|
||||
Copilot_alt = "",
|
||||
TabNine = "",
|
||||
cmp_tabnine = "",
|
||||
},
|
||||
dap = {
|
||||
Breakpoint = "",
|
||||
BreakpointCondition = "",
|
||||
BreakpointRejected = "",
|
||||
LogPoint = "",
|
||||
Pause = "",
|
||||
Play = "",
|
||||
RunLast = "↻",
|
||||
StepBack = "",
|
||||
StepInto = "",
|
||||
StepOut = "",
|
||||
StepOver = "",
|
||||
Stopped = "",
|
||||
Terminate = "",
|
||||
},
|
||||
}
|
||||
|
||||
---Get a specific icon set.
|
||||
---@param category "kind"|"type"|"documents"|"git"|"ui"|"diagnostics"|"misc"|"cmp"|"dap"
|
||||
---@param add_space? boolean @Add trailing whitespace after the icon.
|
||||
function icons.get(category, add_space)
|
||||
if add_space then
|
||||
return setmetatable({}, {
|
||||
__index = function(_, key)
|
||||
return data[category][key] .. " "
|
||||
end,
|
||||
})
|
||||
else
|
||||
return data[category]
|
||||
end
|
||||
end
|
||||
|
||||
return icons
|
||||
@@ -0,0 +1,370 @@
|
||||
local M = {}
|
||||
|
||||
---@class palette
|
||||
---@field rosewater string
|
||||
---@field flamingo string
|
||||
---@field mauve string
|
||||
---@field pink string
|
||||
---@field red string
|
||||
---@field maroon string
|
||||
---@field peach string
|
||||
---@field yellow string
|
||||
---@field green string
|
||||
---@field sapphire string
|
||||
---@field blue string
|
||||
---@field sky string
|
||||
---@field teal string
|
||||
---@field lavender string
|
||||
---@field text string
|
||||
---@field subtext1 string
|
||||
---@field subtext0 string
|
||||
---@field overlay2 string
|
||||
---@field overlay1 string
|
||||
---@field overlay0 string
|
||||
---@field surface2 string
|
||||
---@field surface1 string
|
||||
---@field surface0 string
|
||||
---@field base string
|
||||
---@field mantle string
|
||||
---@field crust string
|
||||
---@field none "NONE"
|
||||
|
||||
---@type nil|palette
|
||||
local palette = nil
|
||||
|
||||
-- Indicates if autocmd for refreshing the builtin palette has already been registered
|
||||
---@type boolean
|
||||
local _has_autocmd = false
|
||||
|
||||
---Initialize the palette
|
||||
---@return palette
|
||||
local function init_palette()
|
||||
-- Reinitialize the palette on event `ColorScheme`
|
||||
if not _has_autocmd then
|
||||
_has_autocmd = true
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
group = vim.api.nvim_create_augroup("__builtin_palette", { clear = true }),
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
palette = nil
|
||||
init_palette()
|
||||
-- Also refresh hard-coded hl groups
|
||||
M.gen_alpha_hl()
|
||||
M.gen_lspkind_hl()
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
if not palette then
|
||||
palette = vim.g.colors_name:find("catppuccin") and require("catppuccin.palettes").get_palette()
|
||||
or {
|
||||
rosewater = "#DC8A78",
|
||||
flamingo = "#DD7878",
|
||||
mauve = "#CBA6F7",
|
||||
pink = "#F5C2E7",
|
||||
red = "#E95678",
|
||||
maroon = "#B33076",
|
||||
peach = "#FF8700",
|
||||
yellow = "#F7BB3B",
|
||||
green = "#AFD700",
|
||||
sapphire = "#36D0E0",
|
||||
blue = "#61AFEF",
|
||||
sky = "#04A5E5",
|
||||
teal = "#B5E8E0",
|
||||
lavender = "#7287FD",
|
||||
|
||||
text = "#F2F2BF",
|
||||
subtext1 = "#BAC2DE",
|
||||
subtext0 = "#A6ADC8",
|
||||
overlay2 = "#C3BAC6",
|
||||
overlay1 = "#988BA2",
|
||||
overlay0 = "#6E6B6B",
|
||||
surface2 = "#6E6C7E",
|
||||
surface1 = "#575268",
|
||||
surface0 = "#302D41",
|
||||
|
||||
base = "#1D1536",
|
||||
mantle = "#1C1C19",
|
||||
crust = "#161320",
|
||||
}
|
||||
|
||||
palette = vim.tbl_extend("force", { none = "NONE" }, palette, require("core.settings").palette_overwrite)
|
||||
end
|
||||
|
||||
return palette
|
||||
end
|
||||
|
||||
---@param c string @The color in hexadecimal.
|
||||
local function hex_to_rgb(c)
|
||||
c = string.lower(c)
|
||||
return { tonumber(c:sub(2, 3), 16), tonumber(c:sub(4, 5), 16), tonumber(c:sub(6, 7), 16) }
|
||||
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 background? string @The background color
|
||||
---@param italic? boolean
|
||||
local function set_global_hl(name, foreground, background, italic)
|
||||
vim.api.nvim_set_hl(0, name, {
|
||||
fg = foreground,
|
||||
bg = background,
|
||||
italic = italic == true,
|
||||
default = not vim.g.colors_name:find("catppuccin"),
|
||||
})
|
||||
end
|
||||
|
||||
---Blend foreground with background
|
||||
---@param foreground string @The foreground color
|
||||
---@param background string @The background color to blend with
|
||||
---@param alpha number|string @Number between 0 and 1 for blending amount.
|
||||
function M.blend(foreground, background, alpha)
|
||||
alpha = type(alpha) == "string" and (tonumber(alpha, 16) / 0xff) or alpha
|
||||
local bg = hex_to_rgb(background)
|
||||
local fg = hex_to_rgb(foreground)
|
||||
|
||||
local blend_channel = function(i)
|
||||
local ret = (alpha * fg[i] + ((1 - alpha) * bg[i]))
|
||||
return math.floor(math.min(math.max(0, ret), 255) + 0.5)
|
||||
end
|
||||
|
||||
return string.format("#%02x%02x%02x", blend_channel(1), blend_channel(2), blend_channel(3))
|
||||
end
|
||||
|
||||
---Get RGB highlight by highlight group
|
||||
---@param hl_group string @Highlight group name
|
||||
---@param use_bg boolean @Returns background or not
|
||||
---@param fallback_hl? string @Fallback value if the hl group is not defined
|
||||
---@return string
|
||||
function M.hl_to_rgb(hl_group, use_bg, fallback_hl)
|
||||
local hex = fallback_hl or "#000000"
|
||||
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 })
|
||||
if use_bg then
|
||||
hex = result.bg and string.format("#%06x", result.bg) or "NONE"
|
||||
else
|
||||
hex = result.fg and string.format("#%06x", result.fg) or "NONE"
|
||||
end
|
||||
end
|
||||
|
||||
return hex
|
||||
end
|
||||
|
||||
---Extend a highlight group
|
||||
---@param name string @Target highlight group name
|
||||
---@param def table @Attributes to be extended
|
||||
function M.extend_hl(name, def)
|
||||
local hlexists = pcall(vim.api.nvim_get_hl, 0, { name = name, link = false })
|
||||
if not hlexists then
|
||||
-- Do nothing if highlight group not found
|
||||
return
|
||||
end
|
||||
local current_def = vim.api.nvim_get_hl(0, { name = name, link = false })
|
||||
local combined_def = vim.tbl_deep_extend("force", current_def, def)
|
||||
|
||||
vim.api.nvim_set_hl(0, name, combined_def)
|
||||
end
|
||||
|
||||
---Generate universal highlight groups
|
||||
---@param overwrite palette? @The color to be overwritten | highest priority
|
||||
---@return palette
|
||||
function M.get_palette(overwrite)
|
||||
if not overwrite then
|
||||
return vim.deepcopy(init_palette())
|
||||
else
|
||||
return vim.tbl_extend("force", init_palette(), overwrite)
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate highlight groups for lspsaga. Existing attributes will NOT be overwritten
|
||||
function M.gen_lspkind_hl()
|
||||
local colors = M.get_palette()
|
||||
local dat = {
|
||||
Class = colors.yellow,
|
||||
Constant = colors.peach,
|
||||
Constructor = colors.sapphire,
|
||||
Enum = colors.yellow,
|
||||
EnumMember = colors.teal,
|
||||
Event = colors.yellow,
|
||||
Field = colors.teal,
|
||||
File = colors.rosewater,
|
||||
Function = colors.blue,
|
||||
Interface = colors.yellow,
|
||||
Key = colors.red,
|
||||
Method = colors.blue,
|
||||
Module = colors.blue,
|
||||
Namespace = colors.blue,
|
||||
Number = colors.peach,
|
||||
Operator = colors.sky,
|
||||
Package = colors.blue,
|
||||
Property = colors.teal,
|
||||
Struct = colors.yellow,
|
||||
TypeParameter = colors.blue,
|
||||
Variable = colors.peach,
|
||||
Array = colors.peach,
|
||||
Boolean = colors.peach,
|
||||
Null = colors.yellow,
|
||||
Object = colors.yellow,
|
||||
String = colors.green,
|
||||
TypeAlias = colors.green,
|
||||
Parameter = colors.blue,
|
||||
StaticMethod = colors.peach,
|
||||
Text = colors.green,
|
||||
Snippet = colors.mauve,
|
||||
Folder = colors.blue,
|
||||
Unit = colors.green,
|
||||
Value = colors.peach,
|
||||
}
|
||||
|
||||
for kind, color in pairs(dat) do
|
||||
set_global_hl("LspKind" .. kind, color)
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate highlight groups for alpha. Existing attributes will NOT be overwritten
|
||||
function M.gen_alpha_hl()
|
||||
local colors = M.get_palette()
|
||||
|
||||
set_global_hl("AlphaHeader", colors.blue)
|
||||
set_global_hl("AlphaButtons", colors.green)
|
||||
set_global_hl("AlphaShortcut", colors.pink, nil, true)
|
||||
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
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
---Convert number (0/1) to boolean
|
||||
---@param value number @The value to check
|
||||
---@return boolean|nil @Returns nil if failed
|
||||
function M.tobool(value)
|
||||
if value == 0 then
|
||||
return false
|
||||
elseif value == 1 then
|
||||
return true
|
||||
else
|
||||
vim.notify(
|
||||
"Attempting to convert data of type '" .. type(value) .. "' [other than 0 or 1] to boolean",
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "[utils] Runtime Error" }
|
||||
)
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
--- Function to recursively merge src into dst
|
||||
--- Unlike vim.tbl_deep_extend(), this function extends if the original value is a list
|
||||
---@paramm dst table @Table which will be modified and appended to
|
||||
---@paramm src table @Table from which values will be inserted
|
||||
---@return table @Modified table
|
||||
local function tbl_recursive_merge(dst, src)
|
||||
for key, value in pairs(src) do
|
||||
if type(dst[key]) == "table" and type(value) == "function" then
|
||||
dst[key] = value(dst[key])
|
||||
elseif type(dst[key]) == "table" and vim.islist(dst[key]) and key ~= "dashboard_image" then
|
||||
vim.list_extend(dst[key], value)
|
||||
elseif type(dst[key]) == "table" and type(value) == "table" and not vim.islist(dst[key]) then
|
||||
tbl_recursive_merge(dst[key], value)
|
||||
else
|
||||
dst[key] = value
|
||||
end
|
||||
end
|
||||
return dst
|
||||
end
|
||||
|
||||
-- Function to extend existing core configs (settings, events, etc.)
|
||||
---@param config table @The default config to be merged with
|
||||
---@param user_config string @The module name used to require user config
|
||||
---@return table @Extended config
|
||||
function M.extend_config(config, user_config)
|
||||
local ok, extras = pcall(require, user_config)
|
||||
if ok and type(extras) == "table" then
|
||||
config = tbl_recursive_merge(config, extras)
|
||||
end
|
||||
return config
|
||||
end
|
||||
|
||||
---@param plugin_name string @Module name of the plugin (used to setup itself)
|
||||
---@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)
|
||||
vim_plugin = vim_plugin or false
|
||||
|
||||
-- Get the file name of the default config
|
||||
local fname = debug.getinfo(2, "S").source:match("[^@/\\]*.lua$")
|
||||
local ok, user_config = pcall(require, "user.configs." .. fname:sub(0, #fname - 4))
|
||||
if ok and vim_plugin then
|
||||
if user_config == false then
|
||||
-- Return early if the user explicitly requires disabling plugin setup
|
||||
return
|
||||
elseif type(user_config) == "function" then
|
||||
-- OK, setup as instructed by the user
|
||||
user_config()
|
||||
else
|
||||
vim.notify(
|
||||
string.format(
|
||||
"<%s> is not a typical Lua plugin, please return a function with\nthe corresponding options defined instead (usually via `vim.g.*`)",
|
||||
plugin_name
|
||||
),
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "[utils] Runtime Error (User Config)" }
|
||||
)
|
||||
end
|
||||
elseif not vim_plugin then
|
||||
if user_config == false then
|
||||
-- Return early if the user explicitly requires disabling plugin setup
|
||||
return
|
||||
else
|
||||
setup_callback = setup_callback or require(plugin_name).setup
|
||||
-- User config exists?
|
||||
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)
|
||||
setup_callback(opts)
|
||||
-- Replace base config if the returned user config is a function
|
||||
elseif type(user_config) == "function" then
|
||||
local user_opts = user_config(opts)
|
||||
if type(user_opts) == "table" then
|
||||
setup_callback(user_opts)
|
||||
end
|
||||
else
|
||||
vim.notify(
|
||||
string.format(
|
||||
[[
|
||||
Please return a `table` if you want to override some of the default options OR a
|
||||
`function` returning a `table` if you want to replace the default options completely.
|
||||
|
||||
We received a `%s` for plugin <%s>.]],
|
||||
type(user_config),
|
||||
plugin_name
|
||||
),
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "[utils] Runtime Error (User Config)" }
|
||||
)
|
||||
end
|
||||
else
|
||||
-- Nothing provided... Fallback as default setup of the plugin
|
||||
setup_callback(opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,205 @@
|
||||
local M = {}
|
||||
|
||||
---Shortcut for `nvim_replace_termcodes`.
|
||||
---@param keys string
|
||||
---@return string
|
||||
local function termcodes(keys)
|
||||
return vim.api.nvim_replace_termcodes(keys, true, true, true)
|
||||
end
|
||||
|
||||
---Returns if two key sequence are equal or not.
|
||||
---@param a string
|
||||
---@param b string
|
||||
---@return boolean
|
||||
local function keymap_equals(a, b)
|
||||
return termcodes(a) == termcodes(b)
|
||||
end
|
||||
|
||||
---Get map
|
||||
---@param mode string
|
||||
---@param lhs string
|
||||
---@return table
|
||||
local function get_map(mode, lhs)
|
||||
for _, map in ipairs(vim.api.nvim_buf_get_keymap(0, mode)) do
|
||||
if keymap_equals(map.lhs, lhs) then
|
||||
vim.api.nvim_buf_del_keymap(0, mode, lhs)
|
||||
return {
|
||||
lhs = map.lhs,
|
||||
rhs = map.rhs or "",
|
||||
expr = map.expr == 1,
|
||||
callback = map.callback,
|
||||
noremap = map.noremap == 1,
|
||||
script = map.script == 1,
|
||||
silent = map.silent == 1,
|
||||
nowait = map.nowait == 1,
|
||||
buffer = true,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
for _, map in ipairs(vim.api.nvim_get_keymap(mode)) do
|
||||
if keymap_equals(map.lhs, lhs) then
|
||||
vim.api.nvim_del_keymap(mode, lhs)
|
||||
return {
|
||||
lhs = map.lhs,
|
||||
rhs = map.rhs or "",
|
||||
expr = map.expr == 1,
|
||||
callback = map.callback,
|
||||
noremap = map.noremap == 1,
|
||||
script = map.script == 1,
|
||||
silent = map.silent == 1,
|
||||
nowait = map.nowait == 1,
|
||||
buffer = false,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
lhs = lhs,
|
||||
rhs = lhs,
|
||||
expr = false,
|
||||
callback = nil,
|
||||
noremap = true,
|
||||
script = false,
|
||||
silent = true,
|
||||
nowait = false,
|
||||
buffer = false,
|
||||
}
|
||||
end
|
||||
|
||||
---Returns the function constructed from the passed keymap object on call of
|
||||
---which the original keymapping will be executed.
|
||||
---@param map table keymap object
|
||||
---@return function
|
||||
local function get_fallback(map)
|
||||
return function()
|
||||
local keys, fmode
|
||||
if map.expr then
|
||||
if map.callback then
|
||||
keys = map.callback()
|
||||
else
|
||||
keys = vim.api.nvim_eval(map.rhs)
|
||||
end
|
||||
elseif map.callback then
|
||||
map.callback()
|
||||
return
|
||||
else
|
||||
keys = map.rhs
|
||||
end
|
||||
keys = termcodes(keys)
|
||||
fmode = map.noremap and "in" or "im"
|
||||
vim.api.nvim_feedkeys(keys, fmode, false)
|
||||
end
|
||||
end
|
||||
|
||||
-- Amends a mapping (i.e., allows fallback when certain conditions are met)
|
||||
---@param cond string
|
||||
---@param mode string
|
||||
---@param lhs string
|
||||
---@param rhs function
|
||||
---@param opts? table
|
||||
local function amend(cond, mode, lhs, rhs, opts)
|
||||
local map = get_map(mode, lhs)
|
||||
local fallback = get_fallback(map)
|
||||
local options = vim.deepcopy(opts) or {}
|
||||
options.desc = table.concat({
|
||||
"[" .. cond,
|
||||
(options.desc and ": " .. options.desc or ""),
|
||||
"]",
|
||||
(map.desc and " / " .. map.desc or ""),
|
||||
})
|
||||
vim.keymap.set(mode, lhs, function()
|
||||
rhs(fallback)
|
||||
end, options)
|
||||
end
|
||||
|
||||
-- Completely replace a mapping
|
||||
---@param mode string
|
||||
---@param lhs string
|
||||
---@param rhs string
|
||||
---@param opts? table
|
||||
---@param buf? boolean|number
|
||||
local function replace(mode, lhs, rhs, opts, buf)
|
||||
get_map(mode, lhs)
|
||||
|
||||
local options = vim.deepcopy(opts) or {}
|
||||
if buf and type(buf) == "number" then
|
||||
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
|
||||
else
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
end
|
||||
|
||||
---Amend the existing keymap.
|
||||
---@param cond string
|
||||
---@param mode string | string[]
|
||||
---@param lhs string
|
||||
---@param rhs function
|
||||
---@param opts? table
|
||||
local function modes_amend(cond, mode, lhs, rhs, opts)
|
||||
if type(mode) == "table" then
|
||||
for _, m in ipairs(mode) do
|
||||
amend(cond, m, lhs, rhs, opts)
|
||||
end
|
||||
else
|
||||
amend(cond, mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
---Replace the existing keymap.
|
||||
---@param mode string | string[]
|
||||
---@param lhs string
|
||||
---@param rhs string
|
||||
---@param opts? table
|
||||
---@param buf? boolean|number
|
||||
local function modes_replace(mode, lhs, rhs, opts, buf)
|
||||
if type(mode) == "table" then
|
||||
for _, m in ipairs(mode) do
|
||||
replace(m, lhs, rhs, opts, buf)
|
||||
end
|
||||
else
|
||||
replace(mode, lhs, rhs, opts, buf)
|
||||
end
|
||||
end
|
||||
|
||||
---Amend the existing keymap.
|
||||
---@param cond string
|
||||
---@param global_flag string
|
||||
---@param mapping table<string, map_rhs>
|
||||
function M.amend(cond, global_flag, mapping)
|
||||
for key, value in pairs(mapping) do
|
||||
local modes, keymap = key:match("([^|]*)|?(.*)")
|
||||
if type(value) == "table" then
|
||||
local rhs = value.cmd
|
||||
local options = value.options
|
||||
modes_amend(cond, vim.split(modes, ""), keymap, function(fallback)
|
||||
if _G[global_flag] then
|
||||
local fmode = options.noremap and "in" or "im"
|
||||
vim.api.nvim_feedkeys(termcodes(rhs), fmode, false)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Replace the existing keymap.
|
||||
---@param mapping table<string, map_rhs>
|
||||
function M.replace(mapping)
|
||||
for key, value in pairs(mapping) do
|
||||
local modes, keymap = key:match("([^|]*)|?(.*)")
|
||||
if type(value) == "table" then
|
||||
local rhs = value.cmd
|
||||
local options = value.options
|
||||
local buffer = value.buffer
|
||||
modes_replace(vim.split(modes, ""), keymap, rhs, options, buffer)
|
||||
elseif value == "" or value == false then
|
||||
for _, m in ipairs(vim.split(modes, "")) do
|
||||
get_map(m, keymap)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user