Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to bind a zsh function to the key combo Ctrl+=. I haven't found any working way to do this. If it is possible, I would like to know how.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

As far as I can tell, the Ctrl+= keybind is not distinguished from the plain = key. While you could bind it, you would also bind to any regular press of equals.

Binding a function to a key is quite easy. You just need to turn the function into a ZSH Widget first. For example:

% function hello_function { echo "hello" }
% zle -N hello_widget hello_function
% bindkey '=' hello_widget

You can find the string to put into bindkey by typing ctrl-v and then your desired keystroke. So I can see that Ctrl+e can be represented as '^E' by typing Ctrl+v Ctrl+e.

Not all modifiers result in a different bindable key, unfortunately.

share|improve this answer
    
Thanks for the answer. It it too bad that it isn't possible to set arbitrary keybindings :( –  drewrobb Jan 31 '13 at 20:43
    
There are probably more bindable keys than you think. The control-v trick is quite nifty, but if the key already has a binding then it can interfere with it. You can certainly bind the function keys, and every letter I have tried worked. Maybe try to think of a new nemonic for the action you are trying to perform. –  Matthew Franglen Jan 31 '13 at 21:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.