fix: Visual & Select mode mappings
Currently, Visual mappings are defined using “v”, which according to `map-table`: Mode | Norm | Ins | Cmd | Vis | Sel | Opr | Term | Lang | Command +------+-----+-----+-----+-----+-----+------+------+ [nore]map | yes | - | - | yes | yes | yes | - | - | n[nore]map | yes | - | - | - | - | - | - | - | [nore]map! | - | yes | yes | - | - | - | - | - | i[nore]map | - | yes | - | - | - | - | - | - | c[nore]map | - | - | yes | - | - | - | - | - | v[nore]map | - | - | - | yes | yes | - | - | - | <-- x[nore]map | - | - | - | yes | - | - | - | - | <-- s[nore]map | - | - | - | - | yes | - | - | - | o[nore]map | - | - | - | - | - | yes | - | - | t[nore]map | - | - | - | - | - | - | yes | - | l[nore]map | - | yes | yes | - | - | - | - | yes | This means that we define mappings for both the Visual and the Select mode. This however pollutes the Select mode and violates the intent behind the mode. Quoting the documentation: > Users will expect printable characters to replace the selected area. > Therefore avoid mapping printable characters in Select mode. :h Select-mode-mapping Using “x”, we will only map for Visual mode.
This commit is contained in:
parent
6580e65ca2
commit
efce15ecd4
@ -43,34 +43,6 @@ only the “window” and “movement” groups of mapping, use this instead of
|
|||||||
The following subsections go into details of exactly what mappings are
|
The following subsections go into details of exactly what mappings are
|
||||||
in each group. “Modes” have the same meaning as in the |map-table|.
|
in each group. “Modes” have the same meaning as in the |map-table|.
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
require("bepo").movement() *bepo.nvim-movement*
|
|
||||||
on préserve {hjkl} pour les directions
|
|
||||||
|
|
||||||
Modes Bepo Qwerty
|
|
||||||
nx c h
|
|
||||||
nx t j
|
|
||||||
nx s k
|
|
||||||
nx r l
|
|
||||||
nx C H
|
|
||||||
nx T J
|
|
||||||
nx S K
|
|
||||||
nx R L
|
|
||||||
nx gt gj
|
|
||||||
nx gs gk
|
|
||||||
nx zT zt
|
|
||||||
nx zt zj
|
|
||||||
nx zk zs
|
|
||||||
nx zs zk
|
|
||||||
nx h t
|
|
||||||
nx H T
|
|
||||||
nx l c
|
|
||||||
nx L C
|
|
||||||
nx j r
|
|
||||||
nx J R
|
|
||||||
nx k s
|
|
||||||
nx K S
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
require("bepo").tabs() *bepo.nvim-tabs*
|
require("bepo").tabs() *bepo.nvim-tabs*
|
||||||
le couple [gb]/[gé] agit sur les tabs
|
le couple [gb]/[gé] agit sur les tabs
|
||||||
@ -101,14 +73,42 @@ require("bepo").window() *bepo.nvim-windo
|
|||||||
n wé <C-w>t
|
n wé <C-w>t
|
||||||
n wÉ <C-w>T
|
n wÉ <C-w>T
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
require("bepo").movement() *bepo.nvim-movement*
|
||||||
|
on préserve {hjkl} pour les directions
|
||||||
|
|
||||||
|
Modes Bepo Qwerty
|
||||||
|
nx c h
|
||||||
|
nx t j
|
||||||
|
nx s k
|
||||||
|
nx r l
|
||||||
|
nx C H
|
||||||
|
nx T J
|
||||||
|
nx S K
|
||||||
|
nx R L
|
||||||
|
nx gt gj
|
||||||
|
nx gs gk
|
||||||
|
nx zT zt
|
||||||
|
nx zt zj
|
||||||
|
nx zk zs
|
||||||
|
nx zs zk
|
||||||
|
nx h t
|
||||||
|
nx H T
|
||||||
|
nx l c
|
||||||
|
nx L C
|
||||||
|
nx j r
|
||||||
|
nx J R
|
||||||
|
nx k s
|
||||||
|
nx K S
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
require("bepo").easy_access() *bepo.nvim-easy_access*
|
require("bepo").easy_access() *bepo.nvim-easy_access*
|
||||||
|
|
||||||
Modes Bepo Qwerty
|
Modes Bepo Qwerty
|
||||||
n « <
|
n « <
|
||||||
v « <gv
|
x « <gv
|
||||||
n » >
|
n » >
|
||||||
v » >gv
|
x » >gv
|
||||||
nx g, g;
|
nx g, g;
|
||||||
nx g; g,
|
nx g; g,
|
||||||
nx é w
|
nx é w
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
nil)
|
nil)
|
||||||
|
|
||||||
(fn map-visual [key target]
|
(fn map-visual [key target]
|
||||||
"For normal mode mappings"
|
"For visual mode mappings"
|
||||||
(vim.api.nvim_set_keymap :v key target {:noremap true})
|
(vim.api.nvim_set_keymap :x key target {:noremap true})
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
(fn map-normal [key target]
|
(fn map-normal [key target]
|
||||||
@ -45,7 +45,7 @@
|
|||||||
"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-text-object :ox
|
:map-text-object :ox
|
||||||
:map-visual :v
|
:map-visual :x
|
||||||
:map-normal :n
|
:map-normal :n
|
||||||
:map-all :nx
|
:map-all :nx
|
||||||
other (error (.. "Unsupported function " other))))
|
other (error (.. "Unsupported function " other))))
|
||||||
|
2
lua/bepo.lua
generated
2
lua/bepo.lua
generated
@ -4,7 +4,7 @@ local function map_text_object(key, target)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local function map_visual(key, target)
|
local function map_visual(key, target)
|
||||||
vim.api.nvim_set_keymap("v", key, target, {noremap = true})
|
vim.api.nvim_set_keymap("x", key, target, {noremap = true})
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local function map_normal(key, target)
|
local function map_normal(key, target)
|
||||||
|
@ -38,9 +38,9 @@
|
|||||||
|
|
||||||
(fn print-mapping-struct [struct]
|
(fn print-mapping-struct [struct]
|
||||||
(match struct
|
(match struct
|
||||||
{: bepo : modes : qwerty}
|
{: bepo : modes : qwerty} (let [qw (if (= ">" qwerty) "> " qwerty)]
|
||||||
(let [qw (if (= ">" qwerty) "> " qwerty)]
|
(print (.. (right-align modes 6) " "
|
||||||
(print (.. (right-align modes 6) " " (left-align bepo 4) " " qw)))
|
(left-align bepo 4) " " qw)))
|
||||||
_ (error (.. "Received an invalid struct" (fennel.view struct)))))
|
_ (error (.. "Received an invalid struct" (fennel.view struct)))))
|
||||||
|
|
||||||
(fn print-lua-import [name]
|
(fn print-lua-import [name]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user