I use vim inside tmux inside urxvt, and the mouse works perfectly well for clicking and selecting text, except when I want to click too far to the right.
It seems to be related to the distance in number of columns from the left. When I go beyond column ~200 (not sure about the exact number), clicking simply does nothing.
Note that it's not related to a vim window: with two vim windows taking ~150 columns each, clicking will not work after the ~50th column in the second window. It's related to the whole vim session.
Also note that clicking far away in a big tmux pane (200 columns) works perfectly.
In my .tmux.conf I have this line:
set -g default-terminal "screen-256color"
and in my .vimrc I have this:
if &term =~ "^screen"
autocmd VimEnter * silent !echo -ne "\033Ptmux;\033\033]12;7\007\033\\"
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]12;5\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]12;7\x7\<Esc>\\"
autocmd VimLeave * silent !echo -ne "\033Ptmux;\033\033]12;14\007\033\\"
end
It changes the cursor's color depending on the editing mode of vim, and it works, meaning that tmux really sets $TERM to "screen-256color" — but I don't know if this has any relevance with my mouse problem.
I'm running Ubuntu 12.04, vim 7.3, tmux 1.6 and rxvt-unicode 9.14.
Does anybody have an idea about what is causing this problem? Thanks.