Add begin-of-line vim command

This commit is contained in:
Francesco Abbate 2021-03-28 00:04:04 +01:00
parent 7f37451398
commit 686ff9b2ad
2 changed files with 4 additions and 1 deletions

View File

@ -718,6 +718,7 @@ end
function core.on_event(type, ...) function core.on_event(type, ...)
local did_keymap = false local did_keymap = false
if type == "textinput" then if type == "textinput" then
-- FIXME: send textinput event to vim key-bindings module in vim mode
core.root_view:on_text_input(...) core.root_view:on_text_input(...)
elseif type == "keypressed" then elseif type == "keypressed" then
did_keymap = keymap.on_key_pressed(...) did_keymap = keymap.on_key_pressed(...)

View File

@ -26,12 +26,14 @@ end
local verbs_obj = {'c', 'd'} local verbs_obj = {'c', 'd'}
local verbs_imm = {'a', 'h', 'i', 'j', 'k', 'l', 'p', 'u', 'x', 'y', 'left', 'right', 'up', 'down'} local verbs_imm = {'a', 'h', 'i', 'j', 'k', 'l', 'p', 'u', 'x', 'y', 'left', 'right', 'up', 'down'}
local vim_objects = {'d', 'e', 'w', '$'} local vim_objects = {'d', 'e', 'w', '^', '0', '$'}
local vim_object_map = { local vim_object_map = {
['e'] = 'next-word-end', ['e'] = 'next-word-end',
['w'] = 'next-word-begin', ['w'] = 'next-word-begin',
['$'] = 'end-of-line', ['$'] = 'end-of-line',
['^'] = 'start-of-line',
['0'] = 'start-of-line',
} }
local function vim_execute(verb, mult, object) local function vim_execute(verb, mult, object)