O'Reilly logo

Learning Shell Scripting with Zsh by Gastón Festari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with regions

Continuing the legacy of Emacs' inherited behavior, you can set regions in the command line by holding Ctrl and pressing the Space bar. This will trigger a region selection mechanism that you can expand with the arrow keys, which works just as if you were clicking and dragging your mouse to highlight text.

So, why bother with regions? You could, for example, mark a region via the Ctrl + Space bar sequence and then perform a command on top of it (similar to capitalize-word we saw earlier), or even mix-in the previously mentioned execute-command to call a function that has no keybind. Overall, these few niceties straight from Emacs give ZLE (and of course, zsh) the versatility to behave almost like a full-fledged editor.

Multiline ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required