-
Notifications
You must be signed in to change notification settings - Fork 274
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
Conversation
src/Store/VimStoreConnector.re
Outdated
let saveEffect = | ||
Isolinear.Effect.create(~name="vim.save", () => { | ||
let _ = Vim.input("<esc>"); | ||
let _ = Vim.input("<esc>"); | ||
let cursors = Vim.input("w"); | ||
(); | ||
}); |
There was a problem hiding this comment.
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:
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>"); | |
(); | |
}); |
There was a problem hiding this comment.
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.
Otherwise this seems on point! |
There was a problem hiding this 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, |
There was a problem hiding this comment.
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
.
@glennsl I added the mapping for macOS and switched the mode per your suggestion! |
There was a problem hiding this 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!
Would something like this work for mapping ctrl+s to save? Thoughts on alternative ways to handle it?