Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Everything is working fine outside of tmux. But in tmux I can't resize vim splits with the mouse. I have set mouse=a in my .vimrc. Is there a solution for this?

.tmux.conf:

$ cat ~/.tmux.conf
set-option -g mode-mouse on
set-option -g mouse-resize-pane on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
share|improve this question
    
AFAIK this is a known/unresolved issue. Of course, if you drop your mouse in favor of your keyboard, this becomes pretty much a non-issue. –  romainl Feb 12 '13 at 13:14
8  
Have you tried also setting ttymouse=xterm2 in Vim? That lets me drag around Vim splits inside tmux (it seems to default to xterm2 when run with TERM=xterm, which is probably the case outside of tmux). –  Chris Johnsen Feb 13 '13 at 6:51
    
@ChrisJohnsen it works!! please post this comment as an answer and I'll accept it :) –  holms Feb 13 '13 at 7:50
    
@romainl Hello! Resizing windows with default vim key bindings is fairly cumbersone IMHO. xD –  trusktr Jul 20 at 0:09

1 Answer 1

up vote 31 down vote accepted

It appears that dragging the status line to resize a split is not possible when the Vim option ttymouse is xterm; it does work when the value is xterm2 though. The latter value configures Vim to ask for an extended mouse reporting mode that (among other things) provides better dragging support. This extended mode only works with newer versions of xterm (and other compatible terminal emulators, including tmux), so it is not the default value.

You could use something like the following in your .vimrc to set the option:

set mouse+=a
if &term =~ '^screen'
    " tmux knows the extended mouse mode
    set ttymouse=xterm2
endif

(Though, I am not sure how this will affect actual screen instances, which also use a TERM that starts with screen.)

When you are outside of tmux, the TERM environment variable is probably an xterm-ish value, and Vim will probe for the xterm version by using the t_RV control sequence.

share|improve this answer
1  
You mention not knowing how this will affect screen (as opposed to tmux). The answer is: screen has the same problem, and this exact fix works there as well. –  Moss Collum Dec 3 '13 at 20:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.