Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow saving of buffer with ctrl+s #1426

Merged
merged 3 commits into from
Mar 6, 2020

Conversation

jakeday
Copy link
Contributor

@jakeday jakeday commented Mar 6, 2020

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

@CLAassistant
Copy link

CLAassistant commented Mar 6, 2020

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
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
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
Copy link
Member

glennsl commented Mar 6, 2020

Otherwise this seems on point!

Copy link
Member

@glennsl glennsl left a comment

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>?

{
key: "<C-S>",
command: "workbench.action.files.save",
condition: "insertMode" |> WhenExpr.parse,
Copy link
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
Copy link
Contributor Author

jakeday commented Mar 6, 2020

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

Copy link
Member

@glennsl glennsl left a comment

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.

None yet

3 participants