0

I want to use the vi mode in bash but I find the ESC key a little bit too far, as for vim. The ideal can be to keep a key pressed, like ALT or the caps lock, to stay in command mode and be in insert mode when it's released. Have the option on all my system can be awesome!

In vim, my leader key is Space but it's not possible in insert mode. I don't know if it can help but I'm using tmux and zsh.

Is there a solution?

  • 1
    setxkbmap -option caps:escape. Profit! Or, just Ctrl-[... – jasonwryan Aug 4 '15 at 0:48
  • Ctrl-[ is already for tmux. Anwser the question and I will accept you solution – Dougui Aug 4 '15 at 0:55
  • 2
    “in bash” … “I'm using tmux and zsh”: so which is it, bash or zsh? – Gilles Aug 4 '15 at 0:59
  • @Gilles I edited my question. In this case, bash and zsh are the same, no? – Dougui Aug 4 '15 at 1:03
  • 1
    No, bash and zsh have completely different command line editors, so they would be two separate questions (unless you're looking for a whole-system setting rather than something specific to the shell?). Your question is still not consistent. – Gilles Aug 4 '15 at 1:06
3

Caps_Lock is the one key on the keyboard that has no place in the modern age; unless, of course, you are sitting in a basement somewhere, in your underwear, RAILING against the injustices of some perceived slight from an anonymous, and equally irate, stranger somewhere else in the half light of the Internet.

Remapping Caps_Lock to Escape is not only going to make your experience using Vi-mode in the shell more pleasurable, it will make a (granted, infinitesimally small) contribution to reducing the amount of rage, real or imagined, online.

You can do this in X by adding the following to your ~/.xinitrc:

setxkbmap -option caps:escape

and in the console with a custom keymap file.

  • Is there a way to make this work for PuTTY? – DarkHeart Aug 4 '15 at 1:06
  • @DarkHeart No idea, sorry. Never used it... – jasonwryan Aug 4 '15 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.