breaking change : re-implement custom mappings | simplify it | add whichkey

fixes #1057 , #1047
This commit is contained in:
siduck 2022-05-12 18:26:01 +05:30
parent 4fa0b4ae7d
commit 0844431d37
15 changed files with 442 additions and 240 deletions

View file

@ -211,4 +211,22 @@ M.gitsigns = function()
}
end
M.misc_mappings = function()
local map = nvchad.map
-- Don't copy the replaced text after pasting in visual mode
map("v", "p", '"_dP')
-- 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 :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
map("", "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
map("", "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
map("", "<Down>", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
map("", "<Up>", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
-- esscape from terminal mode
map("t", "jk", "<C-\\><C-n>")
end
return M