Skip to main content
61 votes

Fully disable mouse in console Vim

You should add the following two lines at the end of /etc/vim/vimrc : set mouse= set ttymouse=
Georgi Stoyanov's user avatar
12 votes

How to disable mouse in Neovim?

For those googling, the option name in neovim is just mouse: set mouse=
Watcom's user avatar
  • 223
7 votes
Accepted

Console vim(x): Can I map the scroll wheel to undo--redo?

it works for me: set mouse=a map <ScrollWheelUp> u map <ScrollWheelDown> <C-R> But i hope this is just for fun. Must be horrible =)
B.G.'s user avatar
  • 1,156
7 votes
Accepted

Does Vim have functionality similar to tmux's `display-panes` command for selecting (goto) a specific window by number?

I'm not aware of any Vim feature or even plugin that does that; in fact, up until recently it would be rather hard to display it like that, but with Vim 8.2's popup windows it wouldn't be too hard; ...
Martin Tournoij's user avatar
6 votes
Accepted

Can I scroll in vim with my touch screen?

Note: I have not tested this with gvim, only with normal vim This piece of code allows me to scroll instead of selecting text when I drag using my mouse. function! MouseScroll() "mark b is the ...
user41805's user avatar
  • 333
6 votes
Accepted

disable previously enabled mouse with Vim script

You don't need anything that complex set mouse=a " and set mouse= are enough. You can even define your command to be :command! ToggleMouse exe 'set mouse='.(empty(&mouse)?'a':'') " Here I use ...
Luc Hermitte's user avatar
  • 17.6k
6 votes

How to disable moving the cursor with the mouse

From Vim Tips Wiki: When you are using another application and select go back to Vim by clicking inside Vim's text area, it not only switches application focus to Vim, but it also moves the ...
mitlenatch's user avatar
5 votes

Fully disable mouse in console Vim

This might work if you put it at the end of your .vimrc set mouse=c It's probaly not Vim that takes the mouse input, but rather your Terminal-emulator. To disable mouse support on your terminal this ...
Gustav Blomqvist's user avatar
5 votes
Accepted

Can I use the mouse scroll wheel to browse the auto-completion popup menu?

Your examples work fine for me on Vim 7.4.1689 and Neovim. The following didn't work at first: set mouse=a Then I read the following in :h 'mouse' Enable the use of the mouse. Only works for ...
Tommy A's user avatar
  • 6,790
5 votes
Accepted

Visual scrolling/visual <C-e> and <C-y> across wrapped lines?

I've released a vim plugin that pretty closely matches this behavior. Instead of scrolling by exactly N lines, this maps <C-u>, <C-d> (half window) and <C-j>, <C-k> (quarter ...
Luke Davis's user avatar
  • 1,397
5 votes

Scroll the screen, not the cursor, when using scrollwheel

I know this is a few years late, but you can use nmap <Down> <C-e> nmap <Up> <C-y> This worked for me.
user32140's user avatar
5 votes
Accepted

Mapping Ctrl + mouse click

You are looking for this which I found at the bottom of :h keycodes: nnoremap <C-LeftMouse> :echom 'Foo'<CR> And according to :h <LeftMouse> you also need to check that set mouse ...
statox's user avatar
  • 50.2k
5 votes
Accepted

Visual block selection using mouse in Neovim

Assuming you have set mousemodel=extend it's simply <RightMouse>.
Matt's user avatar
  • 21k
5 votes
Accepted

How can we get the third mouse option with cut, copy paste in neovim?

First, you must enable mouse support with :set mouse=a. In GVim you also need to :set mousemodel=popup to activate builtin popup menu. In Neovim it all depends on GUI frontend, as Neovim itself has no ...
Matt's user avatar
  • 21k
4 votes

How can I use my trackpad for horizontal scrolling?

I figured out a way to do that with Hammerspoon and clever usage of mapping. The first part is configuring Shift + ScrollUp and Shift + ScrollDown to scroll horizontally. In order to do that, you ...
thalesmello's user avatar
4 votes

Does Vim have functionality similar to tmux's `display-panes` command for selecting (goto) a specific window by number?

You are looking for Choosewin, sadly it's not being actively developed anymore, but for the simplest use cases it works great.
Tae's user avatar
  • 2,135
4 votes

Focus follow mouse

In GVim there are set mousefocus and set scrollfocus (only Windows GVim 8.1.2257 or later). mousefocus automatically activates window so it gets both mouse and keyboard input; scrollfocus only ...
Matt's user avatar
  • 21k
4 votes

How to scroll down the output of coc help without using the mouse?

coc#util#float_scroll has been replaced by coc#float#scroll() The example keymapping has been given in the documentation. if has('nvim-0.4.3') || has('patch-8.2.0750') nnoremap <nowait>...
Yuki Yoshimine's user avatar
3 votes
Accepted

How to keep Vim from exiting Visual Mode due to mouse clicks while mouse=a?

You could do this: :xnoremap <LeftMouse> m`<LeftMouse>v`` This allows you to click on where you want to extend the visual selection to, rather than drag. It works best if you also :set ...
DJMcMayhem's user avatar
  • 17.7k
3 votes
Accepted

How to disable moving the cursor with the mouse

Here's a heavy solution: nnoremap <LeftMouse> ma<LeftMouse>`a It will let the click go through (thus changing the focus), but make sure the cursor always goes back to where it was before ...
Tumbler41's user avatar
  • 7,766
3 votes
Accepted

How can I use mouse=a for local and remote work?

It works for me. I have ForwardX11 yes in my ~/.ssh/config file, which should have the same effect as running ssh with -X, and I started vim on the remote machine as vim -N -u NONE -i NONE to make ...
garyjohn's user avatar
  • 6,379
3 votes
Accepted

Cancel mouse highlight on mac

You can use fn to bypass Mouse Reporting for programs like vim. (i.e. do fn+left-mouse button to clear the selection.) Source: https://superuser.com/questions/125102/mac-os-x-terminal-mouse-support/...
Autofire's user avatar
3 votes
Accepted

How to use "FocusGained" to stop my cursor from moving

I guess mouse clicks don't update the jump list. (:help jump-motions seems to confirm this is the case.) Try this, for the async solution: augroup MouseHack autocmd! autocmd FocusLost * set mouse= ...
Rich's user avatar
  • 32.3k
3 votes

How to disable moving the cursor with the mouse

You can set mouse= to disable mouse entirely, use set mouse=a to restore mouse behaviour. You can automatically enable/disable mouse only in terminal vim but not in GUI vim by checking for if has("gui"...
Lie Ryan's user avatar
  • 294
3 votes

Why has vim started launching the ilist on FocusGained?

This appears to be a genuine bug in vim, which was fixed by the patch 8.2.2428. Both the Arch and Debian packages have now been updated to include this patch, so pacman -Syu or apt-get upgrade (...
3 votes

Mouse not working inside Alacritty

There are several ways Vim can recognize mouse events in the Terminal, this is why the --version has a whole bunch of flags starting with mouse: mouse_dec, mouse_xterm, mouse_urxvt, etc. There are all ...
Martin Tournoij's user avatar
2 votes

How to disable moving the cursor with the mouse

:nnoremap <Down> <Nop> :nnoremap <Up> <Nop> does the trick (in conjunction with :set mouse=). Of course, you can't use the arrow keys any more, but if you're using vim, you ...
John's user avatar
  • 21
2 votes

How to disable default mouse wheel behavior in iTerm?

Found a workaround: if has('gui_macvim') nnoremap <ScrollWheelUp> 2k nnoremap <S-ScrollWheelUp> 2k nnoremap <C-ScrollWheelUp> 2k nnoremap <ScrollWheelDown> 2j ...
tga's user avatar
  • 419

Only top scored, non community-wiki answers of a minimum length are eligible