In Bash and other shells in emacs mode, there are these awesome kill/yank shortcuts (see man readline
), for example:
- Ctrl+k: "kill-line": this deletes (and save into a cut buffer) all the current line before the cursor.
- Ctrl+y: "yank" will paste under the cursor the last deleted content.
- Alt+y: "yank-pop" will cycle through previous deleted content.
However I am in a situation where I want to:
- hit Ctrl+k,
- do stuff (type other commands),
- and then paste back the original line, but only if there was any content!
In the current settings, hitting Ctrl+k on an empty line leaves the cut buffer unchanged, so hitting Ctrl+y does not *restore* the original line.
I can't find how to clear this kill ring, is it doable (apart from switching to zsh...)?
tmux-resurrect
, which saves panel history by sending commands to the terminals (I wanted to back up partially filled lines). I found a way usingtput smcup
/tput rmcup
which enters/quits a second terminal buffer O.o ... – PlasmaBinturong Jun 03 '20 at 11:19