Hacker News new | past | comments | ask | show | jobs | submit login

> Ctrl-q "parks" the command

What is the zsh functionality behind this? I couldn't test it because my terminal eats Ctrl-q and a search for "zsh ctrl-q" didn't turn up anything useful.




Yes please -- this sounds great, I used to use `ctrl-u` then `ctrl-y` with bash, and that doesn't work with zsh, alas. I tried searching for `zsh "park" command` and got nothing useful.


It's a feature of the zsh line editor called "push-line". http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html


Thank you, I love it. This is so great for a quick ls or cd in between.

Turns out it wasn't the terminal that was eating my Ctrl-q, but the key wasn't bound in my zsh.

The page you linked says push-line (^Q ESC-Q ESC-q) (unbound)(unbound)

Does that mean that in a standard config push-line is bound to Ctrl-q?


From the man page:

> The following is a list of all the standard widgets, and their default bindings in emacs mode, vi command mode and vi insert mode (the `emacs', `vicmd' and `viins' keymaps, respectively).

What that means is that if you issue 'bindkey -e' from a bare .zshrc it will enable the emacs bindings and C-q will work. The other two unbound entries state that it isn't enabled by default if you want to use vi-style editing.

The KEYMAPS section in the man page has a full explanation. The easy way to play with it is to start an extra zsh with "zsh -f" so it ignores your configs, call "bindkey" to see what the default bindings are like, then "bindkey -e; bindkey" to see all the goodies that are enabled in emacs mode for example.


Thanks very much! Adding:

    bindkey '^q' push-line
works perfectly. Day improved!


You can also operate on the stack of pending commands programatically using the read and print builtins along with the common to both -z option. It can be a really nice way to build up or edit complex commands/variables in combination with expansion flags and such. 'print -z goodbye; print -z hello' for the five second example of what happens.


Alternatively, you could use vi mode with 'bindkey -v'. Then you could use 'dd'/'cc' and 'p' to achieve the same thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: