-
Notifications
You must be signed in to change notification settings - Fork 27
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
Cursor styling changes when changing tmux windows #23
Comments
Thanks for reporting this. I believe the most this plugin could do is send the cursor styling sequence to the terminal with every keypress. Would you please test if this provides a better experience for you: 3d59a02 If it does, I'd like to run only the cursor styling hook every keypress, so that will take some extra coding. |
By the way, I don't think tmux can handle this. Not cleanly, anyways. It could intercept the special sequence that changes the cursor style, and store that for each pane, and send it each time you switch panes. Maybe that would be a decent solution (and it would be more accurate than what this plugin can do alone), but I think it might be messy if multiple users are observing the same tmux session or in other complex situations. I could see it working, but it might be complicated. Doing what we can here should be relatively simple and self-contained. One other thing tmux might be able to do is send some signal to ZSH when it focuses on a pane. This feels very error prone, though, as it would need to ensure that the pane contains a ZSH that is sitting at a prompt (not running some batch commands or something). But those concerns aside, it might be possible to trap the signal with this plugin and spit out the cursor styling sequence without waiting for a key press. This feels way too brittle to pursue, but I wanted to mention it in case it prompts another reader to have a much better idea. |
tmux has supported per-pane cursor styles since tmux 1.5. Focus events are supported since tmux 1.8, but I don't know if zsh can handle them. |
Thanks, nicm! I'm behind the times. Looks like I've got some reading to do. |
Check if
Then obviously don't use the |
OK, I think the main lesson here is, never say tmux can't do something. All that's needed is to disable my old workaround, and per-pane cursor styling works very nicely. I'm grateful for your help, @nicm! |
Sorry, I didn't follow the fix exactly. Was there something I needed to update in my tmux config? I pulled the latest commits from zsh-vim-mode, but am still seeing the issue. I tried adding what @nicm posted in the comment above to my |
Did you restart tmux entirely after changing .tmux.conf? |
Ok, I checked and it doesn't seem iTerm2 is supported for this, unless I'm confused by something. (That does seem a bit odd, it usually supports everything)
|
Right, that is why you use |
Ok, I added that line to my .tmux.conf, but no dice. Are there escape sequences in it that I need to ensure are encoded properly vs just the ascii chars? |
What does |
But that isn't what I asked you to try? |
Did you restart tmux? Do this: If it is still the same, show me the output of |
@kyounger, ensure that You can open a new terminal window (without tmux running) and run
Make sure you're quoting the arg to grep: in your previous response it was zsh which reported the "no matches found", which is because the Only if yours doesn't do you need to modify the |
OS X's terminfo database is ancient and definitely doesn't have |
Or to build tmux from master where it can automatically detect iTerm2 :-). |
That was it!!! I had TMUX_PASSTHROUGH set. Unsetting it solved this and made it all work. 🎉 Holy smokes that has been a thorn in my side for so long. Constantly niggling me. HUGE thanks for this fix and educating me a bit on all this. |
Great stuff. |
Yay! Thanks for sticking with it, @kyounger, and I hadn't realized how much this annoys me until it's now fixed. It feels so much more solid now! Thanks for the excellent bug report. |
Not really sure which side of the zsh/tmux fence this sits on, but wonder if it could be handled here at least.
Note: Normal mode==block cursor, insert mode==bar cursor
I can get the cursor styling working, but if I Escape into Normal mode in one tmux window pane and then switch to another pane that is in insert mode, my cursor styling is overriden and I get a block cursor on the pane that is in insert mode. Or, vice versa if I'm in insert mode and switch to a pane that is in normal mode.
Maybe this is a tmux thing that needs to trigger zle to do something? Or maybe tmux is and it's just not handled in
zsh-vim-mode
? Not really sure where to start debugging this. Please feel free to tell me to go ask in tmux/tmux ;)For testing this is my .zshrc:
The text was updated successfully, but these errors were encountered: