TransWikia.com

gvim: Make the mouse follow CTRL-W_j and CTRL-W_k

Vi and Vim Asked by Michael Scheper on August 31, 2021

I run a Linux/GNOME laptop where the focus follows the mouse, and I have vim’s mousefocus feature turned on, so the selected viewport follows the mouse, too. But when I try to switch viewports using Ctrl+W j or Ctrl+W k (AKA, in vim help, CTRL-W_j or CTRL-W_k), the active viewport stays as whichever one the mouse is over. [UPDATE: I’ve looked at this issue more carefully, and what actually happens is that the mouse cursor jumps to the centre of vim—not the centre of what vim calls a ‘window’, but what the window manager calls a window. And then whatever vim ‘window’ is under the cursor gets the focus.]

The thing is, this is a new problem. I have a .vimrc file that’s evolved since the 1990s, through dozens of machines on multiple platforms, and I don’t remember having to deal with this issue before. Unfortunately, I don’t have my old laptop to compare it with, and for various reasons, I made do without my .vimrc file on my new laptop until today. But other than it being an updated laptop, running a newer version of Linux Mint (Cinnamon) and a newer version of vim, and loading (seemingly unrelated) extensions via a plug-in manager, it’s essentially the same setup I’ve had for years. (I have set mouse=a, FWIW, which again is what it’s been set to since before the turn of the century.)

I think what happened on my previous laptops is that the mouse followed the active viewport in vim, if I used Ctrl+W j or Ctrl+W k to change it. I’ve been looking for a plugin or setting to make it do that again, but I can’t find it. So perhaps this behaviour has changed between version 7.3 and 8.0?

Any ideas how to fix this?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP