hiro-sun / vscode-emacs

91 stars 103 forks source link

add emacs yank-pop M-y functionality #40

Open cjmo89 opened 7 years ago

cjmo89 commented 7 years ago

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.

cjmo89 commented 7 years ago

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. What I meant is that you can store a maximum of 20 individual items in the kill ring, each individual item can be one line or thousands. I have checked the official emacs documentation and emacs allows for a maximum of sixty items in the kill ring, see here I could change this number to sixty so that it works exactly like it does in emacs

sammy44nts commented 7 years ago

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 That why I was able to kill 4705 sole lines in emacs ;-) By sole lines I mean pressing C-k 4705 times in a row. I forgot to say that after killing all those lines, I pressed C-y and it yanked everything back in emacs, not just the last 60 lines. I like that you try to implement a more powerful kill ring in vscode-emacs but emacs kill ring is much more complex than a circular buffer of 60 elements.