geometry-zsh / geometry

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

WIP: Add vi-mode as built-in plugin #184

Closed desyncr closed 5 years ago

desyncr commented 6 years ago

screenshot from 2017-11-17 23-17-18

Fixes #165

desyncr commented 6 years ago

Yes indeed, this is a WIP. Also any idea about icon?

frm commented 6 years ago

I missed the icon question before. It's not really easy to answer since there is no clear character that can be associated with vim. One alternative would be to change the prompt symbol (color or actual character) but I'm not sure that's possible or even desirable since it means that it has to be re-rendered).

DarwinSenior commented 5 years ago

Hi, I was wondering if I could take this task? I think the changing of the prompt symbol is desirable as it is consistent with the minimalistic approach of this theme.

I happened to solve this with the following configuration.

setopt PRUMPT_SUBST
GEOMETRY_SYMBOL_ROOT='${${KEYMAP/vicmd/▼}/(main|viins)/▲}'
GEOMETRY_SYMBOL_PROMPT='${${KEYMAP/vicmd/▼}/(main|viins)/▲}'
GEOMETRY_SYMBOL_EXIT_VALUE='${${KEYMAP/vicmd/▽}/(main|viins)/△}'
function zle-line-init zle-keymap-select {
  zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select

And would it be better to add the following to the path plugin rather than to create a new plugin?

jedahan commented 5 years ago

Only problem I have with doing this in the PATH plugin is in the case where someone would want to disable this functionality. Otherwise I like your solution and ideas.