Skip to content

allow saving of buffer with ctrl+s - #1426

Merged
glennsl merged 3 commits into
onivim:masterfrom
jakeday:feature/add-save-keybinding
Mar 6, 2020
Merged

glennsl merged 3 commits into
onivim:masterfrom
jakeday:feature/add-save-keybinding

Conversation

@jakeday

@jakeday jakeday commented Mar 6, 2020

Copy link
Copy Markdown
Contributor

Would something like this work for mapping ctrl+s to save? Thoughts on alternative ways to handle it?

@CLAassistant

CLAassistant commented Mar 6, 2020 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment on lines +845 to +851
let saveEffect =
Isolinear.Effect.create(~name="vim.save", () => {
let _ = Vim.input("<esc>");
let _ = Vim.input("<esc>");
let cursors = Vim.input("w");
();
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w in normal mode will just move the cursor. What we want is to emulate :w followed by enter. Something like this should work I think:

Suggested change
let saveEffect =
Isolinear.Effect.create(~name="vim.save", () => {
let _ = Vim.input("<esc>");
let _ = Vim.input("<esc>");
let cursors = Vim.input("w");
();
});
let saveEffect =
Isolinear.Effect.create(~name="vim.save", () => {
let _ = Vim.input("<esc>");
let _ = Vim.input("<esc>");
let _ = Vim.input(":");
let _ = Vim.input("w");
let _ = Vim.input("<CR>");
();
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glennsl Good catch! I just updated the PR.

@glennsl

glennsl commented Mar 6, 2020

Copy link
Copy Markdown
Member

Otherwise this seems on point!

@glennsl glennsl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great! But see the comment below.

And could you also add this for macOS as <D-S>?

Comment thread src/Store/KeyBindingsStoreConnector.re Outdated
{
key: "<C-S>",
command: "workbench.action.files.save",
condition: "insertMode" |> WhenExpr.parse,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not want this in any mode? i.e. editorTextFocus instead of insertMode.

@jakeday

jakeday commented Mar 6, 2020

Copy link
Copy Markdown
Contributor Author

@glennsl I added the mapping for macOS and switched the mode per your suggestion!

@glennsl glennsl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great. Thanks so much!

@glennsl
glennsl merged commit 4006391 into onivim:master Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants