Using kickstart.nvim

NeoVim Tutor

Basic Commands

Normal Mode: Use ESC to return to normal mode. Undo: ESC + u undo the latest change. Open Linked Help: Enter on links will open the linked help section (close window with :q). k will achieve the same outcome. Delete a character: Using h, j, k, or l hover over the character you wish to be deleted and press x. Inserting text: Using i , you can hover the cursor after the character location you wish to insert at. Use ESC to return to normal mode. Appending text: Using A (capital), you can append text, with the cursor being anywhere on the line. Use ESC to return to normal mode. Editing/Creating a File: Using nvim FILENAME you can create and open said file in NeoVim.

Undo

There a few more features of the undo command in NeoVim. They are as follows:

Typing u will undo the last command executed. (lowercase u) Typing U will return the line you are on and editing to its original state. (uppercase U) Typing CTRL+R will redo the commands. (undo the undo’s)


Deletion Commands

Delete a word: If you move the cursor to the beginning of the word you want to delete, and press dw, it will execute the deletion. Delete the rest of the line: If you need to remove some trailing text, go to the end of the line and press d$. It will open up a deletion menu after you press d, then combine it with SHIFT + 4 (which is $).


Operators and Motions

In the deletion commands section, the commands get a little more complicated, as you need to combine a few keystrokes. They are classified as operators and motions. The format for the commands are as follows:

d = (delete) operator; motion = motion (what the operator will act on) Format: d motion

Basic list of motions: w: until the start of the next word, EXCLUDING the first character. e: to the end of the current word, INCLUDING the last character. $: to the end of the line, INCLUDING the last character.

Example: Typing d + e will delete from the cursor to the end of the word. (de)

Note: You can still use the motions without the operator, it will just move the cursor as specified, instead of deleting.

Full List of Motions

Using Count for Motion

Typing a number with an operator repeats it that many times.

For example: 2 + w = Moves the cursor forward by two words. (2w) 3 + e = Moves the cursor forward to the end of the third word. (3e) 0 = Moves the cursor to the start of the line.

Using Count to Delete

In combination of the delete operator, a motion, and a count (before the motion), you can delete more than just single characters or words.

For example: d + 2 + w = Deletes 2 words ahead of the current character placement. (d2w) d + 4 + e = Deletes 4 words at the end of the next word, following the current character placement. (d4w)

Whole Line Deletion

Due to the necessity of deleting whole lines easily, there is a simple command to delete entire lines.

Simply, use d + d. Or rather, dd. You can also combine a count to delete multiple lines.

Note: When you execute dd, whatever you delete on that line gets stored in a NeoVim register for future use. See: Put Command

For example: 2 + d + d = Deletes two lines. (2dd) 4 + d + d = Deletes four lines. (4dd)

Conclusion

The final format for a change command, now that we have learned about operators, counts, and motions, is as follows:

operator + [number] + motion

Where: operator = What action to execute, such as d for delete. [number] = An optional count to repeat the following motion. motion = Applies the operation on the text following cursor placement. i.e., w = word $ = end of line

We can also use 0 to move to the start of the line.

We learned some more undo + redo commands: Undo


Keybinds to Know

Help Menu:

  • SPACE + s + h
    • Space opens up a menu of options.
      • s is for search, h is for help. Keybinds Menu:
  • SPACE + s + k
    • Space opens up a menu of options.
      • s is for search, k is for keybinds. Search by Grep:
  • SPACE + s + g
    • Space opens up a menu of options.
      • s is for search, g is for grep. Search Files:
  • SPACE + s + f
    • Space opens up a menu of options.
      • s is for search, f is for files.

Put Command

Replace Command

Change Operator

More Changes with c