4

since bash 4.4 you can set variables vi-ins-mode-string and vi-cmd-string in .inputrc. I've been trying to change the foreground and background color of each of those strings by using tput setab number and tput setaf number, no success.

I guess it is possible as I've seen bash-powerline script and it uses exactly those functions to do the coloring.

Any help would be appreciated.

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
xxxxx
  • 159
  • 9

1 Answers1

4

They are not bash variables, but readline variables, so they can only be set in .inputrc, which is not a bash script. You need to use the raw ASCII escape sequences.

set editing-mode vi
set show-mode-in-prompt on
set vi-cmd-mode-string \1\e[32m\2(c)\1\e[0m\2
set vi-ins-mode-string \1\e[34m\2(i)\1\e[0m\2
chepner
  • 497,756
  • 71
  • 530
  • 681