-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add vi-mode as built-in plugin #184
Conversation
Adds [NORMAL] or [INSERT] to right prompt on C-x, C-v.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good but should we clear that checklist first? :)
# Formats RPROMPT with mode + rest of prompt | ||
RPROMPT="[$KEY] $RPROMPT" | ||
# Resets prompt | ||
zle && zle reset-prompt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this do an extra redraw per prompt line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I think it can be avoided though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can it be avoided? can we just set a dirty bit somewhere?
@@ -0,0 +1,18 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra newline
Yes indeed, this is a WIP. Also any idea about icon? |
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). |
Hi, 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? |
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. |
Fixes #165