feat: always perform the mappings
I have found no use of not performing a mapping and the user can always remap after calling setup.
This commit is contained in:
parent
d7dc868fe4
commit
484015a0b5
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
Remap for the bepo layout in Lua, inspired from https://github.com/michamos/vim-bepo
|
Remap for the bepo layout in Lua, inspired from https://github.com/michamos/vim-bepo
|
||||||
|
|
||||||
It aims to be faster (takes only 0.6ms at startup on my machine, while vim-bepo requires 1.6ms)
|
It aims to be faster (takes only 0.4ms at startup on my machine, while vim-bepo requires 1.6ms)
|
||||||
|
10
fnl/bepo.fnl
10
fnl/bepo.fnl
@ -17,16 +17,14 @@
|
|||||||
|
|
||||||
(fn map-text-object [key target]
|
(fn map-text-object [key target]
|
||||||
"For text-objects mappings"
|
"For text-objects mappings"
|
||||||
(if (= (vim.fn.maparg key :o) "")
|
(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.fn.maparg key :x) "")
|
|
||||||
(vim.api.nvim_set_keymap :x key target {:noremap true}))
|
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
(fn map-normal [key target]
|
(fn map-normal [key target]
|
||||||
"For normal mode mappings"
|
"For normal mode mappings"
|
||||||
(when (= (vim.fn.maparg key :n) "")
|
(vim.api.nvim_set_keymap :n key target {:noremap true})
|
||||||
(vim.api.nvim_set_keymap :n key target {:noremap true})))
|
nil)
|
||||||
|
|
||||||
(fn map-all [key target]
|
(fn map-all [key target]
|
||||||
"For all directional mappings"
|
"For all directional mappings"
|
||||||
|
15
lua/bepo.lua
15
lua/bepo.lua
@ -1,18 +1,11 @@
|
|||||||
local function map_text_object(key, target)
|
local function map_text_object(key, target)
|
||||||
if (vim.fn.maparg(key, "o") == "") then
|
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})
|
||||||
elseif (vim.fn.maparg(key, "x") == "") then
|
|
||||||
vim.api.nvim_set_keymap("x", key, target, {noremap = true})
|
|
||||||
else
|
|
||||||
end
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local function map_normal(key, target)
|
local function map_normal(key, target)
|
||||||
if (vim.fn.maparg(key, "n") == "") then
|
vim.api.nvim_set_keymap("n", key, target, {noremap = true})
|
||||||
return vim.api.nvim_set_keymap("n", key, target, {noremap = true})
|
return nil
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
local function map_all(key, target)
|
local function map_all(key, target)
|
||||||
map_normal(key, target)
|
map_normal(key, target)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user