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

Mouse appears in insert mode when running under tmux #40

Open
ddickstein opened this issue Oct 5, 2018 · 4 comments
Open

Mouse appears in insert mode when running under tmux #40

ddickstein opened this issue Oct 5, 2018 · 4 comments

Comments

@ddickstein
Copy link

I'm using gnome-terminal inside tmux (I ended up manually setting s:supported_terminal to 'xterm') and when I enter insert mode my mouse cursor appears as the text cursor changes to a vertical bar. When I return to normal mode and begin to navigate, my mouse cursor disappears. When using vim I would prefer my mouse to remain hidden at all times unless I move it, so this is a bit distracting. Why is it appearing and how can I keep it hidden?

@jszakmeister
Copy link
Owner

@ddickstein Honestly, I don't know. Off the cuff, it sounds like a bug in gnome-terminal to me or possibly some interaction with tmux. The only vim-togglecursor does is emit a sequence that allows the necessary escape sequence to pass on through and change the terminal.

FWIW, I don't love this solution as tmux has a way to do cursor overrides, but I haven't sat down to really investigate it yet (see sjl/vitality.vim#8 (comment), but it's an iTerm specific solution and would require modifying your tmux config).

@ddickstein
Copy link
Author

I tried using xfce4-terminal and encountered the same issue, so it seems more probable that there's something off either in the sequence emitted or in the way tmux interprets the sequence, rather than a terminal-specific problem.

I'm on a Linux machine so iTerm isn't an option.

@ddickstein
Copy link
Author

I'd like to loop in the tmux developers with info about the terminal sequence that's being emitted so we can figure out if it's the right one or if it's a tmux bug.

@jszakmeister jszakmeister changed the title Mouse appears in insert mode Mouse appears in insert mode when running under tmux Oct 28, 2018
@jszakmeister
Copy link
Owner

I'm on a Linux machine so iTerm isn't an option.

I wasn't suggesting it... I was advocating another way of making it worked based on what was done there. You'd have to adapt it to work with gnome-terminal. It is a tmux-specific solution to the problem, not a vim-togglecursor one though (and that may really be where the problem needs to be solved).

I'd like to loop in the tmux developers with info about the terminal sequence that's being emitted so we can figure out if it's the right one or if it's a tmux bug.

The escape sequences are here. gnome-terminal uses VTE under the hood, so it uses the standard DECSCUSR sequences. The only caveat is that by default under tmux, I wrap the sequence using this function, which also escapes the escape sequences. It's pretty straight-forward... the only real magic is trying to determine which sequence to use. :-)

Hope that helps.

jszakmeister added a commit that referenced this issue Mar 26, 2021
It's not been necessary to use the tmux-escaping for a while, and causes
problems like we see in #40.  Lets flip things around.  If your tmux
needs it, then enable it with `g:togglecursor_enable_tmux_escaping`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants