-
Notifications
You must be signed in to change notification settings - Fork 105
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
add emacs yank-pop M-y functionality #40
base: master
Are you sure you want to change the base?
Conversation
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.
emacs behavior is not to limit the number of lines killed.
I've just killed 4705 lines from a big document without any memory issue in both emacs and vscode previous kill ring code.
Hi, I think you misunderstood what I meant. I haven't changed the number of lines that can be killed. In fact I have left most of the kill functionality untouched. |
Hi @TrustMeImAProgrammer, when I read your code I understand that only 20 sole lines can be killed, am I wrong? emacs behavior in that situation is to kill-append. See https://www.gnu.org/software/emacs/manual/html_node/emacs/Appending-Kills.html#Appending-Kills |
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.
This pull request should be tagged as WIP: add emacs yank-pop M-y functionality
for the moment.
@@ -48,6 +48,23 @@ export class Operation { | |||
"C-x_r": () => { | |||
this.editor.setRMode(); | |||
}, | |||
"M-y": () => { | |||
let that = this; |
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.
What is that
for? I mean do we really need yankPop to return a Promise instead of just a boolean? Can you use this
to be consistent with the previous code?
}, | ||
"backspace": () => { | ||
commands.executeCommand("deleteLeft").then(() => { | ||
commands.executeCommand("emacs.exitMarkMode"); |
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.
This code should be in editor.ts
to avoid the import of vscode.commands
in this file.
Hi, I've added the ability to circle through killed text as used in the emacs yank-pop command (M-y) since I believe this makes the plug in a lot more useful.
Also, I slightly modified the vscode backspace key so that it also cancels selection in addition to deleting the selected text (as it works in emacs).
I've allowed for a maximum of 20 items in the kill ring to avoid using too much memory. Feel free to change this to whatever you prefer.