2

I just switched from bash to zsh on my arch linux install and want to change my keybinding so that ctrl + arrow skips a word forward/backward. If I add

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

it works for the current session, but once I restart my terminal I have to redo this. Could anyone tell me how I can save my keybindings in zsh?

1
  • Add these lines to the end of ~/.zshrc. Commented Jun 11, 2016 at 16:34

1 Answer 1

2

As a rule, shells just execute the commmands they're given, they don't automatically save their state. It's common to have different state in different shell instances (e.g. settings depending on the current directory). While it isn't very common to have different sets of key bindings, it can be useful (for example with different keyboards when accessing the same machine from different devices).

The principle of command line shells is that what you type on a command line can equivalently be placed into a script file. So if you know how to do something by typing a command line, you know how to make it automatic: put it in a script file. To apply a setting to all shell sessions, put it in the shell's startup file. For interactive zsh sessions, that's ~/.zshrc, i.e. the file called .zshrc in your home directory.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.