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?
Best Answer
bash
tozsh
. I will not describe here how to set up mode indicator in Z-Shell – there are a lot of howtos over Internet, e. g.: [1], [2].show-mode-in-prompt
.Like so:
in your
.inputrc
oras a shell command. This adds a character to the beginning of the prompt indicating the editing mode:
@
for Emacs,:
and+
for vi normal and vi insertion respectively.I. e. your prompt will look like
+agzam@pc:~$
in input mode and:agzam@pc:~$
in normal mode. As far as I understand this can not been customized in any way, but still it’s better than nothing.