Question

Sometimes its very useful to bind a key to insert a string. Bash uses readline, so I have these two bindings in my ~/.inputrc that I find very useful:

"\C-xp": "/usr/lib/python2.7/site-packages/"
"\C-xf": "find /src -maxdepth 5 -type f -name '*.py' | xargs grep -En "

I've been messing around with zsh lately, but I can't figure out how to get this behavior. Is there some magic form of bindkey that does this?

Was it helpful?

Solution

ZSH manual: 4.5.4: Binding strings instead of commands says:

It's possible to assign an arbitrary string of characters to a key sequence instead of an editor command by giving bindkey the option -s.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top