Neovim 101 — Mouse and Menu

Using the mouse and custom menu with Neovim for faster navigation.

alpha2phi

--

Mouse and Menu

One key driver using Neovim is having a mouseless development environment to reduce the context switches and RSI (repetitive strain injury). However, using a mouse could be convenient at times.

In this article, let’s explore how we can use the mouse together with customized menus.

This article is part of the Neovim 101 series.

The Neovim configuration files are available in this repository.

Getting Started

One of the key drivers for using Neovim is the mouseless development experience.

However, Neovim does support using the mouse (:h mouse-overview). We will explore how to use this feature to have a better user experience with Neovim.

Mouse Support

Options

We enable mouse support using the mouse (:h mouse) option.

For example, we use the following command to enable the mouse in Normal mode and Visual mode.

:set mouse=nv

Mouse support can be enabled for different modes:

  • n — Normal mode
  • v — Visual mode
  • i — Insert mode
  • c — Command-line mode
  • h — all previous modes when editing a help file
  • a — all previous modes
  • r — for hit-enter (:h hit-enter) and more-prompt (:h more-prompt) prompt.

For our configuration, we enable the mouse for all modes.

:set mouse=a

With the mouse enabled, we can click any tab to switch focus to a different tab.

Clickable Tabs

We can resize splits.

Resize Splits

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.