petobens / trueline

Fast and extensible bash powerline prompt with true color and fancy icon support
MIT License
385 stars 36 forks source link

vi mode segment at the end of the prompt #12

Closed micalexander closed 4 years ago

micalexander commented 5 years ago

I attempted to modify your code/add a custom segment in order to have a vi mode segment at the end so the color would change when in insert mode and command mode respectively.

Desired behavior:

image

image

I couldn't seem to find where you were detecting if you were in insert or command mode.

Anything you do to point me in the right direction to accomplishing this affect would be greatly appreciated.

petobens commented 5 years ago

I think this is not possible at the moment. I'm using show-mode-in-prompt to render the vi segment. From the readline man page:

       show-mode-in-prompt (Off)
              If set to On, add a string to the beginning of the prompt indicating the editing mode: emacs, vi command, or vi insertion.  The mode strings are user-settable (e.g., emacs-mode-string).

So apparently we can only modify the appearance of the segment but not its position.

micalexander commented 4 years ago

Ok, that makes sense. I should've looked at the man page, thanks for the reply.