theskett + region   3

Adding more Emacs-like bindings to ZSH's line editor (ZLE) - Unix & Linux Stack Exchange
To deactivate the selection, run set-mark-command with a negative argument:
ESC - Ctrl+Space

Alt- AltSpace seems to work (Alt = Meta)
zsh  mark  select  region  deactivate  selection 
june 2018 by theskett
A User's Guide to the Z-Shell
4.3.5: Regions and marks
Another useful concept from Emacs is that of regions and marks. In Emacs-speak `point' is where the cursor is and `mark' is somewhere where you leave a mark to come back to later. The command to set the mark at the current point is `^@' as in Emacs, a hieroglyphic which usually means holding down the control key and pressing the space key. On some systems, such as the limited version of telnet provided with a well-known non-UNIX-based windowing system, you can't send this sequence, and you need to bind a different sequence to set-mark-command. One possibility is `\e ' (escape followed by space), as in MicroEMACS. (Some X Windows configurations don't allow ^@ to work in an xterm, either, though that is usually fixable.)

To continue with Emacs language, the region between point and mark is described simply as `the region'. In zsh, you can't have this highlighted, as you might be used to with editors running directly under windowing systems, so the easiest way to find out the ends of the region is with ^x^x, exchange-point-and-mark, which I mentioned before --- mark, by default, is left at the beginning of the line, hence the behaviour you saw above.

Various editing commands --- usually those with `region' in the name --- operate on this. The most usual are those which kill or copy the region. Annoyingly, kill-region isn't bound --- in Emacs, it's ^w, but zsh follows the tradition of having that bound to backward-kill-word, even though that's also available as the traditional Emacs binding \e^?. So it's probably useful to rebind it. To copy the region, the usual binding `\ew' works.

You then `yank' back the text copied or killed at another point with `^y'. The shell implements the `kill ring' feature, which means if you perform a yank, then type `<ESC>y' (yank-pop) repeatedly, the shell cycles back through previously killed or copied text, so that you have more available than just the last one.
zsh  command  line  edit  editing  mark  kill  region  point  buffer 
june 2018 by theskett

Copy this bookmark: