@ -9,43 +9,43 @@ local M = {}
M.general = {
i = {
-- go to beginning and end
[ " <C-b> " ] = { " <ESC>^i " , " 論 beginning of line" } ,
[ " <C-e> " ] = { " <End> " , " 壟 end of line" } ,
[ " <C-b> " ] = { " <ESC>^i " , " 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" } ,
[ " <C-h> " ] = { " <Left> " , " move left" } ,
[ " <C-l> " ] = { " <Right> " , " move right" } ,
[ " <C-j> " ] = { " <Down> " , " move down" } ,
[ " <C-k> " ] = { " <Up> " , " move up" } ,
} ,
n = {
[ " <ESC> " ] = { " <cmd> noh <CR> " , " no highlight" } ,
[ " <ESC> " ] = { " <cmd> noh <CR> " , " no highlight" } ,
-- switch between windows
[ " <C-h> " ] = { " <C-w>h " , " window left" } ,
[ " <C-l> " ] = { " <C-w>l " , " window right" } ,
[ " <C-j> " ] = { " <C-w>j " , " window down" } ,
[ " <C-k> " ] = { " <C-w>k " , " window up" } ,
[ " <C-h> " ] = { " <C-w>h " , " window left" } ,
[ " <C-l> " ] = { " <C-w>l " , " window right" } ,
[ " <C-j> " ] = { " <C-w>j " , " window down" } ,
[ " <C-k> " ] = { " <C-w>k " , " window up" } ,
-- save
[ " <C-s> " ] = { " <cmd> w <CR> " , " save file" } ,
[ " <C-s> " ] = { " <cmd> w <CR> " , " save file" } ,
-- Copy all
[ " <C-c> " ] = { " <cmd> %y+ <CR> " , " copy whole file" } ,
[ " <C-c> " ] = { " <cmd> %y+ <CR> " , " copy whole file" } ,
-- line numbers
[ " <leader>n " ] = { " <cmd> set nu! <CR> " , " toggle line number" } ,
[ " <leader>rn " ] = { " <cmd> set rnu! <CR> " , " toggle relative number" } ,
[ " <leader>n " ] = { " <cmd> set nu! <CR> " , " toggle line number" } ,
[ " <leader>rn " ] = { " <cmd> set rnu! <CR> " , " toggle relative number" } ,
-- update nvchad
[ " <leader>uu " ] = { " <cmd> :NvChadUpdate <CR> " , " update nvchad" } ,
[ " <leader>uu " ] = { " <cmd> :NvChadUpdate <CR> " , " update nvchad" } ,
[ " <leader>tt " ] = {
function ( )
require ( " base46 " ) . toggle_theme ( )
end ,
" toggle theme" ,
" toggle theme" ,
} ,
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
@ -58,18 +58,18 @@ M.general = {
[ " <Down> " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , opts = { expr = true } } ,
-- new buffer
[ " <S-b> " ] = { " <cmd> enew <CR> " , " 烙 new buffer" } ,
[ " <S-b> " ] = { " <cmd> enew <CR> " , " new buffer" } ,
-- close buffer + hide terminal buffer
[ " <leader>x " ] = {
function ( )
require ( " core.utils " ) . close_buffer ( )
end ,
" close buffer" ,
" close buffer" ,
} ,
} ,
t = { [ " <C-x> " ] = { termcodes " <C- \\ ><C-N> " , " escape terminal mode" } } ,
t = { [ " <C-x> " ] = { termcodes " <C- \\ ><C-N> " , " escape terminal mode" } } ,
v = {
[ " j " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , opts = { expr = true } } ,
@ -84,49 +84,52 @@ M.general = {
M.tabufline = {
plugin = true ,
n = {
-- cycle through buffers
[ " <TAB> " ] = {
function ( )
require ( " core.utils " ) . tabuflineNext ( )
end ,
" goto next buffer" ,
" goto next buffer" ,
} ,
[ " <S-Tab> " ] = {
function ( )
require ( " core.utils " ) . tabuflinePrev ( )
end ,
" goto prev buffer" ,
" goto prev buffer" ,
} ,
-- pick buffers via numbers
[ " <Bslash> " ] = { " <cmd> TbufPick <CR> " , " Pick buffer" } ,
[ " <Bslash> " ] = { " <cmd> TbufPick <CR> " , " Pick buffer" } ,
} ,
}
M.comment = {
plugin = true ,
-- toggle comment in both modes
n = {
[ " <leader>/ " ] = {
function ( )
require ( " Comment.api " ) . toggle_current_linewise ( )
end ,
" 蘒 toggle comment" ,
" toggle comment" ,
} ,
} ,
v = {
[ " <leader>/ " ] = {
" <ESC><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR> " ,
" 蘒 toggle comment" ,
" toggle comment" ,
} ,
} ,
}
M.lspconfig = {
plugin = true ,
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
n = {
@ -134,181 +137,184 @@ M.lspconfig = {
function ( )
vim.lsp . buf.declaration ( )
end ,
" lsp declaration" ,
" lsp declaration" ,
} ,
[ " gd " ] = {
function ( )
vim.lsp . buf.definition ( )
end ,
" lsp definition" ,
" lsp definition" ,
} ,
[ " K " ] = {
function ( )
vim.lsp . buf.hover ( )
end ,
" lsp hover" ,
" lsp hover" ,
} ,
[ " gi " ] = {
function ( )
vim.lsp . buf.implementation ( )
end ,
" lsp implementation" ,
" lsp implementation" ,
} ,
[ " <leader>ls " ] = {
function ( )
vim.lsp . buf.signature_help ( )
end ,
" lsp signature_help" ,
" lsp signature_help" ,
} ,
[ " <leader>D " ] = {
function ( )
vim.lsp . buf.type_definition ( )
end ,
" lsp definition type" ,
" lsp definition type" ,
} ,
[ " <leader>ra " ] = {
function ( )
require ( " nvchad_ui.renamer " ) . open ( )
end ,
" lsp rename" ,
" lsp rename" ,
} ,
[ " <leader>ca " ] = {
function ( )
vim.lsp . buf.code_action ( )
end ,
" lsp code_action" ,
" lsp code_action" ,
} ,
[ " gr " ] = {
function ( )
vim.lsp . buf.references ( )
end ,
" lsp references" ,
" lsp references" ,
} ,
[ " <leader>f " ] = {
function ( )
vim.diagnostic . open_float ( )
end ,
" floating diagnostic" ,
" floating diagnostic" ,
} ,
[ " [d " ] = {
function ( )
vim.diagnostic . goto_prev ( )
end ,
" goto prev" ,
" goto prev" ,
} ,
[ " d] " ] = {
function ( )
vim.diagnostic . goto_next ( )
end ,
" goto_next" ,
" goto_next" ,
} ,
[ " <leader>q " ] = {
function ( )
vim.diagnostic . setloclist ( )
end ,
" diagnostic setloclist" ,
" diagnostic setloclist" ,
} ,
[ " <leader>fm " ] = {
function ( )
vim.lsp . buf.formatting { }
end ,
" lsp formatting" ,
" lsp formatting" ,
} ,
[ " <leader>wa " ] = {
function ( )
vim.lsp . buf.add_workspace_folder ( )
end ,
" add workspace folder" ,
" add workspace folder" ,
} ,
[ " <leader>wr " ] = {
function ( )
vim.lsp . buf.remove_workspace_folder ( )
end ,
" remove workspace folder" ,
" remove workspace folder" ,
} ,
[ " <leader>wl " ] = {
function ( )
print ( vim.inspect ( vim.lsp . buf.list_workspace_folders ( ) ) )
end ,
" list workspace folders" ,
" list workspace folders" ,
} ,
} ,
}
M.nvimtree = {
plugin = true ,
n = {
-- toggle
[ " <C-n> " ] = { " <cmd> NvimTreeToggle <CR> " , " toggle nvimtree" } ,
[ " <C-n> " ] = { " <cmd> NvimTreeToggle <CR> " , " toggle nvimtree" } ,
-- focus
[ " <leader>e " ] = { " <cmd> NvimTreeFocus <CR> " , " focus nvimtree" } ,
[ " <leader>e " ] = { " <cmd> NvimTreeFocus <CR> " , " focus nvimtree" } ,
} ,
}
M.telescope = {
plugin = true ,
n = {
-- find
[ " <leader>ff " ] = { " <cmd> Telescope find_files <CR> " , " find files" } ,
[ " <leader>fa " ] = { " <cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR> " , " find all" } ,
[ " <leader>fw " ] = { " <cmd> Telescope live_grep <CR> " , " live grep" } ,
[ " <leader>fb " ] = { " <cmd> Telescope buffers <CR> " , " find buffers" } ,
[ " <leader>fh " ] = { " <cmd> Telescope help_tags <CR> " , " help page" } ,
[ " <leader>fo " ] = { " <cmd> Telescope oldfiles <CR> " , " find oldfiles" } ,
[ " <leader>tk " ] = { " <cmd> Telescope keymaps <CR> " , " show keys" } ,
[ " <leader>ff " ] = { " <cmd> Telescope find_files <CR> " , " find files" } ,
[ " <leader>fa " ] = { " <cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR> " , " find all" } ,
[ " <leader>fw " ] = { " <cmd> Telescope live_grep <CR> " , " live grep" } ,
[ " <leader>fb " ] = { " <cmd> Telescope buffers <CR> " , " find buffers" } ,
[ " <leader>fh " ] = { " <cmd> Telescope help_tags <CR> " , " help page" } ,
[ " <leader>fo " ] = { " <cmd> Telescope oldfiles <CR> " , " find oldfiles" } ,
[ " <leader>tk " ] = { " <cmd> Telescope keymaps <CR> " , " show keys" } ,
-- git
[ " <leader>cm " ] = { " <cmd> Telescope git_commits <CR> " , " git commits" } ,
[ " <leader>gt " ] = { " <cmd> Telescope git_status <CR> " , " git status" } ,
[ " <leader>cm " ] = { " <cmd> Telescope git_commits <CR> " , " git commits" } ,
[ " <leader>gt " ] = { " <cmd> Telescope git_status <CR> " , " git status" } ,
-- pick a hidden term
[ " <leader>pt " ] = { " <cmd> Telescope terms <CR> " , " pick hidden term" } ,
[ " <leader>pt " ] = { " <cmd> Telescope terms <CR> " , " pick hidden term" } ,
-- theme switcher
[ " <leader>th " ] = { " <cmd> Telescope themes <CR> " , " nvchad themes" } ,
[ " <leader>th " ] = { " <cmd> Telescope themes <CR> " , " nvchad themes" } ,
} ,
}
M.nvterm = {
plugin = true ,
t = {
-- toggle in terminal mode
[ " <A-i> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " float "
end ,
" toggle floating term" ,
" toggle floating term" ,
} ,
[ " <A-h> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " horizontal "
end ,
" toggle horizontal term" ,
" toggle horizontal term" ,
} ,
[ " <A-v> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " vertical "
end ,
" toggle vertical term" ,
" toggle vertical term" ,
} ,
} ,
@ -318,21 +324,21 @@ M.nvterm = {
function ( )
require ( " nvterm.terminal " ) . toggle " float "
end ,
" toggle floating term" ,
" toggle floating term" ,
} ,
[ " <A-h> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " horizontal "
end ,
" toggle horizontal term" ,
" toggle horizontal term" ,
} ,
[ " <A-v> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " vertical "
end ,
" toggle vertical term" ,
" toggle vertical term" ,
} ,
-- new
@ -341,39 +347,41 @@ M.nvterm = {
function ( )
require ( " nvterm.terminal " ) . new " horizontal "
end ,
" new horizontal term" ,
" new horizontal term" ,
} ,
[ " <leader>v " ] = {
function ( )
require ( " nvterm.terminal " ) . new " vertical "
end ,
" new vertical term" ,
" new vertical term" ,
} ,
} ,
}
M.whichkey = {
plugin = true ,
n = {
[ " <leader>wK " ] = {
function ( )
vim.cmd " WhichKey "
end ,
" which-key all keymaps" ,
" which-key all keymaps" ,
} ,
[ " <leader>wk " ] = {
function ( )
local input = vim.fn . input " WhichKey: "
vim.cmd ( " WhichKey " .. input )
end ,
" which-key query lookup" ,
" which-key query lookup" ,
} ,
} ,
}
M.blankline = {
plugin = true ,
n = {
[ " <leader>bc " ] = {
function ( )
@ -388,7 +396,7 @@ M.blankline = {
end
end ,
" Jump to current_context" ,
" Jump to current_context" ,
} ,
} ,
}