feat: add « in visual mode with automatic reselection

This commit is contained in:
Clément Joly 2022-05-07 21:12:41 +00:00
parent 218072b427
commit 262c921df5
2 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,11 @@
(vim.api.nvim_set_keymap :x key target {:noremap true})
nil)
(fn map-visual [key target]
"For normal mode mappings"
(vim.api.nvim_set_keymap :v key target {:noremap true})
nil)
(fn map-normal [key target]
"For normal mode mappings"
(vim.api.nvim_set_keymap :n key target {:noremap true})
@ -85,8 +90,10 @@
(fn mapping-easy-access []
;; [<] est moins accessible que [«]
(map-normal "«" "<")
(map-visual "«" "<gv")
;; idem pour [»] et [>]
(map-normal "»" ">")
(map-visual "»" ">gv")
;; idem pour [g,] et [g;] qui sont permutés
(map-all "g," "g;")
(map-all "g;" "g,")

View File

@ -3,6 +3,10 @@ local function map_text_object(key, target)
vim.api.nvim_set_keymap("x", key, target, {noremap = true})
return nil
end
local function map_visual(key, target)
vim.api.nvim_set_keymap("v", key, target, {noremap = true})
return nil
end
local function map_normal(key, target)
vim.api.nvim_set_keymap("n", key, target, {noremap = true})
return nil
@ -44,7 +48,9 @@ local function mapping_tabs()
end
local function mapping_easy_access()
map_normal("\194\171", "<")
map_visual("\194\171", "<gv")
map_normal("\194\187", ">")
map_visual("\194\187", ">gv")
map_all("g,", "g;")
map_all("g;", "g,")
map_all("\195\169", "w")