-
-
Notifications
You must be signed in to change notification settings - Fork 976
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
Wiki: change prompt in vi mode issue: prompt disappears in tmux
session
#184
Comments
I'm pretty sure this problem is related to vi-mode moving the cursor and the preprompt updating can't calculate the correct position to redraw. If you could provide a screencast that would be very helpful (and key combinations used would make it even better)! |
Thanks for screencasts! I can't reproduce this myself, but I do see some problems in your zshrc. First off: you should put these at the very end of your .zshrc, they must be last (it's stated in their readmes but this is a very common error none-the-less, easily overlooked). source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/opt/zsh-history-substring-search/zsh-history-substring-search.zsh Secondly, you might also want to use this function instead: function zle-line-init zle-keymap-select {
zle .reset-prompt
} The Sidenote: Also, there really isn't any need to redefine prompt in the zle functions, once above (but after Finally, if none of this helps, what version of iTerm are you running? I notice it says just |
Thanks! Following your advice fixed the problem. If I may expand this thread a bit, the only time when the prompt char still disappears is when resizing the iTerm2 window (after applying the changes to Creating or deleting |
Great!
Oh, my bad. I guess only the beta / nightly says iTerm2.
If you're using zsh >= 5.1.1 you might try adding to your zshrc (without affecting pure functionality). TRAPWINCH() {
zle && zle .reset-prompt && zle -R
} It will trigger on window resize. Not sure if the zle -R is required though. |
Works perfectly. Thank you so much! |
Hello. The problem of missing prompt char in No changes were made to An OSX security update package was installed, though. I updated today Here is the gist with |
You have double entries of:
Remove the ones that are before the bottom, also experiment with having them in different order. Other than that, have you tried removing stuff from your zshrc until it works again, e.g. does removing the sourcing of |
I keep Playing with the order of last two lines did not help. Checked Very confusing. The only major change which happened was the OSX security update. Reverting that would take a lot of effort. |
Did you also remove the duplicate lines sourcings of zsh syntax highlighting and zsh hss? You didn't mention it so I'm just confirming. I realize that this config was working before, I was just suggesting that you could try to narrow down the issue and see if it's possible that any part of it is conflicting by removing / commenting parts and seeing if it starts working. |
Somehow I suspect this is due to something external. I can reproduce if I just use PROMPT='%(?.%F{green}.%F{red})${${KEYMAP/vicmd/❮%f}/(main|viins)/❯}%f ' But the second I add: function zle-line-init zle-keymap-select {
zle .reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select The problem is gone. |
It looks like I narrowed it down to |
The culprit is indeed this line This is a wrapper for Commenting that line out restores the prompt char behaviour, but alas breaks the access from If you don't mind, let me leave this issue open for a while, perhaps some OSX users can chime in. |
FWIW, Many thanks for you time and support! |
Here is a rather detailed analysis of a possible cause(s). Perhaps it sheds some light? |
I believe ChrisJohnsen is correct in that the prompt is the wrong place to check for VIM_PROMPT="❯"
PROMPT='%(?.%F{green}.%F{red})${VIM_PROMPT}%f '
function zle-line-init zle-keymap-select {
VIM_PROMPT=${${KEYMAP/vicmd/❮}/(main|viins)/❯}
zle .reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select Now the VIM_PROMPT parameter is only evaluated during EDIT: Updated the code, realized there's no need to perform expansion, the substitution is enough. |
@srustamo from your comment on the issue over at tmux-MacOSX-pasteboard I take it this solved the issue (PS. did you notice I also updated the code in my post above). I'll update the wiki to reflect this. |
Thank you! |
When merged, we can remove the VI-mode references from the Wiki. Related: sindresorhus#308, sindresorhus#208, sindresorhus#184 and sindresorhus#98.
When merged, we can remove the VI-mode references from the Wiki. Related: sindresorhus#308, sindresorhus#208, sindresorhus#184 and sindresorhus#98.
When merged, we can remove the VI-mode references from the Wiki. Related: sindresorhus#308, sindresorhus#208, sindresorhus#184 and sindresorhus#98.
* Add support for VI-mode indicator Related: sindresorhus#308, sindresorhus#208, sindresorhus#184 and sindresorhus#98. * Document VI-mode limitation (Zsh 5.3+)
Wiki suggests this solution to changing prompt depending on a vi mode.
All's well, works great, except in a
tmux
session. The prompt is there initially, but disappears after running any command. After running a command, the prompt remains in insert mode, hitting Esc or any other key restores the prompt character (innormal
orinsert
mode respectively).The text was updated successfully, but these errors were encountered: