I use to be able to resize my vim splits using the mouse in the terminal by clicking on the borders and dragging. Now I can't. How can I make it work again?

edit: still works in gvim but doesn't work in vim.

edit: It doesn't work not because of ubuntu 18.04 itself but because the terminal emulator is gnome.

edit: Well turns out it's not a problem of gnome terminal but some user setting for my ubuntu user.

edit: After much wasted time debugging I found the problem was this setting

set term=screen-256color

I also had this in my .bashrc

TERM=screen-256color

Both these settings break the mouse resizing for some reason. If I recall I added them because tmux wouldn't be able to display vim's themes properly in ubuntu 16. Seems to be working now even without them. The only other problem I found is that now I can't use my mouse to resize within tmux but this was solved with:

if &term =~ '^screen'
    " tmux knows the extended mouse mode
    set ttymouse=xterm2
endif
up vote 0 down vote accepted

At a minimum, you need the 'mouse' option enabled (using either the a or n value) for Vim to respond to the mouse. Check :verbose set mouse? to see if it's being set and by which script. Vim 8 will enable it by default, unless you have your own vimrc.

Your terminal also needs to support sending the mouse clicks and movements to Vim. If Vim detects your terminal supports that, it should be reflected in Vim by :set ttymouse? being non-empty. The value will most likely be one of xterm, xterm2, sgr, or urxvt depending on the terminal you're using.

  • :verbose set mouse? returns mouse=a Last set from ~/.vimrc :set ttymouse? returns ttymouse=xterm – ivan Aug 3 at 13:56
  • What terminal are you using (and did that change during upgrade)? What does :verbose set ttymouse? show? – jamessan Aug 3 at 13:59
  • it returns ttymouse=xterm. I'm not really sure how to check what terminal I'm using but I haven't personally made any chances to that since upgrading. – ivan Aug 3 at 14:06
  • Ok so I found it and it say it's gnome-terminal.wrapper. Guess that's the problem? I switched it to xterm, uxterm and lxterm and it worked but they looked pretty ugly and behaved unlike the terminal I had when I was on 16.04. – ivan Aug 3 at 14:19

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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