17

I've been trying to bind keys in zzh on a Mac but am having some trouble. I know I should be Googling this but couldn't find what I need...

I've been trying to bind ctrl-backspace to be an equivalent of ctrl-w, ie delete one word. But I can't find the key code for it. Nothing shows up when I do it with 'read'. I can't find a chart online either.

Also, I couldn't bind home/end keys (ie fn-left, fn-right) somehow. It is not bound in Terminal's keyboard assignments or .zshrc but it's still doing weird stuff when I press it. Page up and down seem to behave less strangely. Any help?

Thanks

xster
  • 6,269
  • 9
  • 55
  • 60

1 Answers1

38

Open a shell and try pressing Ctrl-v and then the key you want to bind (eg. Home) This is the key sequence you should use with bindkey.

My bindings for Home/End (start/end of line) on Snow Leopard:

bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line

Still trying to bind cmd-left though ...

thenoseman
  • 1,180
  • 1
  • 11
  • 12
  • YES!! Thank you. Is there a recommended place to put something like this so it loads every time, or should I just stuff it into my .zshrc? – ifightcrime Mar 05 '13 at 16:30
  • 1
    See http://superuser.com/questions/349439/how-to-bind-command-key-in-zsh for a way for ⌘← :) – mik01aj Apr 10 '14 at 16:49