feat: add <C-é> mapping for <C-w>

<C-é> is much more acessible.
This commit is contained in:
Clément Joly 2022-08-23 23:37:43 +01:00 committed by Clément Joly
parent efce15ecd4
commit 354a6b5ea5
2 changed files with 13 additions and 0 deletions

View File

@ -15,6 +15,11 @@
;; ;;
;; Credit: Inspired by https://github.com/michamos/vim-bepo by Micha Moskovic ;; Credit: Inspired by https://github.com/michamos/vim-bepo by Micha Moskovic
(fn map-cmd-insert [key target]
"For insert and command mode"
(vim.api.nvim_set_keymap "" key target {:noremap true})
nil)
(fn map-text-object [key target] (fn map-text-object [key target]
"For text-objects mappings" "For text-objects mappings"
(vim.api.nvim_set_keymap :o key target {:noremap true}) (vim.api.nvim_set_keymap :o key target {:noremap true})
@ -44,6 +49,7 @@
(fn fun-to-mods [fun] (fn fun-to-mods [fun]
"Converts a function to the modes it sets mappings for" "Converts a function to the modes it sets mappings for"
(match (tostring fun) (match (tostring fun)
:map-cmd-insert :ic
:map-text-object :ox :map-text-object :ox
:map-visual :x :map-visual :x
:map-normal :n :map-normal :n
@ -107,6 +113,8 @@
(map-text-object "aÉ" :aW) ;; idem pour [iw] et [ié] (map-text-object "aÉ" :aW) ;; idem pour [iw] et [ié]
(map-text-object "ié" :iw) ;; idem pour [iW] et [iÉ] (map-text-object "ié" :iw) ;; idem pour [iW] et [iÉ]
(map-text-object "iÉ" :iW)) (map-text-object "iÉ" :iW))
;; Pareil pour <C-w> en mode insertion et commande
(map-cmd-insert "<C-é>" "<C-w>")
(𝛅 mapping-window [] "[w] est libre pour faire <C-w>, grâce à easy_access" (𝛅 mapping-window [] "[w] est libre pour faire <C-w>, grâce à easy_access"
(map-normal :w :<C-w>) ;; et [w] pour faire <C-w><C-w> (map-normal :w :<C-w>) ;; et [w] pour faire <C-w><C-w>

5
lua/bepo.lua generated
View File

@ -1,3 +1,7 @@
local function map_cmd_insert(key, target)
vim.api.nvim_set_keymap("", key, target, {noremap = true})
return nil
end
local function map_text_object(key, target) local function map_text_object(key, target)
vim.api.nvim_set_keymap("o", key, target, {noremap = true}) vim.api.nvim_set_keymap("o", key, target, {noremap = true})
vim.api.nvim_set_keymap("x", key, target, {noremap = true}) vim.api.nvim_set_keymap("x", key, target, {noremap = true})
@ -60,6 +64,7 @@ local function mapping_easy_access()
map_text_object("i\195\169", "iw") map_text_object("i\195\169", "iw")
return map_text_object("i\195\137", "iW") return map_text_object("i\195\137", "iW")
end end
map_cmd_insert("<C-\195\169>", "<C-w>")
local function mapping_window() local function mapping_window()
map_normal("w", "<C-w>") map_normal("w", "<C-w>")
map_normal("W", "<C-w><C-w>") map_normal("W", "<C-w><C-w>")