From 3f4856bccd89e0e16f6f795580158aa89b993ce3 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Wed, 24 Mar 2021 11:23:04 +0100 Subject: [PATCH] Add undo command Do not insert text in command mode --- data/core/docview.lua | 4 +++- data/core/keymap.lua | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/core/docview.lua b/data/core/docview.lua index 3e19cd1c..8f3ca7f6 100644 --- a/data/core/docview.lua +++ b/data/core/docview.lua @@ -284,7 +284,9 @@ end function DocView:on_text_input(text) - self.doc:text_input(text) + if self.editing_mode ~= 'command' then + self.doc:text_input(text) + end end diff --git a/data/core/keymap.lua b/data/core/keymap.lua index 1bd812c5..6a03580c 100644 --- a/data/core/keymap.lua +++ b/data/core/keymap.lua @@ -28,7 +28,7 @@ local function table_find(t, e) end keymap.vim_verbs_obj = {'d', 'c'} -keymap.vim_verbs_imm = {'y', 'p', 'h', 'j', 'k', 'l', 'x', 'i'} +keymap.vim_verbs_imm = {'y', 'p', 'h', 'j', 'k', 'l', 'x', 'i', 'u'} keymap.vim_objects = {'w', '$'} local vim_object_map = { @@ -62,6 +62,8 @@ function keymap.vim_execute(verb, mult, object) command.perform('core:set-insert-mode') elseif verb == 'p' then command.perform('doc:paste') + elseif verb == 'u' then + command.perform('doc:undo') else return false end