Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

desyncr
Copy link
Member

@desyncr desyncr commented Nov 18, 2017

  • Add a proper README.md
  • Fix issue with vi-mode not showing on start up / after command
  • Use icon/glyp rather than text

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

Fixes #165

Adds [NORMAL] or [INSERT] to right prompt on C-x, C-v.
@desyncr desyncr added the plugin label Nov 18, 2017
@desyncr desyncr self-assigned this Nov 18, 2017
@desyncr desyncr requested review from jedahan and frm November 18, 2017 01:21
Copy link
Member

@frm frm left a 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
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra newline

@desyncr
Copy link
Member Author

desyncr commented Nov 22, 2017

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

@desyncr desyncr changed the title Feature/vi mode plugin Add vi-mode as built-in plugin Nov 22, 2017
@desyncr desyncr changed the title Add vi-mode as built-in plugin WIP: Add vi-mode as built-in plugin Nov 22, 2017
@frm
Copy link
Member

frm commented Dec 12, 2017

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
Copy link

DarwinSenior commented Apr 7, 2019

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
Copy link
Member

jedahan commented Apr 7, 2019

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.

@jedahan jedahan closed this Aug 21, 2019
@jedahan jedahan deleted the feature/vi-mode-plugin branch August 21, 2019 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants