Skip to main content

Core Movements

Core Movements is one of the main concepts in Ki, because it is standardized for every selection modes.

There are 9 movements in total:

  1. Previous/Next
  2. Up/Down
  3. First/Last
  4. Jump
  5. Parent Line
  6. To Index
  7. Current

Previous/Next

Keybinding: h/l
Memory aid:

  • h stands for higher, which means previous.
  • l stands for lower, which means next.

Up/Down

Keybinding: k/j
Memory aid:

  • k means king, which means up.
  • j means jack, which means down.

In most selection modes, up/down moves the selections upwards/downwards, except for the following selection modes:

Selection ModeUpDown
Syntax NodeExpand selection to parentShrink selection to first child
QuickfixGo to first item of previous fileGo to first item of next file

First/Last

Keybinding: ,/.
Memory aid:

  • ,/. looks like </> on the keyboard

Recommended selection modes:

  1. Line
  2. Column
  3. Search

Jump

Keybinding: f
Reason: This keybinding is used by Vimium.

This is my favorite movement, which is inspired by Vim Easymotion and friends 1.

It allows you to jump to your desired position (as long as it is within the screen), with just 4 keypresses most of the time.

It works like this:

  1. Choose your selection mode
  2. Press f
  3. Press the first letter of the selection that you want to jump to.
  4. Press the letter that appears on top of the selection.
  5. Done.

Recommended selection modes:

  1. Syntax Node
  2. Word
  3. Token

This movement can also work with the Exchange mode to swap two syntax expressions that are far apart.

Parent line

Keybinding: -

It moves the current selection to its nearest parent line.

Parent lines are highlighted lines that represent the parent nodes of the current selection.

This is useful for example when you are within the body of a function and you want to jump to the function name.

This is also practical in the File Explorer because the file explorer is rendered using YAML, so going to Parent Line means going to the parent folder!

To Index

Keybinding: 0
Memory aid:

  • 0 is related to the index.

When 0 is pressed, you will be prompted to key in a numerical index (where 1 represents first), and it will jump the current selection to the nth selection of the current selection mode.

Recommended selection modes:

  1. Line (For going to a specific line number)
  2. Column (For going to a specific column number)

Current

This is not really a movement, since it's not "moving" the selections per se.

There's no specific keybinding for Current because it is triggered whenever a selection mode is chosen.

For example, choosing the Line selection mode causes the current line to be selected, choosing the Word selection mode causes the current word to be selected.

In cases where there's no matching selection under the cursor, the Current movement chooses the nearest selection based on the following criteria (in order):

  1. Same line as cursor (if possible)
  2. Nearest to cursor (in terms of horizontal movements)

Footnotes

  1. hop.nvim, leap.nvim, lightspeed.nvim etc.