vimtricks.wiki Concise Vim tricks, one at a time.

How do I make right-click extend a selection instead of opening a popup menu?

Answer

:set mousemodel=extend

Explanation

If you use the mouse occasionally in Vim, mousemodel=extend makes selection behavior much more predictable. Instead of right-click opening a popup menu, right-click extends the current visual selection. This is useful when you are reviewing logs, diffs, or large blocks of text and want quick range adjustments without leaving your editing flow.

How it works

mousemodel controls how mouse buttons behave in Visual mode and selection contexts.

  • :set mousemodel=extend tells Vim to use right-click for extending the active selection
  • With this set, right-click acts like a selection adjustment gesture, not a context-menu trigger
  • It works best when mouse support is enabled (:set mouse=a), especially in terminal sessions where occasional pointer edits are practical

Example

You start with:

alpha
beta
gamma
delta

Suppose you visually select from beta to gamma, then realize you also need delta. With mousemodel=extend, right-click at delta to grow the selection instead of opening a menu.

Resulting selected range:

beta
gamma
delta

Tips

  • Pair with :set selectmode=mouse if you want mouse drags to enter Select mode behavior
  • Keep keyboard-first precision for final edits, and use mouse extension only for fast boundary adjustments

Next

How do I make buffer jumps prefer the last-used window that already shows the target buffer?