feat: expose a few small groups of mapping changes
Those can be loaded as required
This commit is contained in:
parent
8af301bc20
commit
363d16adcc
38
fnl/bepo.fnl
38
fnl/bepo.fnl
@ -31,11 +31,7 @@
|
||||
(map-normal key target)
|
||||
(map-text-object key target))
|
||||
|
||||
(fn mapping-setup []
|
||||
;; Keys still free
|
||||
;; , and ; as they may be used as leaders
|
||||
;; à and À
|
||||
;; è and È
|
||||
(fn mapping-movement []
|
||||
;; on préserve {hjkl} pour les directions
|
||||
(map-all :c :h)
|
||||
(map-all :t :j)
|
||||
@ -73,7 +69,9 @@
|
||||
;; {k} devient [s]
|
||||
(map-all :k :s)
|
||||
;; {K} devient [S]
|
||||
(map-all :K :S)
|
||||
(map-all :K :S))
|
||||
|
||||
(fn mapping-tabs []
|
||||
;; le couple [gb]/[gé] agit sur les tabs
|
||||
(map-normal :gb :gT)
|
||||
(map-normal "gé" :gt)
|
||||
@ -82,7 +80,9 @@
|
||||
;; [gÉ] au dernier
|
||||
(map-normal "gÉ" ":execute \"silent! tablast\"<CR>")
|
||||
;; [gT] est libéré et peut agir sur les tags
|
||||
(map-normal :gT "<C-]>")
|
||||
(map-normal :gT "<C-]>"))
|
||||
|
||||
(fn mapping-easy-access []
|
||||
;; [<] est moins accessible que [«]
|
||||
(map-normal "«" "<")
|
||||
;; idem pour [»] et [>]
|
||||
@ -94,7 +94,6 @@
|
||||
(map-all "é" :w)
|
||||
;; idem pour [W] et [É]
|
||||
(map-all "É" :W)
|
||||
;; ------
|
||||
;; idem pour [aw] et [aé]
|
||||
(map-text-object "aé" :aw)
|
||||
;; idem pour [aW] et [aÉ]
|
||||
@ -102,8 +101,9 @@
|
||||
;; 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))
|
||||
|
||||
(fn mapping-window []
|
||||
;; [w] est libre pour faire <C-w>
|
||||
(map-normal :w :<C-w>)
|
||||
;; et [w] pour faire <C-w><C-w>
|
||||
@ -122,13 +122,23 @@
|
||||
;; va en haut à gauche
|
||||
(map-normal "wé" :<C-w>t)
|
||||
;; déplace sur un nouveau tab
|
||||
(map-normal "wÉ" :<C-w>T)
|
||||
)
|
||||
(map-normal "wÉ" :<C-w>T))
|
||||
|
||||
(fn setup []
|
||||
"Keys that are still free
|
||||
;; , and ; as they may be used as leaders
|
||||
;; à and À
|
||||
è and È"
|
||||
(when (= vim.g.loaded_bepo_nvim nil)
|
||||
(mapping-setup)
|
||||
(mapping-movement)
|
||||
(mapping-tabs)
|
||||
(mapping-easy-access)
|
||||
(mapping-window)
|
||||
(set vim.g.loaded_bepo_nvim 1)))
|
||||
|
||||
{: setup}
|
||||
{: setup
|
||||
:mapping_movement mapping-movement
|
||||
:mapping_tabs mapping-tabs
|
||||
:mapping_easy_access mapping-easy-access
|
||||
:mapping_window mapping-window}
|
||||
|
||||
|
21
lua/bepo.lua
21
lua/bepo.lua
@ -11,7 +11,7 @@ local function map_all(key, target)
|
||||
map_normal(key, target)
|
||||
return map_text_object(key, target)
|
||||
end
|
||||
local function mapping_setup()
|
||||
local function mapping_movement()
|
||||
map_all("c", "h")
|
||||
map_all("t", "j")
|
||||
map_all("s", "k")
|
||||
@ -33,12 +33,16 @@ local function mapping_setup()
|
||||
map_all("j", "r")
|
||||
map_all("J", "R")
|
||||
map_all("k", "s")
|
||||
map_all("K", "S")
|
||||
return map_all("K", "S")
|
||||
end
|
||||
local function mapping_tabs()
|
||||
map_normal("gb", "gT")
|
||||
map_normal("g\195\169", "gt")
|
||||
map_normal("gB", ":execute \"silent! tabfirst\"<CR>")
|
||||
map_normal("g\195\137", ":execute \"silent! tablast\"<CR>")
|
||||
map_normal("gT", "<C-]>")
|
||||
return map_normal("gT", "<C-]>")
|
||||
end
|
||||
local function mapping_easy_access()
|
||||
map_normal("\194\171", "<")
|
||||
map_normal("\194\187", ">")
|
||||
map_all("g,", "g;")
|
||||
@ -48,7 +52,9 @@ local function mapping_setup()
|
||||
map_text_object("a\195\169", "aw")
|
||||
map_text_object("a\195\137", "aW")
|
||||
map_text_object("i\195\169", "iw")
|
||||
map_text_object("i\195\137", "iW")
|
||||
return map_text_object("i\195\137", "iW")
|
||||
end
|
||||
local function mapping_window()
|
||||
map_normal("w", "<C-w>")
|
||||
map_normal("W", "<C-w><C-w>")
|
||||
map_normal("wc", "<C-w>h")
|
||||
@ -65,11 +71,14 @@ local function mapping_setup()
|
||||
end
|
||||
local function setup()
|
||||
if (vim.g.loaded_bepo_nvim == nil) then
|
||||
mapping_setup()
|
||||
mapping_movement()
|
||||
mapping_tabs()
|
||||
mapping_easy_access()
|
||||
mapping_window()
|
||||
vim.g.loaded_bepo_nvim = 1
|
||||
return nil
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
return {setup = setup}
|
||||
return {setup = setup, mapping_movement = mapping_movement, mapping_tabs = mapping_tabs, mapping_easy_access = mapping_easy_access, mapping_window = mapping_window}
|
||||
|
Loading…
x
Reference in New Issue
Block a user