posit-dev / positron

Positron, a next-generation data science IDE
Other
2.52k stars 79 forks source link

Support UNIX-style `Ctrl-k`/`Ctrl-y` cut/paste #1224

Open seeM opened 1 year ago

seeM commented 1 year ago

I've become used to the following behaviour in many unix-based editors/terminals: Ctrl-k cuts from the cursor to the end of the line (placed into a buffer-local clipboard), and Ctrl-y then pastes from that clipboard.

This doesn't work in Positron or VSCode (See https://github.com/microsoft/vscode/issues/3684). I'd really like we could have Positron's source editor and console behave in this way too. I suspect I am in a very tiny minority of people that use this though 😄

I haven't tried it, but this extension claims to solve the problem: https://github.com/soutaro/emacs-c-k. It might be a good reference. It isn't available in Positron though.

jennybc commented 1 year ago

I suspect I am in a very tiny minority of people that use this though 😄

I would use it! And I suspect @lionel- too. I am a recovering emacs user and @lionel- is a current emacs user. I've been assuming that I could find some extension to get emacs keybindings working, but I had not tried to do it yet.

jmcphers commented 1 year ago

This convention dates all the way back to readline (https://github.com/chzyer/readline/blob/master/doc/shortcut.md). A lot of people who are accustomed to using R in the terminal are used to GNU readline shortcuts and over the years we've added a whole bunch of them to RStudio, including (yes) Ctrl K.

In RStudio these readline keybindings are always active in the console regardless of your editor's keybinding settings.

I think this is worth doing, but as in RStudio should probably be scoped to just the console (since that's the readline context).

jennybc commented 1 year ago

Reading that doc on readline makes me realize that a lot of what I think of as Emacs keybindings are actually just readline keybindings.