4

I recently discovered terminal's feature, you can set the keys emacs or vi style

I prefer the second. so if you do

set -o vi

You can use k j l h keys to navigate on the command line. And you can switch between 'Normal' and 'Insert' modes like in vim.

However there's no way to visually distinguish one mode from another, even cursor doesn't change. Which makes vi-style pretty much useless. Is there a way to make it truly vim-like?

iLemming
  • 533

2 Answers2

3

As far as I know, this is not possible in Bash. But ZSH supports this. See here.

cbrst
  • 131
3

Should be available in bash 4.3 - see the changelog -

j.  New user-settable variable, show-mode-in-prompt, adds a characters to the
    beginning of the prompt indicating the current editing mode.

bash 4.3 is currently at the rc stage, you should be able to get packages for most distros without compiling from source, though not in the main repositories. Eg. Ubuntu (amd64) here and Debian (experimental repo) here.

Graeme
  • 34,027