3 ms·
> Also, without some sort of indicator, Vim’s modal design is awkward here—it’s very easy to forget which mode you’re in. That is why I have this in inputrc:
by gray_-_wolf 2y ago
> Also, without some sort of indicator, Vim’s modal design is awkward here—it’s very easy to forget which mode you’re in.
That is why I have this in inputrc:
set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string +
set vi-cmd-mode-string :
- sre2 2y agoYou could easily improve upon that. For example the following will change the cursor to a block in emacs mode, an underline in vi-command and a line in vi-insert in most terminals. set show-mode-in-prompt on set emacs-mode-string \1\e[1 q\2 set vi-cmd-mode-string \1\e[3 q\2 set vi-ins-mode-string \1\e[5 q\2 The worst thing about the bash config of readline is that bash disables the key combinations for going from emacs-mode to vi-mode (ctrl-alt-j) and back (ctrl-e). They work everywhere else (where I've checked anyways) and you can't turn it on again in inputrc, you have to bind it in your .bashrc, all that because the bash developers think it would be too confusing to have it work the same in bash as anywhere else were you have readline support.
- tristan957 2y agoWhat's the bind incantation in the bashrc you recommend? Here is what I tried: bind -m vi-command 'Control-e: emacs-editing-mode' bind -m emacs 'M-C-j: vi-editing-mode' The second keybind does not seem to work. If I just make it control-j, it works. For some reason the meta is throwing it off.
- sre2 2y agoYou are looking for bind -m emacs-meta '"\C-j": vi-editing-mode' and possibly adding bind -m vi-insert '"\C-e": emacs-editing-mode'
- tristan957 2y agoThe default keybind is control-meta-j though. My comment was in reference to me not being able to get that to work.