update: nvim

This commit is contained in:
2025-03-24 20:37:02 -04:00
parent ac8f51e7cf
commit cc1870ecd2
47 changed files with 880 additions and 751 deletions
+7 -2
View File
@@ -32,7 +32,13 @@ local leader_map = function()
end
local gui_config = function()
vim.api.nvim_set_option_value("guifont", settings.gui_config.font_name .. ":h" .. settings.gui_config.font_size, {})
if next(settings.gui_config) then
vim.api.nvim_set_option_value(
"guifont",
settings.gui_config.font_name .. ":h" .. settings.gui_config.font_size,
{}
)
end
end
local neovide_config = function()
@@ -104,7 +110,6 @@ local load_core = function()
shell_config()
require("core.options")
require("core.mapping")
require("core.event")
require("core.pack")
require("keymap")
-65
View File
@@ -1,65 +0,0 @@
local bind = require("keymap.bind")
local map_cr = bind.map_cr
local map_cu = bind.map_cu
local map_cmd = bind.map_cmd
local map_callback = bind.map_callback
local core_map = {
-- Suckless
["n|<S-Tab>"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"),
["n|<C-s>"] = map_cu("write"):with_noremap():with_silent():with_desc("edit: Save file"),
["n|Y"] = map_cmd("y$"):with_desc("edit: Yank text to EOL"),
["n|D"] = map_cmd("d$"):with_desc("edit: Delete text to EOL"),
["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"),
["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"),
["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"),
["n|<Esc>"] = map_callback(function()
_flash_esc_or_noh()
end)
:with_noremap()
:with_silent()
:with_desc("edit: Clear search highlight"),
["n|<C-h>"] = map_cmd("<C-w>h"):with_noremap():with_desc("window: Focus left"),
["n|<C-l>"] = map_cmd("<C-w>l"):with_noremap():with_desc("window: Focus right"),
["n|<C-j>"] = map_cmd("<C-w>j"):with_noremap():with_desc("window: Focus down"),
["n|<C-k>"] = map_cmd("<C-w>k"):with_noremap():with_desc("window: Focus up"),
["t|<C-w>h"] = map_cmd("<Cmd>wincmd h<CR>"):with_silent():with_noremap():with_desc("window: Focus left"),
["t|<C-w>l"] = map_cmd("<Cmd>wincmd l<CR>"):with_silent():with_noremap():with_desc("window: Focus right"),
["t|<C-w>j"] = map_cmd("<Cmd>wincmd j<CR>"):with_silent():with_noremap():with_desc("window: Focus down"),
["t|<C-w>k"] = map_cmd("<Cmd>wincmd k<CR>"):with_silent():with_noremap():with_desc("window: Focus up"),
["n|<A-h>"] = map_cr("vertical resize -3"):with_silent():with_desc("window: Resize -3 vertically"),
["n|<A-l>"] = map_cr("vertical resize +3"):with_silent():with_desc("window: Resize +3 vertically"),
["n|<A-j>"] = map_cr("resize -3"):with_silent():with_desc("window: Resize -3 horizontally"),
["n|<A-k>"] = map_cr("resize +3"):with_silent():with_desc("window: Resize +3 horizontally"),
["n|<C-q>"] = map_cr("wq"):with_desc("edit: Save file and quit"),
["n|<A-S-q>"] = map_cr("q!"):with_desc("edit: Force quit"),
["n|<leader>o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"),
["n|<leader>bn"] = map_cu("enew"):with_noremap():with_silent():with_desc("buffer: New"),
["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"),
["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"),
["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"),
["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"),
-- Insert mode
["i|<C-u>"] = map_cmd("<C-G>u<C-U>"):with_noremap():with_desc("edit: Delete previous block"),
["i|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Move cursor to left"),
["i|<C-a>"] = map_cmd("<ESC>^i"):with_noremap():with_desc("edit: Move cursor to line start"),
["i|<C-s>"] = map_cmd("<Esc>:w<CR>"):with_desc("edit: Save file"),
["i|<C-q>"] = map_cmd("<Esc>:wq<CR>"):with_desc("edit: Save file and quit"),
-- Command mode
["c|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Left"),
["c|<C-f>"] = map_cmd("<Right>"):with_noremap():with_desc("edit: Right"),
["c|<C-a>"] = map_cmd("<Home>"):with_noremap():with_desc("edit: Home"),
["c|<C-e>"] = map_cmd("<End>"):with_noremap():with_desc("edit: End"),
["c|<C-d>"] = map_cmd("<Del>"):with_noremap():with_desc("edit: Delete"),
["c|<C-h>"] = map_cmd("<BS>"):with_noremap():with_desc("edit: Backspace"),
["c|<C-t>"] = map_cmd([[<C-R>=expand("%:p:h") . "/" <CR>]])
:with_noremap()
:with_desc("edit: Complete path of current file"),
-- Visual mode
["v|J"] = map_cmd(":m '>+1<CR>gv=gv"):with_desc("edit: Move this line down"),
["v|K"] = map_cmd(":m '<-2<CR>gv=gv"):with_desc("edit: Move this line up"),
["v|<"] = map_cmd("<gv"):with_desc("edit: Decrease indent"),
["v|>"] = map_cmd(">gv"):with_desc("edit: Increase indent"),
}
bind.nvim_load_mapping(core_map)
+1 -1
View File
@@ -125,7 +125,7 @@ function Lazy:load_lazy()
---@type string[]
paths = {}, -- add any custom paths here that you want to include in the rtp
disabled_plugins = {
-- Set this to true in order to enable native EditorConfig support
-- Comment out `"editorconfig"` to enable native EditorConfig support
-- WARN: Sleuth.vim already includes all the features provided by this plugin.
-- Do NOT enable both at the same time, or you risk breaking the entire detection system.
"editorconfig",
+2 -2
View File
@@ -46,9 +46,9 @@ settings["formatter_block_list"] = {
-- Servers in this list will skip setting formatting capabilities if rhs is true.
---@type table<string, boolean>
settings["server_formatting_block_list"] = {
lua_ls = true,
tsserver = true,
clangd = true,
lua_ls = true,
ts_ls = true,
}
-- Set it to false if you want to turn off LSP Inlay Hints
+28 -11
View File
@@ -1,27 +1,32 @@
local bind = require("keymap.bind")
local map_cr = bind.map_cr
local map_cmd = bind.map_cmd
local map_callback = bind.map_callback
local plug_map = {
["n|<A-f>"] = map_cmd("<Cmd>FormatToggle<CR>"):with_noremap():with_desc("formatter: Toggle format on save"),
local mappings = {
fmt = {
["n|<A-f>"] = map_cr("FormatToggle"):with_noremap():with_silent():with_desc("formatter: Toggle format on save"),
["n|<A-S-f>"] = map_cr("Format"):with_noremap():with_silent():with_desc("formatter: Format buffer manually"),
},
}
bind.nvim_load_mapping(plug_map)
bind.nvim_load_mapping(mappings.fmt)
local mapping = {}
--- The following code allows this file to be exported ---
--- for use with LSP lazy-loaded keymap bindings ---
function mapping.lsp(buf)
local M = {}
---@param buf integer
function M.lsp(buf)
local map = {
-- LSP-related keymaps, ONLY effective in buffers with LSP(s) attached
["n|<leader>li"] = map_cr("LspInfo"):with_silent():with_buffer(buf):with_desc("lsp: Info"),
["n|<leader>lr"] = map_cr("LspRestart"):with_silent():with_buffer(buf):with_nowait():with_desc("lsp: Restart"),
["n|go"] = map_cr("AerialToggle!"):with_silent():with_buffer(buf):with_desc("lsp: Toggle outline"),
["n|gto"] = map_callback(function()
require("telescope").extensions.aerial.aerial()
["n|go"] = map_callback(function()
require("edgy").toggle("right")
end)
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Toggle outline in Telescope"),
:with_desc("lsp: Toggle outline"),
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev")
:with_silent()
:with_buffer(buf)
@@ -62,6 +67,18 @@ function mapping.lsp(buf)
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Show outgoing calls"),
["n|<leader>lv"] = map_callback(function()
_toggle_virtualtext()
end)
:with_noremap()
:with_silent()
:with_desc("lsp: Toggle virtual text display of current buffer"),
["n|<leader>lh"] = map_callback(function()
_toggle_inlayhint()
end)
:with_noremap()
:with_silent()
:with_desc("lsp: Toggle inlay hints dispaly of current buffer"),
}
bind.nvim_load_mapping(map)
@@ -71,4 +88,4 @@ function mapping.lsp(buf)
end
end
return mapping
return M
+123 -92
View File
@@ -5,105 +5,136 @@ local map_cmd = bind.map_cmd
local map_callback = bind.map_callback
local et = bind.escape_termcode
local plug_map = {
-- Plugin persisted.nvim
["n|<leader>ss"] = map_cu("SessionSave"):with_noremap():with_silent():with_desc("session: Save"),
["n|<leader>sl"] = map_cu("SessionLoad"):with_noremap():with_silent():with_desc("session: Load current"),
["n|<leader>sd"] = map_cu("SessionDelete"):with_noremap():with_silent():with_desc("session: Delete"),
local mappings = {
builtins = {
-- Builtins: Save & Quit
["n|<C-s>"] = map_cu("write"):with_noremap():with_silent():with_desc("edit: Save file"),
["n|<C-q>"] = map_cr("wq"):with_desc("edit: Save file and quit"),
["n|<A-S-q>"] = map_cr("q!"):with_desc("edit: Force quit"),
-- Plugin: nvim-bufdel
["n|<A-q>"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"),
-- Builtins: Insert mode
["i|<C-u>"] = map_cmd("<C-G>u<C-U>"):with_noremap():with_desc("edit: Delete previous block"),
["i|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Move cursor to left"),
["i|<C-a>"] = map_cmd("<ESC>^i"):with_noremap():with_desc("edit: Move cursor to line start"),
["i|<C-s>"] = map_cmd("<Esc>:w<CR>"):with_desc("edit: Save file"),
["i|<C-q>"] = map_cmd("<Esc>:wq<CR>"):with_desc("edit: Save file and quit"),
-- Plugin: comment.nvim
["n|gcc"] = map_callback(function()
return vim.v.count == 0 and et("<Plug>(comment_toggle_linewise_current)")
or et("<Plug>(comment_toggle_linewise_count)")
end)
:with_silent()
:with_noremap()
:with_expr()
:with_desc("edit: Toggle comment for line"),
["n|gbc"] = map_callback(function()
return vim.v.count == 0 and et("<Plug>(comment_toggle_blockwise_current)")
or et("<Plug>(comment_toggle_blockwise_count)")
end)
:with_silent()
:with_noremap()
:with_expr()
:with_desc("edit: Toggle comment for block"),
["n|gc"] = map_cmd("<Plug>(comment_toggle_linewise)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for line with operator"),
["n|gb"] = map_cmd("<Plug>(comment_toggle_blockwise)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for block with operator"),
["x|gc"] = map_cmd("<Plug>(comment_toggle_linewise_visual)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for line with selection"),
["x|gb"] = map_cmd("<Plug>(comment_toggle_blockwise_visual)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for block with selection"),
-- Builtins: Command mode
["c|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Left"),
["c|<C-f>"] = map_cmd("<Right>"):with_noremap():with_desc("edit: Right"),
["c|<C-a>"] = map_cmd("<Home>"):with_noremap():with_desc("edit: Home"),
["c|<C-e>"] = map_cmd("<End>"):with_noremap():with_desc("edit: End"),
["c|<C-d>"] = map_cmd("<Del>"):with_noremap():with_desc("edit: Delete"),
["c|<C-h>"] = map_cmd("<BS>"):with_noremap():with_desc("edit: Backspace"),
["c|<C-t>"] = map_cmd([[<C-R>=expand("%:p:h") . "/" <CR>]])
:with_noremap()
:with_desc("edit: Complete path of current file"),
-- Plugin: diffview.nvim
["n|<leader>gd"] = map_cr("DiffviewOpen"):with_silent():with_noremap():with_desc("git: Show diff"),
["n|<leader>gD"] = map_cr("DiffviewClose"):with_silent():with_noremap():with_desc("git: Close diff"),
-- Builtins: Visual mode
["v|J"] = map_cmd(":m '>+1<CR>gv=gv"):with_desc("edit: Move this line down"),
["v|K"] = map_cmd(":m '<-2<CR>gv=gv"):with_desc("edit: Move this line up"),
["v|<"] = map_cmd("<gv"):with_desc("edit: Decrease indent"),
["v|>"] = map_cmd(">gv"):with_desc("edit: Increase indent"),
-- Plugin: hop.nvim
["nv|<leader>w"] = map_cmd("<Cmd>HopWordMW<CR>"):with_noremap():with_desc("jump: Goto word"),
["nv|<leader>j"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
["nv|<leader>k"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
["nv|<leader>c"] = map_cmd("<Cmd>HopChar1MW<CR>"):with_noremap():with_desc("jump: Goto one char"),
["nv|<leader>C"] = map_cmd("<Cmd>HopChar2MW<CR>"):with_noremap():with_desc("jump: Goto two chars"),
-- Builtins: "Suckless" - named after r/suckless
["n|Y"] = map_cmd("y$"):with_desc("edit: Yank text to EOL"),
["n|D"] = map_cmd("d$"):with_desc("edit: Delete text to EOL"),
["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"),
["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"),
["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"),
["n|<S-Tab>"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"),
["n|<Esc>"] = map_callback(function()
_flash_esc_or_noh()
end)
:with_noremap()
:with_silent()
:with_desc("edit: Clear search highlight"),
["n|<leader>o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"),
},
plugins = {
-- Plugin: persisted.nvim
["n|<leader>ss"] = map_cu("SessionSave"):with_noremap():with_silent():with_desc("session: Save"),
["n|<leader>sl"] = map_cu("SessionLoad"):with_noremap():with_silent():with_desc("session: Load current"),
["n|<leader>sd"] = map_cu("SessionDelete"):with_noremap():with_silent():with_desc("session: Delete"),
-- Plugin: smart-splits.nvim
["n|<A-h>"] = map_cu("SmartResizeLeft"):with_silent():with_noremap():with_desc("window: Resize -3 horizontally"),
["n|<A-j>"] = map_cu("SmartResizeDown"):with_silent():with_noremap():with_desc("window: Resize -3 vertically"),
["n|<A-k>"] = map_cu("SmartResizeUp"):with_silent():with_noremap():with_desc("window: Resize +3 vertically"),
["n|<A-l>"] = map_cu("SmartResizeRight"):with_silent():with_noremap():with_desc("window: Resize +3 horizontally"),
["n|<C-h>"] = map_cu("SmartCursorMoveLeft"):with_silent():with_noremap():with_desc("window: Focus left"),
["n|<C-j>"] = map_cu("SmartCursorMoveDown"):with_silent():with_noremap():with_desc("window: Focus down"),
["n|<C-k>"] = map_cu("SmartCursorMoveUp"):with_silent():with_noremap():with_desc("window: Focus up"),
["n|<C-l>"] = map_cu("SmartCursorMoveRight"):with_silent():with_noremap():with_desc("window: Focus right"),
["n|<leader>Wh"] = map_cu("SmartSwapLeft"):with_silent():with_noremap():with_desc("window: Move window leftward"),
["n|<leader>Wj"] = map_cu("SmartSwapDown"):with_silent():with_noremap():with_desc("window: Move window downward"),
["n|<leader>Wk"] = map_cu("SmartSwapUp"):with_silent():with_noremap():with_desc("window: Move window upward"),
["n|<leader>Wl"] = map_cu("SmartSwapRight"):with_silent():with_noremap():with_desc("window: Move window rightward"),
-- Plugin: comment.nvim
["n|gcc"] = map_callback(function()
return vim.v.count == 0 and et("<Plug>(comment_toggle_linewise_current)")
or et("<Plug>(comment_toggle_linewise_count)")
end)
:with_silent()
:with_noremap()
:with_expr()
:with_desc("edit: Toggle comment for line"),
["n|gbc"] = map_callback(function()
return vim.v.count == 0 and et("<Plug>(comment_toggle_blockwise_current)")
or et("<Plug>(comment_toggle_blockwise_count)")
end)
:with_silent()
:with_noremap()
:with_expr()
:with_desc("edit: Toggle comment for block"),
["n|gc"] = map_cmd("<Plug>(comment_toggle_linewise)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for line with operator"),
["n|gb"] = map_cmd("<Plug>(comment_toggle_blockwise)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for block with operator"),
["x|gc"] = map_cmd("<Plug>(comment_toggle_linewise_visual)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for line with selection"),
["x|gb"] = map_cmd("<Plug>(comment_toggle_blockwise_visual)")
:with_silent()
:with_noremap()
:with_desc("edit: Toggle comment for block with selection"),
-- Plugin: nvim-spectre
["n|<leader>Ss"] = map_callback(function()
require("spectre").toggle()
end)
:with_silent()
:with_noremap()
:with_desc("editn: Toggle search & replace panel"),
["n|<leader>Sp"] = map_callback(function()
require("spectre").open_visual({ select_word = true })
end)
:with_silent()
:with_noremap()
:with_desc("editn: search&replace current word (project)"),
["v|<leader>Sp"] = map_callback(function()
require("spectre").open_visual()
end)
:with_silent()
:with_noremap()
:with_desc("edit: search & replace current word (project)"),
["n|<leader>Sf"] = map_callback(function()
require("spectre").open_file_search({ select_word = true })
end)
:with_silent()
:with_noremap()
:with_desc("editn: search & replace current word (file)"),
-- Plugin: diffview.nvim
["n|<leader>gd"] = map_cr("DiffviewOpen"):with_silent():with_noremap():with_desc("git: Show diff"),
["n|<leader>gD"] = map_cr("DiffviewClose"):with_silent():with_noremap():with_desc("git: Close diff"),
-- Plugin: nvim-treehopper
["o|m"] = map_cu("lua require('tsht').nodes()"):with_silent():with_desc("jump: Operate across syntax tree"),
-- Plugin: hop.nvim
["nv|<leader>w"] = map_cmd("<Cmd>HopWordMW<CR>"):with_noremap():with_desc("jump: Goto word"),
["nv|<leader>j"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
["nv|<leader>k"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
["nv|<leader>c"] = map_cmd("<Cmd>HopChar1MW<CR>"):with_noremap():with_desc("jump: Goto one char"),
["nv|<leader>C"] = map_cmd("<Cmd>HopChar2MW<CR>"):with_noremap():with_desc("jump: Goto two chars"),
-- Plugin suda.vim
["n|<A-s>"] = map_cu("SudaWrite"):with_silent():with_noremap():with_desc("editn: Save file using sudo"),
-- Plugin: grug-far
["n|<leader>Ss"] = map_callback(function()
require("grug-far").open()
end)
:with_silent()
:with_noremap()
:with_desc("editn: Toggle search & replace panel"),
["n|<leader>Sp"] = map_callback(function()
require("grug-far").open({ prefills = { search = vim.fn.expand("<cword>") } })
end)
:with_silent()
:with_noremap()
:with_desc("editn: search&replace current word (project)"),
["v|<leader>Sp"] = map_callback(function()
require("grug-far").with_visual_selection()
end)
:with_silent()
:with_noremap()
:with_desc("edit: search & replace current word (project)"),
["n|<leader>Sf"] = map_callback(function()
require("grug-far").open({ prefills = { paths = vim.fn.expand("%") } })
end)
:with_silent()
:with_noremap()
:with_desc("editn: search & replace current word (file)"),
-- Plugin: nvim-treehopper
["o|m"] = map_cu("lua require('tsht').nodes()"):with_silent():with_desc("jump: Operate across syntax tree"),
-- Plugin: suda.vim
["n|<A-s>"] = map_cu("SudaWrite"):with_silent():with_noremap():with_desc("editn: Save file using sudo"),
},
}
bind.nvim_load_mapping(plug_map)
bind.nvim_load_mapping(mappings.builtins)
bind.nvim_load_mapping(mappings.plugins)
+32 -13
View File
@@ -3,14 +3,20 @@ _G._command_panel = function()
lhs_filter = function(lhs)
return not string.find(lhs, "Þ")
end,
layout_config = {
width = 0.6,
height = 0.6,
prompt_position = "top",
},
})
end
_G._flash_esc_or_noh = function()
local flash_active, state = pcall(function()
return require("flash.plugins.char").state
end)
if flash_active and state then
state:hide()
else
pcall(vim.cmd.noh)
end
end
_G._telescope_collections = function(picker_type)
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
@@ -38,14 +44,27 @@ _G._telescope_collections = function(picker_type)
:find()
end
_G._flash_esc_or_noh = function()
local flash_active, state = pcall(function()
return require("flash.plugins.char").state
end)
if flash_active and state then
state:hide()
else
pcall(vim.cmd.noh)
_G._toggle_inlayhint = function()
local is_enabled = vim.lsp.inlay_hint.is_enabled()
vim.lsp.inlay_hint.enable(not is_enabled)
vim.notify(
(is_enabled and "Inlay hint disabled successfully" or "Inlay hint enabled successfully"),
vim.log.levels.INFO,
{ title = "LSP Inlay Hint" }
)
end
local _vt_enabled = require("core.settings").diagnostics_virtual_text
_G._toggle_virtualtext = function()
if vim.diagnostic.is_enabled() then
_vt_enabled = not _vt_enabled
vim.diagnostic[_vt_enabled and "show" or "hide"]()
vim.notify(
(_vt_enabled and "Virtual text is now displayed" or "Virtual text is now hidden"),
vim.log.levels.INFO,
{ title = "LSP Diagnostic" }
)
end
end
+34 -19
View File
@@ -1,27 +1,42 @@
require("keymap.helpers")
local bind = require("keymap.bind")
local map_cr = bind.map_cr
-- local map_cu = bind.map_cu
-- local map_cmd = bind.map_cmd
-- local map_callback = bind.map_callback
local plug_map = {
-- Package manager: lazy.nvim
["n|<leader>ph"] = map_cr("Lazy"):with_silent():with_noremap():with_nowait():with_desc("package: Show"),
["n|<leader>ps"] = map_cr("Lazy sync"):with_silent():with_noremap():with_nowait():with_desc("package: Sync"),
["n|<leader>pu"] = map_cr("Lazy update"):with_silent():with_noremap():with_nowait():with_desc("package: Update"),
["n|<leader>pi"] = map_cr("Lazy install"):with_silent():with_noremap():with_nowait():with_desc("package: Install"),
["n|<leader>pl"] = map_cr("Lazy log"):with_silent():with_noremap():with_nowait():with_desc("package: Log"),
["n|<leader>pc"] = map_cr("Lazy check"):with_silent():with_noremap():with_nowait():with_desc("package: Check"),
["n|<leader>pd"] = map_cr("Lazy debug"):with_silent():with_noremap():with_nowait():with_desc("package: Debug"),
["n|<leader>pp"] = map_cr("Lazy profile"):with_silent():with_noremap():with_nowait():with_desc("package: Profile"),
["n|<leader>pr"] = map_cr("Lazy restore"):with_silent():with_noremap():with_nowait():with_desc("package: Restore"),
["n|<leader>px"] = map_cr("Lazy clean"):with_silent():with_noremap():with_nowait():with_desc("package: Clean"),
local mappings = {
core = {
-- Package manager: lazy.nvim
["n|<leader>ph"] = map_cr("Lazy"):with_silent():with_noremap():with_nowait():with_desc("package: Show"),
["n|<leader>ps"] = map_cr("Lazy sync"):with_silent():with_noremap():with_nowait():with_desc("package: Sync"),
["n|<leader>pu"] = map_cr("Lazy update")
:with_silent()
:with_noremap()
:with_nowait()
:with_desc("package: Update"),
["n|<leader>pi"] = map_cr("Lazy install")
:with_silent()
:with_noremap()
:with_nowait()
:with_desc("package: Install"),
["n|<leader>pl"] = map_cr("Lazy log"):with_silent():with_noremap():with_nowait():with_desc("package: Log"),
["n|<leader>pc"] = map_cr("Lazy check"):with_silent():with_noremap():with_nowait():with_desc("package: Check"),
["n|<leader>pd"] = map_cr("Lazy debug"):with_silent():with_noremap():with_nowait():with_desc("package: Debug"),
["n|<leader>pp"] = map_cr("Lazy profile")
:with_silent()
:with_noremap()
:with_nowait()
:with_desc("package: Profile"),
["n|<leader>pr"] = map_cr("Lazy restore")
:with_silent()
:with_noremap()
:with_nowait()
:with_desc("package: Restore"),
["n|<leader>px"] = map_cr("Lazy clean"):with_silent():with_noremap():with_nowait():with_desc("package: Clean"),
},
}
bind.nvim_load_mapping(plug_map)
bind.nvim_load_mapping(mappings.core)
-- Plugin keymaps
-- Builtin & Plugin keymaps
require("keymap.completion")
require("keymap.editor")
require("keymap.lang")
@@ -29,7 +44,7 @@ require("keymap.tool")
require("keymap.ui")
-- User keymaps
local ok, mappings = pcall(require, "user.keymap.init")
local ok, def = pcall(require, "user.keymap.init")
if ok then
require("modules.utils.keymap").replace(mappings)
require("modules.utils.keymap").replace(def)
end
+11 -12
View File
@@ -1,17 +1,16 @@
local bind = require("keymap.bind")
local map_cr = bind.map_cr
-- local map_cu = bind.map_cu
-- local map_cmd = bind.map_cmd
-- local map_callback = bind.map_callback
local plug_map = {
-- Plugin render-markdown.nvim
["n|<F1>"] = map_cr("RenderMarkdown toggle")
:with_noremap()
:with_silent()
:with_desc("tool: toggle markdown preview within nvim"),
-- Plugin MarkdownPreview
["n|<F12>"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"),
local mappings = {
plugins = {
-- Plugin: render-markdown.nvim
["n|<F1>"] = map_cr("RenderMarkdown toggle")
:with_noremap()
:with_silent()
:with_desc("tool: toggle markdown preview within nvim"),
-- Plugin: MarkdownPreview
["n|<F12>"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"),
},
}
bind.nvim_load_mapping(plug_map)
bind.nvim_load_mapping(mappings.plugins)
+201 -176
View File
@@ -1,3 +1,4 @@
local vim_path = require("core.global").vim_path
local bind = require("keymap.bind")
local map_cr = bind.map_cr
local map_cu = bind.map_cu
@@ -5,187 +6,211 @@ local map_cmd = bind.map_cmd
local map_callback = bind.map_callback
require("keymap.helpers")
local plug_map = {
-- Plugin: vim-fugitive
["n|gps"] = map_cr("G push"):with_noremap():with_silent():with_desc("git: Push"),
["n|gpl"] = map_cr("G pull"):with_noremap():with_silent():with_desc("git: Pull"),
["n|<leader>gG"] = map_cu("Git"):with_noremap():with_silent():with_desc("git: Open git-fugitive"),
local mappings = {
plugins = {
-- Plugin: edgy
["n|<C-n>"] = map_callback(function()
require("edgy").toggle("left")
end)
:with_noremap()
:with_silent()
:with_desc("filetree: Toggle"),
-- Plugin: nvim-tree
["n|<C-n>"] = map_cr("NvimTreeToggle"):with_noremap():with_silent():with_desc("filetree: Toggle"),
["n|<leader>nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent():with_desc("filetree: Find file"),
["n|<leader>nr"] = map_cr("NvimTreeRefresh"):with_noremap():with_silent():with_desc("filetree: Refresh"),
-- Plugin: vim-fugitive
["n|gps"] = map_cr("G push"):with_noremap():with_silent():with_desc("git: Push"),
["n|gpl"] = map_cr("G pull"):with_noremap():with_silent():with_desc("git: Pull"),
["n|<leader>gG"] = map_cu("Git"):with_noremap():with_silent():with_desc("git: Open git-fugitive"),
-- Plugin: sniprun
["v|<leader>r"] = map_cr("SnipRun"):with_noremap():with_silent():with_desc("tool: Run code by range"),
["n|<leader>r"] = map_cu([[%SnipRun]]):with_noremap():with_silent():with_desc("tool: Run code by file"),
-- Plugin: nvim-tree
["n|<leader>nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent():with_desc("filetree: Find file"),
["n|<leader>nr"] = map_cr("NvimTreeRefresh"):with_noremap():with_silent():with_desc("filetree: Refresh"),
-- Plugin: toggleterm
["t|<Esc><Esc>"] = map_cmd([[<C-\><C-n>]]):with_noremap():with_silent(), -- switch to normal mode in terminal.
["n|<C-\\>"] = map_cr("ToggleTerm direction=horizontal")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle horizontal"),
["i|<C-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=horizontal<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle horizontal"),
["t|<C-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle horizontal"),
["n|<A-\\>"] = map_cr("ToggleTerm direction=vertical")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["i|<A-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["t|<A-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"),
["n|<F5>"] = map_cr("ToggleTerm direction=vertical")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["i|<F5>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["t|<F5>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"),
["n|<A-d>"] = map_cr("ToggleTerm direction=float"):with_noremap():with_silent():with_desc("terminal: Toggle float"),
["i|<A-d>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=float<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle float"),
["t|<A-d>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle float"),
["n|<leader>gg"] = map_callback(function()
_toggle_lazygit()
end)
:with_noremap()
:with_silent()
:with_desc("git: Toggle lazygit"),
-- Plugin: sniprun
["v|<leader>r"] = map_cr("SnipRun"):with_noremap():with_silent():with_desc("tool: Run code by range"),
["n|<leader>r"] = map_cu([[%SnipRun]]):with_noremap():with_silent():with_desc("tool: Run code by file"),
-- Plugin: trouble
["n|gt"] = map_cr("Trouble diagnostics toggle"):with_noremap():with_silent():with_desc("lsp: Toggle trouble list"),
["n|<leader>lw"] = map_cr("Trouble diagnostics toggle")
:with_noremap()
:with_silent()
:with_desc("lsp: Show workspace diagnostics"),
["n|<leader>lp"] = map_cr("Trouble project_diagnostics toggle")
:with_noremap()
:with_silent()
:with_desc("lsp: Show project diagnostics"),
["n|<leader>ld"] = map_cr("Trouble diagnostics toggle filter.buf=0")
:with_noremap()
:with_silent()
:with_desc("lsp: Show document diagnostics"),
-- Plugin: toggleterm
["t|<Esc><Esc>"] = map_cmd([[<C-\><C-n>]]):with_noremap():with_silent(), -- switch to normal mode in terminal.
["n|<C-\\>"] = map_cr("ToggleTerm direction=horizontal")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle horizontal"),
["i|<C-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=horizontal<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle horizontal"),
["t|<C-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle horizontal"),
["n|<A-\\>"] = map_cr("ToggleTerm direction=vertical")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["i|<A-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["t|<A-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["n|<F5>"] = map_cr("ToggleTerm direction=vertical")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["i|<F5>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle vertical"),
["t|<F5>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"),
["n|<A-d>"] = map_cr("ToggleTerm direction=float")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle float"),
["i|<A-d>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=float<CR>")
:with_noremap()
:with_silent()
:with_desc("terminal: Toggle float"),
["t|<A-d>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle float"),
["n|<leader>gg"] = map_callback(function()
_toggle_lazygit()
end)
:with_noremap()
:with_silent()
:with_desc("git: Toggle lazygit"),
-- Plugin: telescope
["n|<C-p>"] = map_callback(function()
_command_panel()
end)
:with_noremap()
:with_silent()
:with_desc("tool: Toggle command panel"),
["n|<leader>fc"] = map_callback(function()
_telescope_collections(require("telescope.themes").get_dropdown())
end)
:with_noremap()
:with_silent()
:with_desc("tool: Open Telescope collections"),
["n|<leader>ff"] = map_callback(function()
require("search").open({ collection = "file" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Find files"),
["n|<leader>fp"] = map_callback(function()
require("search").open({ collection = "pattern" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Find patterns"),
["v|<leader>fs"] = map_cu("Telescope grep_string")
:with_noremap()
:with_silent()
:with_desc("tool: Find word under cursor"),
["n|<leader>fg"] = map_callback(function()
require("search").open({ collection = "git" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Locate Git objects"),
["n|<leader>fd"] = map_callback(function()
require("search").open({ collection = "dossier" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Retrieve dossiers"),
["n|<leader>fm"] = map_callback(function()
require("search").open({ collection = "misc" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Miscellaneous"),
-- Plugin: trouble
["n|gt"] = map_cr("Trouble diagnostics toggle")
:with_noremap()
:with_silent()
:with_desc("lsp: Toggle trouble list"),
["n|<leader>lw"] = map_cr("Trouble diagnostics toggle")
:with_noremap()
:with_silent()
:with_desc("lsp: Show workspace diagnostics"),
["n|<leader>lp"] = map_cr("Trouble project_diagnostics toggle")
:with_noremap()
:with_silent()
:with_desc("lsp: Show project diagnostics"),
["n|<leader>ld"] = map_cr("Trouble diagnostics toggle filter.buf=0")
:with_noremap()
:with_silent()
:with_desc("lsp: Show document diagnostics"),
-- Plugin: dap
["n|<F6>"] = map_callback(function()
require("dap").continue()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Run/Continue"),
["n|<F7>"] = map_callback(function()
require("dap").terminate()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Stop"),
["n|<F8>"] = map_callback(function()
require("dap").toggle_breakpoint()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Toggle breakpoint"),
["n|<F9>"] = map_callback(function()
require("dap").step_into()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Step into"),
["n|<F10>"] = map_callback(function()
require("dap").step_out()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Step out"),
["n|<F11>"] = map_callback(function()
require("dap").step_over()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Step over"),
["n|<leader>db"] = map_callback(function()
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
end)
:with_noremap()
:with_silent()
:with_desc("debug: Set breakpoint with condition"),
["n|<leader>dc"] = map_callback(function()
require("dap").run_to_cursor()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Run to cursor"),
["n|<leader>dl"] = map_callback(function()
require("dap").run_last()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Run last"),
["n|<leader>do"] = map_callback(function()
require("dap").repl.open()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Open REPL"),
-- Plugin: telescope
["n|<C-p>"] = map_callback(function()
_command_panel()
end)
:with_noremap()
:with_silent()
:with_desc("tool: Toggle command panel"),
["n|<leader>fc"] = map_callback(function()
_telescope_collections(require("telescope.themes").get_dropdown())
end)
:with_noremap()
:with_silent()
:with_desc("tool: Open Telescope collections"),
["n|<leader>ff"] = map_callback(function()
require("search").open({ collection = "file" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Find files"),
["n|<leader>fp"] = map_callback(function()
require("search").open({ collection = "pattern" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Find patterns"),
["v|<leader>fs"] = map_callback(function()
local opts = vim.fn.getcwd() == vim_path and { additional_args = { "--no-ignore" } } or {}
require("telescope-live-grep-args.shortcuts").grep_visual_selection(opts)
end)
:with_noremap()
:with_silent()
:with_desc("tool: Find word under cursor"),
["n|<leader>fg"] = map_callback(function()
require("search").open({ collection = "git" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Locate Git objects"),
["n|<leader>fd"] = map_callback(function()
require("search").open({ collection = "dossier" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Retrieve dossiers"),
["n|<leader>fm"] = map_callback(function()
require("search").open({ collection = "misc" })
end)
:with_noremap()
:with_silent()
:with_desc("tool: Miscellaneous"),
-- Plugin: dap
["n|<F6>"] = map_callback(function()
require("dap").continue()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Run/Continue"),
["n|<F7>"] = map_callback(function()
require("dap").terminate()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Stop"),
["n|<F8>"] = map_callback(function()
require("dap").toggle_breakpoint()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Toggle breakpoint"),
["n|<F9>"] = map_callback(function()
require("dap").step_into()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Step into"),
["n|<F10>"] = map_callback(function()
require("dap").step_out()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Step out"),
["n|<F11>"] = map_callback(function()
require("dap").step_over()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Step over"),
["n|<leader>db"] = map_callback(function()
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
end)
:with_noremap()
:with_silent()
:with_desc("debug: Set breakpoint with condition"),
["n|<leader>dc"] = map_callback(function()
require("dap").run_to_cursor()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Run to cursor"),
["n|<leader>dl"] = map_callback(function()
require("dap").run_last()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Run last"),
["n|<leader>do"] = map_callback(function()
require("dap").repl.open()
end)
:with_noremap()
:with_silent()
:with_desc("debug: Open REPL"),
},
}
bind.nvim_load_mapping(plug_map)
bind.nvim_load_mapping(mappings.plugins)
+147 -81
View File
@@ -1,105 +1,171 @@
local bind = require("keymap.bind")
local map_cr = bind.map_cr
-- local map_cu = bind.map_cu
-- local map_cmd = bind.map_cmd
-- local map_callback = bind.map_callback
local map_cu = bind.map_cu
local map_cmd = bind.map_cmd
local map_callback = bind.map_callback
local plug_map = {
-- Plugin: bufferline.nvim
["n|<A-i>"] = map_cr("BufferLineCycleNext"):with_noremap():with_silent():with_desc("buffer: Switch to next"),
["n|<A-o>"] = map_cr("BufferLineCyclePrev"):with_noremap():with_silent():with_desc("buffer: Switch to prev"),
["n|<A-S-i>"] = map_cr("BufferLineMoveNext"):with_noremap():with_silent():with_desc("buffer: Move current to next"),
["n|<A-S-o>"] = map_cr("BufferLineMovePrev"):with_noremap():with_silent():with_desc("buffer: Move current to prev"),
["n|<leader>be"] = map_cr("BufferLineSortByExtension"):with_noremap():with_desc("buffer: Sort by extension"),
["n|<leader>bd"] = map_cr("BufferLineSortByDirectory"):with_noremap():with_desc("buffer: Sort by directory"),
["n|<A-1>"] = map_cr("BufferLineGoToBuffer 1"):with_noremap():with_silent():with_desc("buffer: Goto buffer 1"),
["n|<A-2>"] = map_cr("BufferLineGoToBuffer 2"):with_noremap():with_silent():with_desc("buffer: Goto buffer 2"),
["n|<A-3>"] = map_cr("BufferLineGoToBuffer 3"):with_noremap():with_silent():with_desc("buffer: Goto buffer 3"),
["n|<A-4>"] = map_cr("BufferLineGoToBuffer 4"):with_noremap():with_silent():with_desc("buffer: Goto buffer 4"),
["n|<A-5>"] = map_cr("BufferLineGoToBuffer 5"):with_noremap():with_silent():with_desc("buffer: Goto buffer 5"),
["n|<A-6>"] = map_cr("BufferLineGoToBuffer 6"):with_noremap():with_silent():with_desc("buffer: Goto buffer 6"),
["n|<A-7>"] = map_cr("BufferLineGoToBuffer 7"):with_noremap():with_silent():with_desc("buffer: Goto buffer 7"),
["n|<A-8>"] = map_cr("BufferLineGoToBuffer 8"):with_noremap():with_silent():with_desc("buffer: Goto buffer 8"),
["n|<A-9>"] = map_cr("BufferLineGoToBuffer 9"):with_noremap():with_silent():with_desc("buffer: Goto buffer 9"),
local mappings = {
builtins = {
-- Builtins: Buffer
["n|<leader>bn"] = map_cu("enew"):with_noremap():with_silent():with_desc("buffer: New"),
-- Builtins: Terminal
["t|<C-w>h"] = map_cmd("<Cmd>wincmd h<CR>"):with_silent():with_noremap():with_desc("window: Focus left"),
["t|<C-w>l"] = map_cmd("<Cmd>wincmd l<CR>"):with_silent():with_noremap():with_desc("window: Focus right"),
["t|<C-w>j"] = map_cmd("<Cmd>wincmd j<CR>"):with_silent():with_noremap():with_desc("window: Focus down"),
["t|<C-w>k"] = map_cmd("<Cmd>wincmd k<CR>"):with_silent():with_noremap():with_desc("window: Focus up"),
-- Builtins: Tabpage
["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"),
["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"),
["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"),
["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"),
},
plugins = {
-- Plugin: nvim-bufdel
["n|<A-q>"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"),
-- Plugin: bufferline.nvim
["n|<A-i>"] = map_cr("BufferLineCycleNext"):with_noremap():with_silent():with_desc("buffer: Switch to next"),
["n|<A-o>"] = map_cr("BufferLineCyclePrev"):with_noremap():with_silent():with_desc("buffer: Switch to prev"),
["n|<A-S-i>"] = map_cr("BufferLineMoveNext")
:with_noremap()
:with_silent()
:with_desc("buffer: Move current to next"),
["n|<A-S-o>"] = map_cr("BufferLineMovePrev")
:with_noremap()
:with_silent()
:with_desc("buffer: Move current to prev"),
["n|<leader>be"] = map_cr("BufferLineSortByExtension"):with_noremap():with_desc("buffer: Sort by extension"),
["n|<leader>bd"] = map_cr("BufferLineSortByDirectory"):with_noremap():with_desc("buffer: Sort by directory"),
["n|<A-1>"] = map_cr("BufferLineGoToBuffer 1"):with_noremap():with_silent():with_desc("buffer: Goto buffer 1"),
["n|<A-2>"] = map_cr("BufferLineGoToBuffer 2"):with_noremap():with_silent():with_desc("buffer: Goto buffer 2"),
["n|<A-3>"] = map_cr("BufferLineGoToBuffer 3"):with_noremap():with_silent():with_desc("buffer: Goto buffer 3"),
["n|<A-4>"] = map_cr("BufferLineGoToBuffer 4"):with_noremap():with_silent():with_desc("buffer: Goto buffer 4"),
["n|<A-5>"] = map_cr("BufferLineGoToBuffer 5"):with_noremap():with_silent():with_desc("buffer: Goto buffer 5"),
["n|<A-6>"] = map_cr("BufferLineGoToBuffer 6"):with_noremap():with_silent():with_desc("buffer: Goto buffer 6"),
["n|<A-7>"] = map_cr("BufferLineGoToBuffer 7"):with_noremap():with_silent():with_desc("buffer: Goto buffer 7"),
["n|<A-8>"] = map_cr("BufferLineGoToBuffer 8"):with_noremap():with_silent():with_desc("buffer: Goto buffer 8"),
["n|<A-9>"] = map_cr("BufferLineGoToBuffer 9"):with_noremap():with_silent():with_desc("buffer: Goto buffer 9"),
-- Plugin: smart-splits.nvim
["n|<A-h>"] = map_cu("SmartResizeLeft")
:with_silent()
:with_noremap()
:with_desc("window: Resize -3 horizontally"),
["n|<A-j>"] = map_cu("SmartResizeDown"):with_silent():with_noremap():with_desc("window: Resize -3 vertically"),
["n|<A-k>"] = map_cu("SmartResizeUp"):with_silent():with_noremap():with_desc("window: Resize +3 vertically"),
["n|<A-l>"] = map_cu("SmartResizeRight")
:with_silent()
:with_noremap()
:with_desc("window: Resize +3 horizontally"),
["n|<C-h>"] = map_cu("SmartCursorMoveLeft"):with_silent():with_noremap():with_desc("window: Focus left"),
["n|<C-j>"] = map_cu("SmartCursorMoveDown"):with_silent():with_noremap():with_desc("window: Focus down"),
["n|<C-k>"] = map_cu("SmartCursorMoveUp"):with_silent():with_noremap():with_desc("window: Focus up"),
["n|<C-l>"] = map_cu("SmartCursorMoveRight"):with_silent():with_noremap():with_desc("window: Focus right"),
["n|<leader>Wh"] = map_cu("SmartSwapLeft")
:with_silent()
:with_noremap()
:with_desc("window: Move window leftward"),
["n|<leader>Wj"] = map_cu("SmartSwapDown")
:with_silent()
:with_noremap()
:with_desc("window: Move window downward"),
["n|<leader>Wk"] = map_cu("SmartSwapUp"):with_silent():with_noremap():with_desc("window: Move window upward"),
["n|<leader>Wl"] = map_cu("SmartSwapRight")
:with_silent()
:with_noremap()
:with_desc("window: Move window rightward"),
},
}
bind.nvim_load_mapping(plug_map)
bind.nvim_load_mapping(mappings.builtins)
bind.nvim_load_mapping(mappings.plugins)
local mapping = {}
--- The following code enables this file to be exported ---
--- for use with gitsigns lazy-loaded keymap bindings ---
function mapping.gitsigns(buf)
local actions = require("gitsigns.actions")
local M = {}
function M.gitsigns(bufnr)
local gitsigns = require("gitsigns")
local map = {
["n|]g"] = bind.map_callback(function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
actions.next_hunk()
["n|]g"] = map_callback(function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
gitsigns.nav_hunk("next")
end)
return "<Ignore>"
end)
return "<Ignore>"
end)
:with_buffer(buf)
:with_buffer(bufnr)
:with_noremap()
:with_expr()
:with_desc("git: Goto next hunk"),
["n|[g"] = bind.map_callback(function()
if vim.wo.diff then
return "[g"
end
vim.schedule(function()
actions.prev_hunk()
["n|[g"] = map_callback(function()
if vim.wo.diff then
return "[g"
end
vim.schedule(function()
gitsigns.nav_hunk("prev")
end)
return "<Ignore>"
end)
return "<Ignore>"
end)
:with_buffer(buf)
:with_buffer(bufnr)
:with_noremap()
:with_expr()
:with_desc("git: Goto prev hunk"),
["n|<leader>gs"] = bind.map_callback(function()
actions.stage_hunk()
end)
:with_buffer(buf)
:with_desc("git: Stage hunk"),
["v|<leader>gs"] = bind.map_callback(function()
actions.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
:with_buffer(buf)
:with_desc("git: Stage hunk"),
["n|<leader>gu"] = bind.map_callback(function()
actions.undo_stage_hunk()
end)
:with_buffer(buf)
:with_desc("git: Undo stage hunk"),
["n|<leader>gr"] = bind.map_callback(function()
actions.reset_hunk()
end)
:with_buffer(buf)
["n|<leader>gs"] = map_callback(function()
gitsigns.stage_hunk()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Toggle staging/unstaging of hunk"),
["v|<leader>gs"] = map_callback(function()
gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Toggle staging/unstaging of selected hunk"),
["n|<leader>gr"] = map_callback(function()
gitsigns.reset_hunk()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Reset hunk"),
["v|<leader>gr"] = bind.map_callback(function()
actions.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
:with_buffer(buf)
["v|<leader>gr"] = map_callback(function()
gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Reset hunk"),
["n|<leader>gR"] = bind.map_callback(function()
actions.reset_buffer()
end)
:with_buffer(buf)
["n|<leader>gR"] = map_callback(function()
gitsigns.reset_buffer()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Reset buffer"),
["n|<leader>gp"] = bind.map_callback(function()
actions.preview_hunk()
end)
:with_buffer(buf)
["n|<leader>gp"] = map_callback(function()
gitsigns.preview_hunk()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Preview hunk"),
["n|<leader>gb"] = bind.map_callback(function()
actions.blame_line({ full = true })
end)
:with_buffer(buf)
["n|<leader>gb"] = map_callback(function()
gitsigns.blame_line({ full = true })
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Blame line"),
-- Text objects
["ox|ih"] = bind.map_callback(function()
actions.text_object()
end):with_buffer(buf),
["ox|ih"] = map_callback(function()
gitsigns.select_hunk()
end)
:with_buffer(bufnr)
:with_noremap(),
}
bind.nvim_load_mapping(map)
end
return mapping
return M
@@ -1,80 +0,0 @@
return function()
require("modules.utils").load_plugin("aerial", {
lazy_load = false,
close_on_select = true,
highlight_on_jump = false,
disable_max_lines = 8500,
disable_max_size = 1000000,
ignore = { filetypes = { "NvimTree", "terminal", "nofile" } },
-- Use symbol tree for folding. Set to true or false to enable/disable
-- Set to "auto" to manage folds if your previous foldmethod was 'manual'
-- This can be a filetype map (see :help aerial-filetype-map)
manage_folds = "auto",
layout = {
-- Determines the default direction to open the aerial window. The 'prefer'
-- options will open the window in the other direction *if* there is a
-- different buffer in the way of the preferred direction
-- Enum: prefer_right, prefer_left, right, left, float
default_direction = "prefer_right",
},
-- Keymaps in aerial window. Can be any value that `vim.keymap.set` accepts OR a table of keymap
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
-- Additionally, if it is a string that matches "actions.<name>",
-- it will use the mapping at require("aerial.actions").<name>
-- Set to `false` to remove a keymap
keymaps = {
["?"] = "actions.show_help",
["g?"] = "actions.show_help",
["<CR>"] = "actions.jump",
["<2-LeftMouse>"] = "actions.jump",
["<C-v>"] = "actions.jump_vsplit",
["<C-s>"] = "actions.jump_split",
["<C-d>"] = "actions.down_and_scroll",
["<C-u>"] = "actions.up_and_scroll",
["{"] = "actions.prev",
["}"] = "actions.next",
["[["] = "actions.prev_up",
["]]"] = "actions.next_up",
["q"] = "actions.close",
["o"] = "actions.tree_toggle",
["O"] = "actions.tree_toggle_recursive",
["zr"] = "actions.tree_increase_fold_level",
["zR"] = "actions.tree_open_all",
["zm"] = "actions.tree_decrease_fold_level",
["zM"] = "actions.tree_close_all",
["zx"] = "actions.tree_sync_folds",
["zX"] = "actions.tree_sync_folds",
},
-- A list of all symbols to display. Set to false to display all symbols.
-- This can be a filetype map (see :help aerial-filetype-map)
-- To see all available values, see :help SymbolKind
filter_kind = {
"Array",
"Boolean",
"Class",
"Constant",
"Constructor",
"Enum",
"EnumMember",
"Event",
"Field",
"File",
"Function",
"Interface",
"Key",
"Method",
"Module",
"Namespace",
"Null",
-- "Number",
"Object",
"Operator",
"Package",
-- "Property",
-- "String",
"Struct",
-- "TypeParameter",
-- "Variable",
},
})
end
@@ -8,6 +8,13 @@ local format_modifications_only = settings.format_modifications_only
local server_formatting_block_list = settings.server_formatting_block_list
local format_timeout = settings.format_timeout
vim.api.nvim_create_user_command("Format", function()
M.format({
timeout = format_timeout,
filter = M.format_filter,
})
end, {})
vim.api.nvim_create_user_command("FormatToggle", function()
M.toggle_format_on_save()
end, {})
@@ -118,7 +125,7 @@ function M.format(opts)
end
local bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ buffer = bufnr })
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if opts.filter then
clients = opts.filter(clients)
@@ -1,14 +1,20 @@
return function()
local snippet_path = vim.fn.stdpath("config") .. "/snips/"
if not vim.tbl_contains(vim.opt.rtp:get(), snippet_path) then
vim.opt.rtp:append(snippet_path)
end
local vim_path = require("core.global").vim_path
local snippet_path = vim_path .. "/snips/"
local user_snippet_path = vim_path .. "/lua/user/snips/"
require("modules.utils").load_plugin("luasnip", {
history = true,
update_events = "TextChanged,TextChangedI",
delete_check_events = "TextChanged,InsertLeave",
}, false, require("luasnip").config.set_config)
require("luasnip.loaders.from_vscode").lazy_load({
paths = {
snippet_path,
user_snippet_path,
},
})
require("luasnip.loaders.from_lua").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()
@@ -52,10 +52,12 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
end
local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name)
local default_ok, default_handler = pcall(require, "completion.servers." .. lsp_name)
-- Use preset if there is no user definition
if not ok then
ok, custom_handler = pcall(require, "completion.servers." .. lsp_name)
ok, custom_handler = default_ok, default_handler
end
if not ok then
-- Default to use factory config for server(s) that doesn't include a spec
nvim_lsp[lsp_name].setup(opts)
@@ -66,7 +68,14 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
--- See `clangd.lua` for example.
custom_handler(opts)
elseif type(custom_handler) == "table" then
nvim_lsp[lsp_name].setup(vim.tbl_deep_extend("force", opts, custom_handler))
nvim_lsp[lsp_name].setup(
vim.tbl_deep_extend(
"force",
opts,
type(default_handler) == "table" and default_handler or {},
custom_handler
)
)
else
vim.notify(
string.format(
@@ -83,7 +83,9 @@ M.setup = function()
)
end,
on_stderr = function(_, msg_stream)
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
if msg_stream then
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
end
end,
})
:start()
@@ -17,7 +17,7 @@ return function()
-- Don't specify any config here if you are using the default one.
local sources = {
btns.formatting.clang_format.with({
filetypes = { "c", "cpp", "objc", "objcpp", "cs", "java", "cuda", "proto" },
filetypes = { "c", "cpp", "objc", "objcpp", "cs", "cuda", "proto" },
extra_args = formatter_args("clang_format"),
}),
btns.formatting.prettier.with({
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/bashls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/bashls.lua
return {
cmd = { "bash-language-server", "start" },
filetypes = { "bash", "sh" },
@@ -33,7 +33,7 @@ local function get_binary_path_list(binaries)
return table.concat(path_list, ",")
end
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/clangd.lua
return function(options)
require("lspconfig").clangd.setup({
on_attach = options.on_attach,
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/dartls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/dartls.lua
return {
cmd = { "dart", "language-server", "--protocol=lsp" },
filetypes = { "dart" },
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/gopls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/gopls.lua
return {
cmd = { "gopls", "-remote.debug=:0", "-remote=auto" },
filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" },
@@ -31,11 +31,11 @@ return {
gopls = {
staticcheck = true,
semanticTokens = true,
noSemanticString = true,
usePlaceholders = true,
completeUnimported = true,
symbolMatcher = "Fuzzy",
buildFlags = { "-tags", "integration" },
semanticTokenTypes = { string = false },
codelenses = {
generate = true,
gc_details = true,
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jsonls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/jsonls.lua
return {
flags = { debounce_text_changes = 500 },
settings = {
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/lua_ls.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/lua_ls.lua
return {
settings = {
Lua = {
@@ -1,4 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/pylsp.lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/pylsp.lua
return {
cmd = { "pylsp" },
filetypes = { "python" },
@@ -0,0 +1,7 @@
return function()
require("mini.cursorword").setup({
-- Delay (in ms) between when cursor moved and when highlighting appeared
delay = 200,
})
require("modules.utils").gen_cursorword_hl()
end
@@ -0,0 +1,20 @@
return function()
vim.g.maplocalleader = ","
require("modules.utils").load_plugin("grug-far", {
engine = "ripgrep",
engines = {
ripgrep = {
path = "rg",
showReplaceDiff = true,
placeholders = {
enabled = true,
},
},
},
windowCreationCommand = "bot split",
disableBufferLineNumbers = false,
icons = {
enabled = true,
},
})
end
@@ -1,6 +0,0 @@
return function()
require("modules.utils").load_plugin("local-highlight", {
hlgroup = "IlluminatedWordText",
insert_mode = false,
})
end
@@ -0,0 +1,5 @@
return function()
vim.g.matchup_transmute_enabled = 1
vim.g.matchup_surround_enabled = 1
vim.g.matchup_matchparen_offscreen = { method = "popup" }
end
@@ -10,7 +10,6 @@ return function()
require("modules.utils").load_plugin("crates", {
smart_insert = true,
insert_closing_quote = true,
avoid_prerelease = true,
autoload = true,
autoupdate = true,
autoupdate_throttle = 250,
@@ -19,7 +18,6 @@ return function()
thousands_separator = ",",
notification_title = "Crates",
curl_args = { "-sL", "--retry", "1" },
disable_invalid_feature_diagnostic = false,
text = {
loading = " " .. icons.misc.Watch .. "Loading",
version = " " .. icons.ui.Check .. "%s",
@@ -5,20 +5,43 @@ return function()
misc = require("modules.utils.icons").get("misc", true),
ui = require("modules.utils.icons").get("ui", true),
}
local utils = require("dropbar.utils")
local sources = require("dropbar.sources")
-- Custom source to display only the leaf filename in the dropbar
sources.symbols = {
get_symbols = function(buf, win, cursor)
local symbols = sources.path.get_symbols(buf, win, cursor)
return { symbols[#symbols] }
end,
}
require("modules.utils").load_plugin("dropbar", {
bar = {
hover = false,
truncate = true,
pick = { pivots = "etovxqpdygfblzhckisuran" },
sources = function(buf)
if vim.bo[buf].ft == "markdown" then
return {
sources.symbols,
sources.markdown,
}
end
if vim.bo[buf].buftype == "terminal" then
return {
sources.terminal,
}
end
return {
sources.symbols,
utils.source.fallback({
sources.lsp,
sources.treesitter,
}),
}
end,
},
sources = {
path = {
relative_to = function()
-- Only show the leaf filename in dropbar
return vim.fn.expand("%:p:h")
end,
},
terminal = {
name = function(buf)
local name = vim.api.nvim_buf_get_name(buf)
@@ -35,7 +58,6 @@ return function()
icons = {
enable = true,
kinds = {
use_devicons = true,
symbols = {
-- Type
Array = icons.type.Array,
@@ -1,6 +1,7 @@
return function()
local builtin = require("telescope.builtin")
local extensions = require("telescope").extensions
local vim_path = require("core.global").vim_path
require("modules.utils").load_plugin("search", {
collections = {
@@ -12,7 +13,9 @@ return function()
name = "Files",
tele_func = function(opts)
opts = opts or {}
if vim.fn.isdirectory(".git") == 1 then
if vim.fn.getcwd() == vim_path then
builtin.find_files(vim.tbl_deep_extend("force", opts, { no_ignore = true }))
elseif vim.fn.isdirectory(".git") == 1 then
builtin.git_files(opts)
else
builtin.find_files(opts)
@@ -46,13 +49,20 @@ return function()
{
name = "Word in project",
tele_func = function()
extensions.live_grep_args.live_grep_args()
local opts = {}
if vim.fn.getcwd() == vim_path then
opts["additional_args"] = { "--no-ignore" }
end
extensions.live_grep_args.live_grep_args(opts)
end,
},
{
name = "Word under cursor",
tele_func = function(opts)
opts = opts or {}
if vim.fn.getcwd() == vim_path then
opts["additional_args"] = { "--no-ignore" }
end
builtin.grep_string(opts)
end,
},
@@ -44,13 +44,6 @@ return function()
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
extensions = {
aerial = {
show_lines = false,
show_nesting = {
["_"] = false, -- This key will be the default
lua = true, -- You can set the option for specific filetypes
},
},
fzf = {
fuzzy = false,
override_generic_sorter = true,
@@ -97,6 +90,5 @@ return function()
require("telescope").load_extension("undo")
require("telescope").load_extension("zoxide")
require("telescope").load_extension("persisted")
require("telescope").load_extension("aerial")
require("telescope").load_extension("advanced_git_search")
end
@@ -8,21 +8,11 @@ return function()
return vim.o.columns * 0.40
end
end,
on_open = function(term)
on_open = function()
-- Prevent infinite calls from freezing neovim.
-- Only set these options specific to this terminal buffer.
vim.api.nvim_set_option_value("foldmethod", "manual", { scope = "local" })
vim.api.nvim_set_option_value("foldexpr", "0", { scope = "local" })
-- Prevent horizontal terminal from obscuring `nvim-tree`.
local api = require("nvim-tree.api")
local tree = require("nvim-tree.view")
if tree.is_visible() and term.direction == "horizontal" then
local width = vim.fn.winwidth(tree.get_winnr())
api.tree.toggle()
tree.View.width = width
api.tree.toggle(false, true)
end
end,
highlights = {
Normal = {
@@ -34,8 +34,8 @@ return function()
padding = 0,
},
{
filetype = "aerial",
text = "Symbol Outline",
filetype = "trouble",
text = "LSP Outline",
text_align = "center",
padding = 0,
},
@@ -30,7 +30,23 @@ return function()
properties = {},
},
integrations = {
treesitter = true,
cmp = true,
dap = true,
dap_ui = true,
diffview = true,
dropbar = { enabled = true, color_mode = true },
fidget = true,
flash = true,
fzf = true,
gitsigns = true,
grug_far = true,
hop = true,
indent_blankline = { enabled = true, colored_indent_levels = true },
lsp_saga = true,
lsp_trouble = true,
markdown = true,
mason = true,
mini = { enabled = true, indentscope_color = "" },
native_lsp = {
enabled = true,
virtual_text = {
@@ -46,53 +62,14 @@ return function()
information = { "underline" },
},
},
aerial = true,
alpha = false,
barbar = false,
beacon = false,
cmp = true,
coc_nvim = false,
dap = true,
dap_ui = true,
dashboard = false,
dropbar = { enabled = true, color_mode = true },
fern = false,
fidget = true,
flash = true,
gitgutter = false,
gitsigns = true,
harpoon = false,
headlines = false,
hop = true,
illuminate = true,
indent_blankline = { enabled = true, colored_indent_levels = false },
leap = false,
lightspeed = false,
lsp_saga = true,
lsp_trouble = true,
markdown = true,
mason = true,
mini = false,
navic = { enabled = false },
neogit = false,
neotest = false,
neotree = { enabled = false, show_root = true, transparent_panel = false },
noice = false,
notify = true,
nvimtree = true,
overseer = false,
pounce = false,
rainbow_delimiters = true,
render_markdown = true,
sandwich = false,
semantic_tokens = true,
symbols_outline = false,
telekasten = false,
telescope = { enabled = true, style = "nvchad" },
treesitter = true,
treesitter_context = true,
ts_rainbow = false,
vim_sneak = false,
vimwiki = false,
which_key = true,
},
color_overrides = {},
@@ -0,0 +1,76 @@
return function()
local trouble_filter = function(position)
return function(_, win)
return vim.w[win].trouble
and vim.w[win].trouble.position == position
and vim.w[win].trouble.type == "split"
and vim.w[win].trouble.relative == "editor"
and not vim.w[win].trouble_preview
end
end
require("modules.utils").load_plugin("edgy", {
close_when_all_hidden = true,
exit_when_last = true,
wo = { winbar = false },
keys = {
["q"] = false,
["Q"] = false,
["<C-q>"] = false,
["<A-j>"] = function(win)
win:resize("height", -2)
end,
["<A-k>"] = function(win)
win:resize("height", 2)
end,
["<A-h>"] = function(win)
win:resize("width", -2)
end,
["<A-l>"] = function(win)
win:resize("width", 2)
end,
},
bottom = {
{ ft = "qf", size = { height = 0.3 } },
{
ft = "toggleterm",
size = { height = 0.3 },
filter = function(_, win)
return vim.w[win].relative == ""
end,
},
{
ft = "help",
size = { height = 0.3 },
filter = function(buf)
return vim.bo[buf].buftype == "help"
end,
},
},
left = {
{
ft = "NvimTree",
pinned = true,
open = "NvimTreeOpen",
size = { width = 30 },
},
},
right = {
{
ft = "trouble",
pinned = true,
size = { height = 0.6, width = 0.3 },
open = "Trouble symbols toggle win.position=right",
filter = trouble_filter("right"),
},
{
ft = "trouble",
pinned = true,
collapsed = true,
size = { height = 0.4, width = 0.3 },
open = "Trouble lsp toggle win.position=right",
filter = trouble_filter("right"),
},
},
}, false, nil, true)
end
@@ -164,7 +164,7 @@ return function()
lsp = {
function()
local buf_ft = vim.bo.filetype
local clients = vim.lsp.get_clients({ buffer = vim.api.nvim_get_current_buf() })
local clients = vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() })
local lsp_lists = {}
local available_servers = {}
if next(clients) == nil then
@@ -1,37 +0,0 @@
return function()
local blend_color = require("modules.utils").gen_neodim_blend_attr()
require("modules.utils").load_plugin("neodim", {
alpha = 0.45,
blend_color = blend_color,
refresh_delay = 75, -- time in ms to wait after typing before refreshing diagnostics
hide = {
virtual_text = true,
signs = false,
underline = false,
},
priority = 80,
disable = {
"alpha",
"bigfile",
"checkhealth",
"dap-repl",
"diff",
"fugitive",
"fugitiveblame",
"git",
"gitcommit",
"help",
"log",
"notify",
"NvimTree",
"Outline",
"qf",
"TelescopePrompt",
"text",
"toggleterm",
"undotree",
"vimwiki",
},
})
end
@@ -21,11 +21,6 @@ completion["nvimdev/lspsaga.nvim"] = {
config = require("completion.lspsaga"),
dependencies = { "nvim-tree/nvim-web-devicons" },
}
completion["stevearc/aerial.nvim"] = {
lazy = true,
event = "LspAttach",
config = require("completion.aerial"),
}
completion["DNLHC/glance.nvim"] = {
lazy = true,
event = "LspAttach",
+13 -15
View File
@@ -55,17 +55,17 @@ editor["echasnovski/mini.align"] = {
event = { "CursorHold", "CursorHoldI" },
config = require("editor.align"),
}
editor["echasnovski/mini.cursorword"] = {
lazy = true,
event = { "BufReadPost", "BufAdd", "BufNewFile" },
config = require("editor.cursorword"),
}
editor["smoka7/hop.nvim"] = {
lazy = true,
version = "*",
event = { "CursorHold", "CursorHoldI" },
config = require("editor.hop"),
}
editor["tzachar/local-highlight.nvim"] = {
lazy = true,
event = { "BufReadPost", "BufAdd", "BufNewFile" },
config = require("editor.local-highlight"),
}
editor["brenoprata10/nvim-highlight-colors"] = {
lazy = true,
event = { "CursorHold", "CursorHoldI" },
@@ -84,32 +84,30 @@ editor["tpope/vim-sleuth"] = {
lazy = true,
event = { "BufNewFile", "BufReadPost", "BufFilePost" },
}
editor["nvim-pack/nvim-spectre"] = {
editor["MagicDuck/grug-far.nvim"] = {
lazy = true,
cmd = "Spectre",
cmd = "GrugFar",
config = require("editor.grug-far"),
}
editor["mrjones2014/smart-splits.nvim"] = {
lazy = true,
event = { "CursorHoldI", "CursorHold" },
config = require("editor.splits"),
}
----------------------------------------------------------------------
--  :treesitter related plugins --
----------------------------------------------------------------------
editor["nvim-treesitter/nvim-treesitter"] = {
lazy = true,
build = function()
if vim.fn.has("gui_running") == 1 then
if #vim.api.nvim_list_uis() > 0 then
vim.api.nvim_command([[TSUpdate]])
end
end,
event = "BufReadPre",
config = require("editor.treesitter"),
dependencies = {
{ "andymass/vim-matchup" },
{ "mfussenegger/nvim-treehopper" },
{ "nvim-treesitter/nvim-treesitter-textobjects" },
{
"andymass/vim-matchup",
init = require("editor.matchup"),
},
{
"windwp/nvim-ts-autotag",
config = require("editor.autotag"),
+11 -6
View File
@@ -7,9 +7,14 @@ ui["goolord/alpha-nvim"] = {
}
ui["akinsho/bufferline.nvim"] = {
lazy = true,
event = { "BufReadPost", "BufAdd", "BufNewFile" },
event = { "BufReadPre", "BufAdd", "BufNewFile" },
config = require("ui.bufferline"),
}
ui["folke/edgy.nvim"] = {
lazy = true,
event = { "BufReadPre", "BufAdd", "BufNewFile" },
config = require("ui.edgy"),
}
ui["Jint-lzxy/nvim"] = {
lazy = false,
branch = "refactor/syntax-highlighting",
@@ -36,11 +41,6 @@ ui["nvim-lualine/lualine.nvim"] = {
event = { "BufReadPost", "BufAdd", "BufNewFile" },
config = require("ui.lualine"),
}
ui["zbirenbaum/neodim"] = {
lazy = true,
event = "LspAttach",
config = require("ui.neodim"),
}
ui["karb94/neoscroll.nvim"] = {
lazy = true,
event = { "CursorHold", "CursorHoldI" },
@@ -56,6 +56,11 @@ ui["folke/paint.nvim"] = {
event = { "CursorHold", "CursorHoldI" },
config = require("ui.paint"),
}
ui["mrjones2014/smart-splits.nvim"] = {
lazy = true,
event = { "CursorHoldI", "CursorHold" },
config = require("ui.splits"),
}
ui["folke/todo-comments.nvim"] = {
lazy = true,
event = { "CursorHold", "CursorHoldI" },
+38 -16
View File
@@ -57,7 +57,7 @@ local function init_palette()
end
if not palette then
palette = vim.g.colors_name:find("catppuccin") and require("catppuccin.palettes").get_palette()
palette = (vim.g.colors_name or ""):find("catppuccin") and require("catppuccin.palettes").get_palette()
or {
rosewater = "#DC8A78",
flamingo = "#DD7878",
@@ -104,7 +104,7 @@ end
-- NOTE: If the active colorscheme isn't `catppuccin`, this function won't overwrite existing definitions
---Sets a global highlight group.
---@param name string @Highlight group name, e.g. "ErrorMsg"
---@param foreground string @The foreground color
---@param foreground? string @The foreground color
---@param background? string @The background color
---@param italic? boolean
local function set_global_hl(name, foreground, background, italic)
@@ -133,6 +133,24 @@ function M.blend(foreground, background, alpha)
return string.format("#%02x%02x%02x", blend_channel(1), blend_channel(2), blend_channel(3))
end
---Darken a color by blending it with the background color.
---@param hex string @The color in hex to darken
---@param amount number @The amount to darken the color
---@param bg string @The background color to blend with
---@return string @The darkened color as a hex string
function M.darken(hex, amount, bg)
return M.blend(hex, bg or "#000000", math.abs(amount))
end
---Lighten a color by blending it with the foreground color.
---@param hex string @The color in hex to lighten
---@param amount number @The amount to lighten the color
---@param fg string @The foreground color to blend with
---@return string @The lightened color as a hex string
function M.lighten(hex, amount, fg)
return M.blend(hex, fg or "#FFFFFF", math.abs(amount))
end
---Get RGB highlight by highlight group
---@param hl_group string @Highlight group name
---@param use_bg boolean @Returns background or not
@@ -143,7 +161,10 @@ function M.hl_to_rgb(hl_group, use_bg, fallback_hl)
local hlexists = pcall(vim.api.nvim_get_hl, 0, { name = hl_group, link = false })
if hlexists then
local result = vim.api.nvim_get_hl(0, { name = hl_group, link = false })
-- FIXME: Investigate why hl-StatusLine is undefined in toggleterm and remove this workaround
-- (@Jint-lzxy)
local link = vim.bo.filetype == "toggleterm"
local result = vim.api.nvim_get_hl(0, { name = hl_group, link = link })
if use_bg then
hex = result.bg and string.format("#%06x", result.bg) or "NONE"
else
@@ -166,6 +187,7 @@ function M.extend_hl(name, def)
local current_def = vim.api.nvim_get_hl(0, { name = name, link = false })
local combined_def = vim.tbl_deep_extend("force", current_def, def)
---@diagnostic disable-next-line: param-type-mismatch
vim.api.nvim_set_hl(0, name, combined_def)
end
@@ -235,18 +257,13 @@ function M.gen_alpha_hl()
set_global_hl("AlphaFooter", colors.yellow)
end
-- Generate blend_color for neodim.
function M.gen_neodim_blend_attr()
local trans_bg = require("core.settings").transparent_background
local appearance = require("core.settings").background
-- Generate highlight groups for cursorword. Existing attributes will NOT be overwritten
function M.gen_cursorword_hl()
local colors = M.get_palette()
if trans_bg and appearance == "dark" then
return "#000000"
elseif trans_bg and appearance == "light" then
return "#FFFFFF"
else
return M.hl_to_rgb("Normal", true)
end
-- Do not highlight `MiniCursorwordCurrent`
set_global_hl("MiniCursorword", nil, M.darken(colors.surface1, 0.7, colors.base))
set_global_hl("MiniCursorwordCurrent", nil)
end
---Convert number (0/1) to boolean
@@ -303,7 +320,8 @@ end
---@param opts nil|table @The default config to be merged with
---@param vim_plugin? boolean @If this plugin is written in vimscript or not
---@param setup_callback? function @Add new callback if the plugin needs unusual setup function
function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback)
---@param overwrite? boolean @If load user table-type config by overwriting
function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback, overwrite)
vim_plugin = vim_plugin or false
-- Get the file name of the default config
@@ -336,7 +354,11 @@ function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback)
if ok then
-- Extend base config if the returned user config is a table
if type(user_config) == "table" then
opts = tbl_recursive_merge(opts, user_config)
if overwrite == true then
opts = vim.tbl_deep_extend("force", opts, user_config)
else
opts = tbl_recursive_merge(opts, user_config)
end
setup_callback(opts)
-- Replace base config if the returned user config is a function
elseif type(user_config) == "function" then