Home » Questions » Computers [ Ask a new question ]

How to show the current Vi mode when using Vi keybindings in the shell?

How to show the current Vi mode when using Vi keybindings in the shell?

I use the vi keybindings in my tcsh shell.

Asked by: Guest | Views: 92
Total answers/comments: 4
Guest [Entry]

"I don't believe there is any way to determine visually what mode your in, but if you modify your behavior a little it won't matter.

If you want to be in command mode, press ESC before typing a command.

If you want to be in insert mode, press ESC and i before typing content.

You will end up pressing ESC a lot, but every vi user I've ever met does that anyway."
Guest [Entry]

This page has a fairly detailed script which sets up what you want (and more) in zsh. Perhaps it could be adapted to work with tcsh (I am not terribly familiar with that shell).
Guest [Entry]

"I had the same exact problem and by accident have found the solution. Although this thread is old, I couldn't find any other website that offered a solution, so I assume posting on this thread is okay.

Just reset the settings of your terminal program or shell. I'm currently using PuTTY, and I just deleted my saved settings for my saved connection, and recreated a saved session. Worked like a charm.

Hope this helps!"
Guest [Entry]

Please see my answer on SO. Bash 4.4 / Readline 7.0 will add support for this functionality, and in the interim I've published patched versions of Bash 4.3 / Readline 6.3 to github.