Skip to main content

Core Movements

Intro

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. Left/Right
  2. Up/Down
  3. First/Last
  4. Jump
  5. To Index
  6. Current

Keymap

Loading...

Left/Right

Left/Right means move to the previous/next selection of the current selection mode.

For example:

Selection ModeMeaning
Syntax NodeNext/Previous named sibling
Full LineNext/Previous empty line

Up/Down

Up/Down means move to the nearest selection above/below the current line, except for the following selection modes:

Selection ModeMeaning
Syntax NodeParent or First-Sibling
QuickfixTo first item of next/previous file

◀◀ ▶▶ First/Last

Selection ModeMeaning
Syntax NodeFirst/Last named sibling
QuickfixFirst/Last item
CharFirst/Last char in the current word
WordFirst/Last word in the current token
TokenFirst/Last token in the current sentence
Line & Full LineFirst/Last line of the current file

Jump

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 Swap mode to swap two syntax expressions that are far apart.

Loading...

Note: All letters after the first will be selected based on key accessibility in the chosen keyboard layout.

Index Jump to Index

When this is activated, you will be prompted to key in a 1-based index, which after Enter will take you to the nth selection of the current selection mode.

Recommended selection modes:

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

Current

This is not really a movement, since its 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.