geometry-zsh / geometry

geometry is a minimal, fully customizable and composable zsh prompt theme
ISC License
936 stars 94 forks source link

Plugin Request: Vi-Mode #165

Open f-a-a opened 7 years ago

f-a-a commented 7 years ago

Zshell has the ability to go into vi-mode with bindkey -v settings. If you are using oh-my-zsh, this feature can be enabled by including the vi-mode plugin.

However, the interest with geometry is to port the visual indicator over. vi-mode implements its own visual indicator function vi_mode_prompt_info() where it toggles between vimcmd and main mode indicating NORMAL and INSERT mode respectively.

The request here is to include the visual indicator as a plugin in geometry. Thank you in advance.

\cc @fribmendes, @desyncr

desyncr commented 7 years ago

This is a great opportunity to create a new built-in plugin or custom plugin for anyone interested in their first PR. As reference there is already a basic implementation in the gitter chatroom: https://gitter.im/geometry-zsh/Lobby?at=592a5c1bfcbbe1891c50bcad

Thanks @f-a-a for bringing this up.

jedahan commented 5 years ago

this needs to be re-visited since its not as straightfoward as just checking for KEYMAP

jedahan commented 5 years ago

I tested it out, and it always shows even when I press esc, which should put me in command mode. I've never used vi-mode before so I might have something misconfigured, but i set bindkey -v in my zshrc...

alxbl commented 5 years ago

When I was testing locally, pressing ESC or ^[ should update the prompt to <NORMAL> and then hitting any of the edit keys should switch it back to <INSERT>. It should be possible to switch back and forth without ever submitting a command.

I'll check again but it could be that I missed something about the ZLE widget hooks and they're not being called properly. Thanks for testing it!

alxbl commented 5 years ago

I tried on a different computer and I get the same behavior. I'll need a bit of time to investigate.