@ -5,63 +5,63 @@ local M = {}
M.general = {
i = {
-- go to beginning and end
[ " <C-b> " ] = { " <ESC>^i " , " b eginning of line" } ,
[ " <C-e> " ] = { " <End> " , " e nd of line" } ,
[ " <C-b> " ] = { " <ESC>^i " , " B eginning of line" } ,
[ " <C-e> " ] = { " <End> " , " E nd of line" } ,
-- navigate within insert mode
[ " <C-h> " ] = { " <Left> " , " m ove left" } ,
[ " <C-l> " ] = { " <Right> " , " m ove right" } ,
[ " <C-j> " ] = { " <Down> " , " m ove down" } ,
[ " <C-k> " ] = { " <Up> " , " m ove up" } ,
[ " <C-h> " ] = { " <Left> " , " M ove left" } ,
[ " <C-l> " ] = { " <Right> " , " M ove right" } ,
[ " <C-j> " ] = { " <Down> " , " M ove down" } ,
[ " <C-k> " ] = { " <Up> " , " M ove up" } ,
} ,
n = {
[ " <Esc> " ] = { " :noh <CR> " , " c lear highlights" } ,
[ " <Esc> " ] = { " :noh <CR> " , " C lear highlights" } ,
-- switch between windows
[ " <C-h> " ] = { " <C-w>h " , " w indow left" } ,
[ " <C-l> " ] = { " <C-w>l " , " w indow right" } ,
[ " <C-j> " ] = { " <C-w>j " , " w indow down" } ,
[ " <C-k> " ] = { " <C-w>k " , " w indow up" } ,
[ " <C-h> " ] = { " <C-w>h " , " W indow left" } ,
[ " <C-l> " ] = { " <C-w>l " , " W indow right" } ,
[ " <C-j> " ] = { " <C-w>j " , " W indow down" } ,
[ " <C-k> " ] = { " <C-w>k " , " W indow up" } ,
-- save
[ " <C-s> " ] = { " <cmd> w <CR> " , " s ave file" } ,
[ " <C-s> " ] = { " <cmd> w <CR> " , " S ave file" } ,
-- Copy all
[ " <C-c> " ] = { " <cmd> %y+ <CR> " , " c opy whole file" } ,
[ " <C-c> " ] = { " <cmd> %y+ <CR> " , " C opy whole file" } ,
-- line numbers
[ " <leader>n " ] = { " <cmd> set nu! <CR> " , " t oggle line number" } ,
[ " <leader>rn " ] = { " <cmd> set rnu! <CR> " , " t oggle relative number" } ,
[ " <leader>n " ] = { " <cmd> set nu! <CR> " , " T oggle line number" } ,
[ " <leader>rn " ] = { " <cmd> set rnu! <CR> " , " T oggle relative number" } ,
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
[ " j " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " m ove down" , opts = { expr = true } } ,
[ " k " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " m ove up" , opts = { expr = true } } ,
[ " <Up> " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " m ove up" , opts = { expr = true } } ,
[ " <Down> " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " m ove down" , opts = { expr = true } } ,
[ " j " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " M ove down" , opts = { expr = true } } ,
[ " k " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " M ove up" , opts = { expr = true } } ,
[ " <Up> " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " M ove up" , opts = { expr = true } } ,
[ " <Down> " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " M ove down" , opts = { expr = true } } ,
-- new buffer
[ " <leader>b " ] = { " <cmd> enew <CR> " , " n ew buffer" } ,
[ " <leader>b " ] = { " <cmd> enew <CR> " , " N ew buffer" } ,
[ " <leader>ch " ] = { " <cmd> NvCheatsheet <CR> " , " Mapping cheatsheet " } ,
} ,
t = {
[ " <C-x> " ] = { vim.api . nvim_replace_termcodes ( " <C- \\ ><C-N> " , true , true , true ) , " e scape terminal mode" } ,
[ " <C-x> " ] = { vim.api . nvim_replace_termcodes ( " <C- \\ ><C-N> " , true , true , true ) , " E scape terminal mode" } ,
} ,
v = {
[ " <Up> " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " m ove up" , opts = { expr = true } } ,
[ " <Down> " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " m ove down" , opts = { expr = true } } ,
[ " <Up> " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " M ove up" , opts = { expr = true } } ,
[ " <Down> " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " M ove down" , opts = { expr = true } } ,
} ,
x = {
[ " j " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " m ove down" , opts = { expr = true } } ,
[ " k " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " m ove up" , opts = { expr = true } } ,
[ " j " ] = { ' v:count || mode(1)[0:1] == "no" ? "j" : "gj" ' , " M ove down" , opts = { expr = true } } ,
[ " k " ] = { ' v:count || mode(1)[0:1] == "no" ? "k" : "gk" ' , " M ove up" , opts = { expr = true } } ,
-- Don't copy the replaced text after pasting in visual mode
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
[ " p " ] = { ' p:let @+=@0<CR>:let @"=@0<CR> ' , " d ont copy replaced text" , opts = { silent = true } } ,
[ " p " ] = { ' p:let @+=@0<CR>:let @"=@0<CR> ' , " D ont copy replaced text" , opts = { silent = true } } ,
} ,
}
@ -74,14 +74,14 @@ M.tabufline = {
function ( )
require ( " nvchad_ui.tabufline " ) . tabuflineNext ( )
end ,
" g oto next buffer" ,
" G oto next buffer" ,
} ,
[ " <S-tab> " ] = {
function ( )
require ( " nvchad_ui.tabufline " ) . tabuflinePrev ( )
end ,
" g oto prev buffer" ,
" G oto prev buffer" ,
} ,
-- close buffer + hide terminal buffer
@ -89,7 +89,7 @@ M.tabufline = {
function ( )
require ( " nvchad_ui.tabufline " ) . close_buffer ( )
end ,
" c lose buffer" ,
" C lose buffer" ,
} ,
} ,
}
@ -103,14 +103,14 @@ M.comment = {
function ( )
require ( " Comment.api " ) . toggle.linewise . current ( )
end ,
" t oggle comment" ,
" T oggle comment" ,
} ,
} ,
v = {
[ " <leader>/ " ] = {
" <ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR> " ,
" t oggle comment" ,
" T oggle comment" ,
} ,
} ,
}
@ -125,119 +125,119 @@ 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 { border = " rounded " }
end ,
" f loating diagnostic" ,
" F loating diagnostic" ,
} ,
[ " [d " ] = {
function ( )
vim.diagnostic . goto_prev ( )
end ,
" g oto prev" ,
" G oto prev" ,
} ,
[ " ]d " ] = {
function ( )
vim.diagnostic . goto_next ( )
end ,
" goto_ next" ,
" Goto next" ,
} ,
[ " <leader>q " ] = {
function ( )
vim.diagnostic . setloclist ( )
end ,
" d iagnostic setloclist" ,
" D iagnostic setloclist" ,
} ,
[ " <leader>fm " ] = {
function ( )
vim.lsp . buf.format { async = true }
end ,
" lsp formatting" ,
" LSP formatting" ,
} ,
[ " <leader>wa " ] = {
function ( )
vim.lsp . buf.add_workspace_folder ( )
end ,
" a dd workspace folder" ,
" A dd workspace folder" ,
} ,
[ " <leader>wr " ] = {
function ( )
vim.lsp . buf.remove_workspace_folder ( )
end ,
" r emove workspace folder" ,
" R emove workspace folder" ,
} ,
[ " <leader>wl " ] = {
function ( )
print ( vim.inspect ( vim.lsp . buf.list_workspace_folders ( ) ) )
end ,
" l ist workspace folders" ,
" L ist workspace folders" ,
} ,
} ,
}
@ -247,10 +247,10 @@ M.nvimtree = {
n = {
-- toggle
[ " <C-n> " ] = { " <cmd> NvimTreeToggle <CR> " , " t oggle nvimtree" } ,
[ " <C-n> " ] = { " <cmd> NvimTreeToggle <CR> " , " T oggle nvimtree" } ,
-- focus
[ " <leader>e " ] = { " <cmd> NvimTreeFocus <CR> " , " f ocus nvimtree" } ,
[ " <leader>e " ] = { " <cmd> NvimTreeFocus <CR> " , " F ocus nvimtree" } ,
} ,
}
@ -259,23 +259,23 @@ M.telescope = {
n = {
-- find
[ " <leader>ff " ] = { " <cmd> Telescope find_files <CR> " , " f ind files" } ,
[ " <leader>fa " ] = { " <cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR> " , " f ind all" } ,
[ " <leader>fw " ] = { " <cmd> Telescope live_grep <CR> " , " l ive grep" } ,
[ " <leader>fb " ] = { " <cmd> Telescope buffers <CR> " , " f ind buffers" } ,
[ " <leader>fh " ] = { " <cmd> Telescope help_tags <CR> " , " h elp page" } ,
[ " <leader>fo " ] = { " <cmd> Telescope oldfiles <CR> " , " f ind oldfiles" } ,
[ " <leader>fz " ] = { " <cmd> Telescope current_buffer_fuzzy_find <CR> " , " f ind in current buffer" } ,
[ " <leader>ff " ] = { " <cmd> Telescope find_files <CR> " , " F ind files" } ,
[ " <leader>fa " ] = { " <cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR> " , " F ind all" } ,
[ " <leader>fw " ] = { " <cmd> Telescope live_grep <CR> " , " L ive grep" } ,
[ " <leader>fb " ] = { " <cmd> Telescope buffers <CR> " , " F ind buffers" } ,
[ " <leader>fh " ] = { " <cmd> Telescope help_tags <CR> " , " H elp page" } ,
[ " <leader>fo " ] = { " <cmd> Telescope oldfiles <CR> " , " F ind oldfiles" } ,
[ " <leader>fz " ] = { " <cmd> Telescope current_buffer_fuzzy_find <CR> " , " F ind in current buffer" } ,
-- git
[ " <leader>cm " ] = { " <cmd> Telescope git_commits <CR> " , " g it commits" } ,
[ " <leader>gt " ] = { " <cmd> Telescope git_status <CR> " , " g it status" } ,
[ " <leader>cm " ] = { " <cmd> Telescope git_commits <CR> " , " G it commits" } ,
[ " <leader>gt " ] = { " <cmd> Telescope git_status <CR> " , " G it status" } ,
-- pick a hidden term
[ " <leader>pt " ] = { " <cmd> Telescope terms <CR> " , " p ick hidden term" } ,
[ " <leader>pt " ] = { " <cmd> Telescope terms <CR> " , " P ick hidden term" } ,
-- theme switcher
[ " <leader>th " ] = { " <cmd> Telescope themes <CR> " , " n vchad themes" } ,
[ " <leader>th " ] = { " <cmd> Telescope themes <CR> " , " N vchad themes" } ,
} ,
}
@ -288,21 +288,21 @@ M.nvterm = {
function ( )
require ( " nvterm.terminal " ) . toggle " float "
end ,
" t oggle floating term" ,
" T oggle floating term" ,
} ,
[ " <A-h> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " horizontal "
end ,
" t oggle horizontal term" ,
" T oggle horizontal term" ,
} ,
[ " <A-v> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " vertical "
end ,
" t oggle vertical term" ,
" T oggle vertical term" ,
} ,
} ,
@ -312,21 +312,21 @@ M.nvterm = {
function ( )
require ( " nvterm.terminal " ) . toggle " float "
end ,
" t oggle floating term" ,
" T oggle floating term" ,
} ,
[ " <A-h> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " horizontal "
end ,
" t oggle horizontal term" ,
" T oggle horizontal term" ,
} ,
[ " <A-v> " ] = {
function ( )
require ( " nvterm.terminal " ) . toggle " vertical "
end ,
" t oggle vertical term" ,
" T oggle vertical term" ,
} ,
-- new
@ -334,14 +334,14 @@ M.nvterm = {
function ( )
require ( " nvterm.terminal " ) . new " horizontal "
end ,
" n ew horizontal term" ,
" N ew horizontal term" ,
} ,
[ " <leader>v " ] = {
function ( )
require ( " nvterm.terminal " ) . new " vertical "
end ,
" n ew vertical term" ,
" N ew vertical term" ,
} ,
} ,
}
@ -354,14 +354,14 @@ M.whichkey = {
function ( )
vim.cmd " WhichKey "
end ,
" w hich-key all keymaps" ,
" W hich-key all keymaps" ,
} ,
[ " <leader>wk " ] = {
function ( )
local input = vim.fn . input " WhichKey: "
vim.cmd ( " WhichKey " .. input )
end ,
" w hich-key query lookup" ,
" W hich-key query lookup" ,
} ,
} ,
}
@ -383,7 +383,7 @@ M.blankline = {
end
end ,
" Jump to current _ context" ,
" Jump to current context" ,
} ,
} ,
}