bindkey with zsh on Mac

邮差的信 提交于 2019-12-03 11:52:35

问题


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


回答1:


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 ...



来源:https://stackoverflow.com/questions/1903412/bindkey-with-zsh-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!