zshoh-my-zshzsh-completion

Keybindings with ZSH


Can anyone tell me how to move back a word in ZSH? Ctrl+b will move back a character but not an entire word.

For instance a log command like this:

knife zero bootstrap mbigglesworth@10.10.1.108 --sudo-preserve-home --ssh-user mbigglesworth --sudo --policy-name linux_mint_wkstn -N linuxmint-vm -VV

...is painful to get to the middle of!


Solution

  • ESCAPE+b or ESCAPE+f to move back one word or forward one word respectively

    EDIT

    The mentioned above are the defaults(as far as I'm concerned)

    @TyMac mentions that the defaults are uppercase in his system though (ESCAPE-B, ESCAPE-F)

    You may perfectly set them manually by inserting the following lines in your zshrc

    bindkey "^[b" backward-word 
    bindkey "^[f" forward-word
    

    in case you don't like the defaults you may set it to some different key combo using this same syntax (I would suggest that it's preferable to use the defaults though but that's just personal opinion)