Skip to content

Instantly share code, notes, and snippets.

@u0d7i
Last active February 10, 2025 00:29
Show Gist options
  • Save u0d7i/01f78999feff1e2a8361 to your computer and use it in GitHub Desktop.
Save u0d7i/01f78999feff1e2a8361 to your computer and use it in GitHub Desktop.
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a
@gradecke
Copy link

on debian 11 we're now using the following /etc/vim/vimrc.global to disable the mouse integration by default for all users:

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
let skip_defaults_vim=1
set mouse&

without @TheSpyder's hint, it didn't work with "set mouse=-a".. so thank you very much :D!

@nrnw
Copy link

nrnw commented Jul 26, 2024

Thank you. The trick is to disable the mouse support for Vim. I achieved this by adding the following to the /etc/vim/vimrc file.
I had to add syntax on to enable syntax highlighting.

set mouse= 
syntax on 

@brrrr66
Copy link

brrrr66 commented Jan 15, 2025

This way ends with text copied to clipboard with line numbers, Of course if you have one window vertically. Instead I used to this option. JUST HOLD SHIFT KEY DURING SELECTING TERMINAL TEXT TO BEHAVE LIKE set mouse-=a

Thanks, it's working :)

@skrzyneckik
Copy link

skrzyneckik commented Jan 30, 2025

For anyone trying to figure it out on Debian 12 after moving from CentOS, here is what you can do by combining all above information and checking what /etc/vim/vimrc is doing:

  • create /etc/vim/vimrc.local with following content:
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
let skip_defaults_vim=1
set mouse&

In this way, visual mode on mouse select will be disabled but default configuration still loaded and this config will survive vim upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment