matterhorn icon indicating copy to clipboard operation
matterhorn copied to clipboard

Please support a `ctrl+Y` to insert text removed via `ctrl+W` or `ctrl+U`

Open setharnold opened this issue 4 years ago • 6 comments

Hello, I quite often use ctrl+W and ctrl+U to kill words and lines, and then use ctrl+Y to re-insert those killed words. I'd like to have this functionality in Matterhorn.

There's two versions of this that I've seen: irssi will store one killed word or line, and re-insert just that one item. bash will store multiple words, and can keep track of an entire killed stack, for reinsertion.

I prefer the irssi version of this feature; I never use the extra features of the bash version.

Thanks

setharnold avatar Jul 02 '20 01:07 setharnold

These work just fine for me, @setharnold, already providing the functionality you requested. Which version of matterhorn and which terminal are you using, and what is the functionality you see when you try these keys?

kquick avatar Jul 02 '20 14:07 kquick

@kquick what worked for you? This is what I tried:

  • C-k (kill to EOL) followed by C-y kills and then yanks (pastes) the whole line from the cursor to end of line
  • C-w (kill word) followed by C-y does not yank (paste) a word

jtdaugherty avatar Jul 03 '20 01:07 jtdaugherty

@setharnold Also, I wanted to ask if you could be very specific about the keybindings you're using (or want to use). The "^W" syntax can be ambiguous due to its use to indicate some characters prefixed by Ctrl as well as to refer to other characters such as Backspace that are not printable. So if you mean "Ctrl-W" and "Ctrl-U", it would be helpful to us if you can indicate that with "Ctrl-W" or "C-W" rather than "^W".

With that said, since Matterhorn supports custom keybindings, the real question here seems to be one of functionality rather than specific keys. I'm interpreting this ticket to be about requesting that words killed with Ctrl-w are pastable with C-y.

jtdaugherty avatar Jul 03 '20 01:07 jtdaugherty

Hrm... perhaps I hadn't had my coffee yet. I must have tested C-k and C-w and C-u with the same input; the latter two don't appear to fill the yank buffer so the C-y following C-w or C-u pastes what's in the buffer, but not what the preceding yank was, so I get back the C-k removed content. I can confirm then the requested behavior doesn't work.

kquick avatar Jul 03 '20 01:07 kquick

I rarely use ctrl+K so I never noticed that ctrl+Y works with it; I use ctrl+W and ctrl+Y all the time and notice that ctrl+Y doesn't paste what they removed.

Thanks

setharnold avatar Jul 06 '20 19:07 setharnold

Thanks, @setharnold!

jtdaugherty avatar Jul 06 '20 19:07 jtdaugherty