396 lines
9.3 KiB
Lua
396 lines
9.3 KiB
Lua
---@type MappingsTable
|
|
local M = {}
|
|
|
|
M.disabled = {
|
|
n = {
|
|
["<C-a>"] = "",
|
|
["<C-s>"] = "",
|
|
["<C-c>"] = "",
|
|
["<LEADER>n"] = "",
|
|
["<LEADER>rn"] = "",
|
|
["<UP>"] = "",
|
|
["<DOWN>"] = "",
|
|
["<LEADER>x"] = "",
|
|
["<LEADER>/"] = "",
|
|
["<LEADER>ra"] = "",
|
|
["[d"] = "",
|
|
["]d"] = "",
|
|
["[c"] = "",
|
|
["]c"] = "",
|
|
["<LEADER>h"] = "",
|
|
["<LEADER>ff"] = "",
|
|
["<LEADER>fm"] = "",
|
|
["<LEADER>fa"] = "",
|
|
["<LEADER>fw"] = "",
|
|
["<LEADER>fb"] = "",
|
|
["<LEADER>fh"] = "",
|
|
["<LEADER>fo"] = "",
|
|
["<LEADER>fz"] = "",
|
|
["<LEADER>cm"] = "",
|
|
["<LEADER>gt"] = "",
|
|
["<LEADER>pt"] = "",
|
|
["<LEADER>th"] = "",
|
|
["<LEADER>ma"] = "",
|
|
["<LEADER>v"] = "",
|
|
["<LEADER>rh"] = "",
|
|
["<LEADER>ph"] = "",
|
|
["<LEADER>gb"] = "",
|
|
["<LEADER>td"] = "",
|
|
["#"] = "",
|
|
["?"] = "",
|
|
},
|
|
t = {
|
|
["<C-t>"] = "",
|
|
},
|
|
v = {
|
|
["#"] = "",
|
|
["?"] = "",
|
|
["<LEADER>/"] = "",
|
|
},
|
|
}
|
|
|
|
M.tabufline = {
|
|
plugin = true,
|
|
|
|
n = {
|
|
-- cycle through buffers
|
|
["<TAB>"] = {
|
|
function()
|
|
require("nvchad.tabufline").tabuflineNext()
|
|
end,
|
|
"Goto next buffer",
|
|
},
|
|
|
|
["<S-tab>"] = {
|
|
function()
|
|
require("nvchad.tabufline").tabuflinePrev()
|
|
end,
|
|
"Goto prev buffer",
|
|
},
|
|
|
|
-- close buffer + hide terminal buffer
|
|
["<A-c>"] = {
|
|
function()
|
|
require("nvchad.tabufline").close_buffer()
|
|
end,
|
|
"Close buffer",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.comment = {
|
|
plugin = true,
|
|
|
|
-- toggle comment in both modes
|
|
n = {
|
|
["<LEADER>v"] = {
|
|
function()
|
|
require("Comment.api").toggle.linewise.current()
|
|
end,
|
|
"Toggle comment",
|
|
},
|
|
},
|
|
|
|
v = {
|
|
["<LEADER>v"] = {
|
|
"<ESC><CMD>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
|
"Toggle comment",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.leap = {
|
|
plugin = true,
|
|
n = {
|
|
["<LEADER>s"] = {
|
|
"<PLUG>(leap-forward)",
|
|
"leap forward",
|
|
},
|
|
["<LEADER>S"] = {
|
|
"<PLUG>(leap-backward)",
|
|
"leap backward",
|
|
},
|
|
["<LEADER>gs"] = {
|
|
"<PLUG>(leap-from-window)",
|
|
"leap from window",
|
|
},
|
|
},
|
|
x = {
|
|
["<LEADER>s"] = {
|
|
"<PLUG>(leap-forward)",
|
|
"leap forward",
|
|
},
|
|
["<LEADER>S"] = {
|
|
"<PLUG>(leap-backward)",
|
|
"leap forward",
|
|
},
|
|
["<LEADER>gs"] = {
|
|
"<PLUG>(leap-from-window)",
|
|
"leap from window",
|
|
},
|
|
},
|
|
o = {
|
|
["<LEADER>s"] = {
|
|
"<PLUG>(leap-forward)",
|
|
"leap forward",
|
|
},
|
|
["<LEADER>S"] = {
|
|
"<PLUG>(leap-backward)",
|
|
"leap forward",
|
|
},
|
|
["<LEADER>gs"] = {
|
|
"<PLUG>(leap-from-window)",
|
|
"leap from window",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.lazygit = {
|
|
plugin = true,
|
|
n = {
|
|
["<LEADER>gg"] = { "<CMD> LazyGit <CR>", "Open LazyGit" },
|
|
},
|
|
}
|
|
|
|
M.lspconfig = {
|
|
plugin = true,
|
|
n = {
|
|
["<LEADER>ck"] = {
|
|
function()
|
|
vim.diagnostic.goto_prev { float = { border = "rounded" } }
|
|
end,
|
|
"Goto prev",
|
|
},
|
|
|
|
["<LEADER>cj"] = {
|
|
function()
|
|
vim.diagnostic.goto_next { float = { border = "rounded" } }
|
|
end,
|
|
"Goto next",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.clipboard = {
|
|
plugin = false,
|
|
n = {
|
|
["<LEADER>y"] = { '"+y', "yank to system" },
|
|
["<LEADER>Y"] = { '"+Y', "yank to system" },
|
|
["<LEADER>yy"] = { '"+y', "yank to system" },
|
|
},
|
|
v = {
|
|
["<LEADER>y"] = { '"+y', "yank to system" },
|
|
["<LEADER>Y"] = { '"+Y', "yank to system" },
|
|
["<LEADER>yy"] = { '"+y', "yank to system" },
|
|
},
|
|
}
|
|
|
|
M.telescope = {
|
|
plugin = true,
|
|
n = {
|
|
-- find
|
|
["<LOCALLEADER>ff"] = { "<CMD> Telescope find_files <CR>", "Find files" },
|
|
["<LOCALLEADER>fa"] = { "<CMD> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
|
|
["<LOCALLEADER>fw"] = { "<CMD> Telescope live_grep <CR>", "Live grep" },
|
|
["<LOCALLEADER>fb"] = { "<CMD> Telescope buffers <CR>", "Find buffers" },
|
|
["<LOCALLEADER>fh"] = { "<CMD> Telescope help_tags <CR>", "Help page" },
|
|
["<LOCALLEADER>fo"] = { "<CMD> Telescope oldfiles <CR>", "Find oldfiles" },
|
|
["<LOCALLEADER>fz"] = { "<CMD> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
|
|
|
|
-- git
|
|
["<LOCALLEADER>cm"] = { "<CMD> Telescope git_commits <CR>", "Git commits" },
|
|
["<LOCALLEADER>gt"] = { "<CMD> Telescope git_status <CR>", "Git status" },
|
|
|
|
-- pick a hidden term
|
|
["<LOCALLEADER>pt"] = { "<CMD> Telescope terms <CR>", "Pick hidden term" },
|
|
|
|
-- theme switcher
|
|
["<LOCALLEADER>th"] = { "<CMD> Telescope themes <CR>", "Nvchad themes" },
|
|
|
|
["<LOCALLEADER>ma"] = { "<CMD> Telescope marks <CR>", "telescope bookmarks" },
|
|
},
|
|
}
|
|
|
|
M.nvterm = {
|
|
plugin = true,
|
|
|
|
t = {
|
|
-- preserve defaults
|
|
["<F12>"] = {
|
|
function()
|
|
require("nvterm.terminal").toggle "float"
|
|
end,
|
|
"Toggle floating term",
|
|
},
|
|
},
|
|
|
|
n = {
|
|
-- preserve defaults
|
|
["<F12>"] = {
|
|
function()
|
|
require("nvterm.terminal").toggle "float"
|
|
end,
|
|
"Toggle floating term",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.nvimtree = {
|
|
plugin = true,
|
|
n = {
|
|
-- toggle
|
|
["<C-n>"] = { "<CMD> NvimTreeToggle <CR>", "Toggle nvimtree" },
|
|
["<F5>"] = { "<CMD> NvimTreeToggle <CR>", "Toggle nvimtree" },
|
|
|
|
-- focus
|
|
["<LOCALLEADER>e"] = { "<CMD> NvimTreeFocus <CR>", "Focus nvimtree" },
|
|
},
|
|
}
|
|
|
|
M.movements = {
|
|
plugin = false,
|
|
i = {
|
|
--big move
|
|
["<A-k>"] = { "<C-u>", "big step down" },
|
|
["<A-j>"] = { "<C-d>", "big step down" },
|
|
|
|
-- go to beginning and end
|
|
["<C-b>"] = { "<HOME>", "Beginning of line" },
|
|
["<C-e>"] = { "<END>", "End of line" },
|
|
|
|
-- navigate within insert mode
|
|
["<C-h>"] = { "<LEFT>", "Move left" },
|
|
["<C-l>"] = { "<RIGHT>", "Move right" },
|
|
["<C-j>"] = { "<DOWN>", "Move down" },
|
|
["<C-k>"] = { "<UP>", "Move up" },
|
|
},
|
|
n = {
|
|
--big move
|
|
["<A-k>"] = { "<C-u>", "big step down" },
|
|
["<A-j>"] = { "<C-d>", "big step down" },
|
|
|
|
-- go to beginning and end
|
|
["H"] = { "<HOME>", "Beginning of line" },
|
|
["L"] = { "<END>", "End of line" },
|
|
|
|
-- go to mark with "#"
|
|
["#"] = { "'", "go to mark" },
|
|
|
|
-- spell
|
|
["zn"] = { "]s", "go to next spelling mark"},
|
|
["zN"] = { "[s", "go to last spelling mark"},
|
|
},
|
|
v = {
|
|
--big move
|
|
["<A-k>"] = { "<C-u>", "big step down" },
|
|
["<A-j>"] = { "<C-d>", "big step down" },
|
|
|
|
-- go to beginning and end
|
|
["H"] = { "<HOME>", "Beginning of line" },
|
|
["L"] = { "<END>", "End of line" },
|
|
},
|
|
t = {
|
|
["<C-w>"] = {
|
|
vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
|
|
"Escape terminal mode",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.edit = {
|
|
plugin = false,
|
|
n = {
|
|
-- easy newline
|
|
["OO"] = { "O<ESC>", "insert a line above", opts = { nowait = false } },
|
|
["oo"] = { "o<ESC>", "insert a line below", opts = { nowait = false } },
|
|
|
|
-- split and join lines
|
|
-- "J" for join is defaul
|
|
["S"] = {
|
|
"i<CR><ESC>l",
|
|
"split line",
|
|
},
|
|
|
|
-- do something useful with the arrows
|
|
["<UP>"] = { "<CMD> move-2<CR>", "Move line up", opts = { expr = true } },
|
|
["<DOWN>"] = { "<CMD> move+<CR>", "Move line down", opts = { expr = true } },
|
|
["<LEFT>"] = { "<CMD> << <CR>", "Less indentation", opts = { expr = true } },
|
|
["<RIGHT>"] = { "<CMD> >> <CR>", "More indentation", opts = { expr = true } },
|
|
|
|
-- format with conform
|
|
["<LEADER>ff"] = {
|
|
function()
|
|
require("conform").format()
|
|
end,
|
|
"format buffer",
|
|
},
|
|
--
|
|
-- remove trailing whitespace
|
|
["<LEADER>fw"] = {
|
|
function()
|
|
require("mini.trailspace").trim()
|
|
end,
|
|
"remove whitespace",
|
|
},
|
|
},
|
|
v = {
|
|
["<LEFT>"] = { "<gv", "Less indentation" },
|
|
["<RIGHT>"] = { ">gv", "More indentation" },
|
|
},
|
|
x = {
|
|
["<UP>"] = { "move'<-2<CR>gv=gv", "Move line up", opts = { expr = true } },
|
|
["<DOWN>"] = { "move'<-2<CR>gv=gv", "Move line down", opts = { expr = true } },
|
|
},
|
|
t = {
|
|
--big move
|
|
["<A-k>"] = { "<C-u>", "big step down" },
|
|
["<A-j>"] = { "<C-d>", "big step down" },
|
|
},
|
|
}
|
|
|
|
M.ui = {
|
|
plugin = false,
|
|
n = {
|
|
-- toggle wrap
|
|
["<LEADER>tw"] = {
|
|
function()
|
|
vim.opt_local.wrap = not vim.wo.wrap
|
|
vim.opt_local.breakindent = not vim.wo.breakindent
|
|
|
|
if vim.wo.colorcolumn == "" then
|
|
vim.opt_local.colorcolumn = tostring(vim.bo.textwidth)
|
|
else
|
|
vim.opt_local.colorcolumn = ""
|
|
end
|
|
end,
|
|
"toggle wrap",
|
|
},
|
|
|
|
-- toggle some features
|
|
["<LEADER>tn"] = { "<CMD>setlocal nonumber!<CR>", "toggle line numbers" },
|
|
["<LEADER>trn"] = { "<CMD>setlocal nornu!<CR>", "toggle relative line numbers" },
|
|
["<LEADER>ts"] = { "<CMD>setlocal spell!<CR>", "toggle spell check" },
|
|
|
|
-- open windows
|
|
['<LEADER>"'] = { "<CMD>vsplit<CR>", "open a new window to the side" },
|
|
["<LEADER>%"] = { "<CMD>split<CR>", "open a new window on the totop" },
|
|
|
|
-- resize windows
|
|
["<C-Up>"] = { "<CMD>resize +1<CR>", "resize window" },
|
|
["<C-Down>"] = { "<CMD>resize -1<CR>", "resize window" },
|
|
["<C-Left>"] = { "<CMD>vertical resize +1<CR>", "resize window" },
|
|
["<C-Right>"] = { "<CMD>vertical resize -1<CR>", "resize window" },
|
|
|
|
-- tabs
|
|
["<LEADER>wtn"] = { "<CMD>tabnew<CR>", "open a new tab" },
|
|
["<LEADER>wtc"] = { "<CMD>tabclose<CR>", "close current tab" },
|
|
["<LEADER>wtj"] = { "<CMD>tabnext<CR>", "open a new tab" },
|
|
["<LEADER>wtk"] = { "<CMD>tabprevious<CR>", "open a new tab" },
|
|
|
|
-- folds
|
|
["<S-RETURN>"] = { "zMzv", "focus on this fold" },
|
|
},
|
|
}
|
|
|
|
return M
|