diff --git a/config/absytree_config_wasm.wasm b/config/absytree_config_wasm.wasm index 0e654cc9..99d6693c 100755 Binary files a/config/absytree_config_wasm.wasm and b/config/absytree_config_wasm.wasm differ diff --git a/config/keybindings_vim.nim b/config/keybindings_vim.nim index 2bb0b188..ae2aca9d 100644 --- a/config/keybindings_vim.nim +++ b/config/keybindings_vim.nim @@ -683,6 +683,14 @@ proc vimCloseCurrentViewOrQuit() {.expose("vim-close-current-view-or-quit").} = else: closeCurrentView(keepHidden=false) +proc vimIndent(editor: TextDocumentEditor) {.expose("vim-indent").} = + editor.addNextCheckpoint "insert" + editor.indent() + +proc vimUnindent(editor: TextDocumentEditor) {.expose("vim-unindent").} = + editor.addNextCheckpoint "insert" + editor.unindent() + proc loadVimKeybindings*() {.scriptActionWasmNims("load-vim-keybindings").} = let t = startTimer() defer: @@ -1131,8 +1139,8 @@ proc loadVimKeybindings*() {.scriptActionWasmNims("load-vim-keybindings").} = addTextCommand "", "", "insert-text", "\n" - addTextCommand "", r"\>\>", "indent" - addTextCommand "", r"\<\<", "unindent" + addTextCommand "", r"\>\>", "vim-indent" + addTextCommand "", r"\<\<", "vim-unindent" addTextCommandBlock "normal", "s": editor.setMode "visual" @@ -1180,8 +1188,8 @@ proc loadVimKeybindings*() {.scriptActionWasmNims("load-vim-keybindings").} = addTextCommandBlock "insert", "": editor.deleteMove("line-back", inside=false, which=SelectionCursor.First) - addTextCommand "insert", "", "indent" - addTextCommand "insert", "", "unindent" + addTextCommand "insert", "", "vim-indent" + addTextCommand "insert", "", "vim-unindent" addTextCommand "insert", "", "vim-select-last " # Visual mode @@ -1209,8 +1217,8 @@ proc loadVimKeybindings*() {.scriptActionWasmNims("load-vim-keybindings").} = addTextCommand "visual", "", """vim-select-move <#count>""" - addTextCommand "visual", r"\>", "indent" - addTextCommand "visual", r"\<", "unindent" + addTextCommand "visual", r"\>", "vim-indent" + addTextCommand "visual", r"\<", "vim-unindent" # Visual line mode addTextCommandBlock "", "V": @@ -1228,8 +1236,8 @@ proc loadVimKeybindings*() {.scriptActionWasmNims("load-vim-keybindings").} = addTextCommand "visual-line", "", """vim-select-move <#count>""" - addTextCommand "visual-line", r"\>", "indent" - addTextCommand "visual-line", r"\<", "unindent" + addTextCommand "visual-line", r"\>", "vim-indent" + addTextCommand "visual-line", r"\<", "vim-unindent" # todo: not really vim keybindings addTextCommand "", "gd", "goto-definition" @@ -1273,17 +1281,7 @@ proc loadVimKeybindings*() {.scriptActionWasmNims("load-vim-keybindings").} = addTextCommand "", "", "scroll-lines", -1 addTextCommand "", "", "scroll-lines", 1 - addTextCommandBlock "insert", "": - if editor.hasTabStops(): - editor.selectNextTabStop() - else: - editor.indent() - - addTextCommandBlock "insert", "": - if editor.hasTabStops(): - editor.selectPrevTabStop() - else: - editor.unindent() + addTextCommand "insert", "", "insert-indent" addTextCommandBlock "", "gc": editor.addNextCheckpoint "insert"