Truenas Keybindings
Being used to Ubuntu keybindings, I'm used to navigating the a line in the terminal with CTRL+LEFT
and CTRL+RIGHT
- but instead of the cursor moving left or right by one word at a time I see ;5D;5D;3D;3D
appear in where my cursor is! And when I try to use the delete key, I just see ~
appear! This is clearly not what I wanted to type! /mnt/nas;3D;3D/home
Luckily, we can activate the keybindings on FreeBSD/Truenas that we're used to on other platforms.
Just add the keybindings to ~/.inputrc
and then source it in ~/.zshrc
!
setopt interactivecomments;
case "${TERM}" in
cons25*|linux) # plain BSD/Linux console
bindkey '\e[H' beginning-of-line # home \
bindkey '\e[F' end-of-line # end \
bindkey '\e[5~' delete-char # delete\
bindkey '[D' emacs-backward-word # esc left\
bindkey '[C' emacs-forward-word # esc right\
;;
*rxvt*) # rxvt derivatives
bindkey '\e[3~' delete-char # delete\
bindkey '\eOc' forward-word # ctrl right\
bindkey '\eOd' backward-word # ctrl left\
# workaround for screen + urxvt\
bindkey '\e[7~' beginning-of-line # home\
bindkey '\e[8~' end-of-line # end\
bindkey '^[[1~' beginning-of-line # home\
bindkey '^[[4~' end-of-line # end\
;;
*xterm*) # xterm derivatives
bindkey '\e[H' beginning-of-line # home\
bindkey '\e[F' end-of-line # end\
bindkey '\e[3~' delete-char # delete\
bindkey '\e[3;5~' delete-word # delete-word\
bindkey '\e[1;5C' forward-word # ctrl right\
bindkey '\e[1;5D' backward-word # ctrl left\
# workaround for screen + xterm\
bindkey '\e[1~' beginning-of-line # home\
bindkey '\e[4~' end-of-line # end\
;;
screen)
bindkey '^[[1~' beginning-of-line # home\
bindkey '^[[4~' end-of-line # end\
bindkey '\e[3~' delete-char # delete\
bindkey '\eOc' forward-word # ctrl right\
bindkey '\eOd' backward-word # ctrl left\
bindkey '^[[1;5C' forward-word # ctrl right\
bindkey '^[[1;5D' backward-word # ctrl left\
;;
esac
echo 'source ~/.inputrc' >> ~/.zshrc
Or - if you want to activate them immediately
source ~/.inputrc
Kudos to vermaden at Server Fault for creating the list! Please upvote him if you find his answer helpful (I only found it and wanted to make it easier to find for those using Truenas)!
