Looking for ALT+LeftArrowKey solution in zsh

后端 未结 10 768
孤街浪徒
孤街浪徒 2021-01-29 18:13

I just recently switched from bash to zsh, however I miss my Alt+LeftArrowKey and Alt+RightArrowKey to go back and forth a word at a

10条回答
  •  走了就别回头了
    2021-01-29 18:27

    Run cat then press keys to see the codes your shortcut send.
    (Press Ctrl+C to kill the cat when you're done.)
    For me, (ubuntu, konsole, xterm) pressing Alt+ sends ^[[1;3D, so i would put in my .zshrc

    bindkey "^[[1;3C" forward-word
    bindkey "^[[1;3D" backward-word
    

    (Actually I prefer to use Ctrl + arrow to move word by word, like in a normal textbox under windows or linux gui.)

    Related question: Fix key settings (Home/End/Insert/Delete) in .zshrc when running Zsh in Terminator Terminal Emulator

提交回复
热议问题