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

Add vi-mode prompt info #32

Merged
merged 2 commits into from Oct 4, 2016
Merged

Add vi-mode prompt info #32

merged 2 commits into from Oct 4, 2016

Conversation

ghost
Copy link

@ghost ghost commented Oct 1, 2016

Hello, I think I found solutions to problems presented in comments in #16 issue.

  1. To check if user is in vi-mode use: bindkey | grep "vi-quoted-insert" which will return nothing if in emacs mode.
  2. To switch to vi-mode temporarily and not always see [I] use: function zle-keymap-select() { zle reset-prompt; zle -R; }; zle -N zle-keymap-select; bindkey -v which will tell zsh to update KEYMAP variable when mode changes (oh-my-zsh vi-mode plugin sets this).

I also cleared instructions for disabling built-in vi-mode oh-my-zsh plugin <<< right prompt.

This is just tweaked version of #16, but I don't know how I can present these changes there, I can only comment.

@denysdovhan denysdovhan added duplicate new-feature A PR that implement feature (section, specific behavior, etc). labels Oct 3, 2016
@denysdovhan
Copy link
Member

Thank you!
Gonna check this asap.

Copy link
Member

@denysdovhan denysdovhan left a comment

Choose a reason for hiding this comment

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

Amazing work! Thank you a lot!
I'm gonna merge, just do some fixes.

MODE_INDICATOR="${SPACESHIP_VI_MODE_NORMAL}"
;;
esac
echo -n "${MODE_INDICATOR}"
Copy link
Member

Choose a reason for hiding this comment

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

Would be great if the indicator will be highlighted as white bold. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I agree.

@@ -250,3 +276,4 @@ export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40
# Zsh to use the same colors as ls
# Link: http://superuser.com/a/707567
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

Copy link
Member

Choose a reason for hiding this comment

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

Please, remove this extra trailing line.

@@ -210,6 +215,26 @@ spaceship_ruby_version() {
echo -n "%{$reset_color%}"
}

# Show current vi_mode mode
spaceship_vi_mode() {
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add this function (you've already mentioned):

function zle-keymap-select() { zle reset-prompt; zle -R; };
zle -N zle-keymap-select;
bindkey -v

I think, that would be useful for debugging purposes. Name it like spaceshipt_enable_vimode or something.

@ghost
Copy link
Author

ghost commented Oct 3, 2016

Something like that?

@denysdovhan
Copy link
Member

Exactly

@denysdovhan
Copy link
Member

@nooulaif please, add fixes I mentioned before.

@ghost
Copy link
Author

ghost commented Oct 4, 2016

What do you mean? I thought I added them already. Can't you see them?

@denysdovhan
Copy link
Member

Woops, my beg. Didn't noticed.

@denysdovhan denysdovhan merged commit 7fb3eb8 into spaceship-prompt:master Oct 4, 2016
@denysdovhan
Copy link
Member

Thank you a lot!

@ghost
Copy link
Author

ghost commented Oct 4, 2016

Glad I could help.

@ghost ghost deleted the vi-mode branch October 4, 2016 20:53
@denysdovhan
Copy link
Member

denysdovhan commented Oct 4, 2016

🚀⭐️ spaceship-zsh-theme now supports vi-mode!
Check out useful indicators for current mode. https://t.co/gR46Ftigl0 pic.twitter.com/7dhWVcQIhs

— Denys Dovhan (@denysdovhan) 4 October 2016 р.

Do you have a twitter account? I would like to mention you there and say thank you there, if you agree.

@ghost
Copy link
Author

ghost commented Oct 4, 2016

There is no need for that, but thank you.

@denysdovhan
Copy link
Member

@nooulaif hi! I often use vi-mode as temporary tool using spaceship_enable_vi_mode function:

# Temporarily switch to vi-mode
spaceship_enable_vi_mode() {
  function zle-keymap-select() { zle reset-prompt; zle -R; };
  zle -N zle-keymap-select;
  bindkey -v;
}

Is there a way to create the same function, but for disabling vi-mode? Something like spaceship_disable_vi_mode, maybe? Could you help us with that?

@ghost
Copy link
Author

ghost commented Feb 10, 2017

I think typing bindkey -e and hitting enter will bring you back to normal mode.

@denysdovhan
Copy link
Member

@nooulaif thanks for reply. I've already solved this problem. Now we have two special function:

  1. spaceship_vi_mode_enable
  2. spaceship_vi_mode_disable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A PR that implement feature (section, specific behavior, etc).
Development

Successfully merging this pull request may close these issues.

None yet

2 participants