Neovim for Beginners — Motion

Learn the different types of motions, and the plugins to improve them.

alpha2phi

--

Neovim for Beginners — Motion

The support of different types of motions in Neovim is one of its key strengths. We are going to

  • Learn the different types of motions.
  • Check out Vim tutor to learn the different types of motions.
  • Explore plugins to improve the different types of motions.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

Types of Motions

Let’s check out the different types of motions

Jump Motions

A jump (:h jump-motions) is a command that normally moves the cursor several lines away.

Jumps are remembered in a jump list. With the CTRL-O and CTRL-I commands we can go to cursor positions before older jumps, and back again. There is a separate jump list for each window.

The jump commands include `, , G, /, ?, n, N, %, (, ), [[, ]], {, }, :s, :tag, L, M, H, and the commands that start editing a new file.

  • :ju,:jumps — Print the jump list.
  • :cle, :clearjumps — Clear the jump list of the current window.
  • :keepj, :keepjumps — Moving around in command does not change the behavior of the jump command, marks, the jump list, and the change list.
A Jump List

We can also jump in a change list (:h changelist).

When making a change the cursor position is remembered. One position is
remembered for every change that can be undone unless it is close to a
previous change.

  • g; — Go to an older position in a change list.
  • g, — Go to a newer cursor position in a change list.

We can use the :changes command to print the change list.

Mark Motions

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.