From 487488f5ab4d5c24eec52d81974fb767342bf869 Mon Sep 17 00:00:00 2001 From: Jake Day Date: Fri, 6 Mar 2020 07:45:43 -0500 Subject: [PATCH 1/3] allow saving of buffer with ctrl+s --- src/Store/KeyBindingsStoreConnector.re | 5 +++++ src/Store/VimStoreConnector.re | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/Store/KeyBindingsStoreConnector.re b/src/Store/KeyBindingsStoreConnector.re index 37c76e4d6e..fd2e090fd3 100644 --- a/src/Store/KeyBindingsStoreConnector.re +++ b/src/Store/KeyBindingsStoreConnector.re @@ -169,6 +169,11 @@ let start = () => { command: "redo", condition: "editorTextFocus" |> WhenExpr.parse, }, + { + key: "", + command: "workbench.action.files.save", + condition: "insertMode" |> WhenExpr.parse, + }, { key: "", command: "sneak.start", diff --git a/src/Store/VimStoreConnector.re b/src/Store/VimStoreConnector.re index 7c0f356688..e326efab79 100644 --- a/src/Store/VimStoreConnector.re +++ b/src/Store/VimStoreConnector.re @@ -842,6 +842,14 @@ let start = (); }); + let saveEffect = + Isolinear.Effect.create(~name="vim.save", () => { + let _ = Vim.input(""); + let _ = Vim.input(""); + let cursors = Vim.input("w"); + (); + }); + let updater = (state: State.t, action: Actions.t) => { switch (action) { | ConfigurationSet(configuration) => ( @@ -854,6 +862,7 @@ let start = ) | Command("undo") => (state, undoEffect) | Command("redo") => (state, redoEffect) + | Command("workbench.action.files.save") => (state, saveEffect) | ListFocusUp | ListFocusDown | ListFocus(_) => From 10284a006c9d5c23486cb186688ec28e1ef767ea Mon Sep 17 00:00:00 2001 From: Jake Day Date: Fri, 6 Mar 2020 08:06:23 -0500 Subject: [PATCH 2/3] updating inputs for vim for saving --- src/Store/VimStoreConnector.re | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Store/VimStoreConnector.re b/src/Store/VimStoreConnector.re index e326efab79..c111f77882 100644 --- a/src/Store/VimStoreConnector.re +++ b/src/Store/VimStoreConnector.re @@ -846,7 +846,9 @@ let start = Isolinear.Effect.create(~name="vim.save", () => { let _ = Vim.input(""); let _ = Vim.input(""); - let cursors = Vim.input("w"); + let _ = Vim.input(":"); + let _ = Vim.input("w"); + let _ = Vim.input(""); (); }); From 8fea198b4c5df16f859a89357568d29851dbbe79 Mon Sep 17 00:00:00 2001 From: Jake Day Date: Fri, 6 Mar 2020 10:27:22 -0500 Subject: [PATCH 3/3] switch saving to editorTextFocus mode and add mapping for macOS --- src/Store/KeyBindingsStoreConnector.re | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Store/KeyBindingsStoreConnector.re b/src/Store/KeyBindingsStoreConnector.re index fd2e090fd3..c73fd6037e 100644 --- a/src/Store/KeyBindingsStoreConnector.re +++ b/src/Store/KeyBindingsStoreConnector.re @@ -169,10 +169,15 @@ let start = () => { command: "redo", condition: "editorTextFocus" |> WhenExpr.parse, }, + { + key: "", + command: "workbench.action.files.save", + condition: "editorTextFocus" |> WhenExpr.parse, + }, { key: "", command: "workbench.action.files.save", - condition: "insertMode" |> WhenExpr.parse, + condition: "editorTextFocus" |> WhenExpr.parse, }, { key: "",