denhamparry / website

Hugo website for DenhamParry

Home Page:https://denhamparry.co.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Learning to Vim

denhamparry opened this issue · comments

Yet another guide as to how to use Vim and learnings from getting started

$ **vimtutor**

Lesson 1

Cursor

  • h - left
  • j - down
  • k - up
  • l - right

Exit

  • :!q - trash all changes
  • !wq - save all changes

Characters

  • x - delete the character next to the cursor
  • i write something here - insert before the cursor
  • a write something here - append after the cursor

Normal mode

  • <esc> - enter Normal mode

Lesson 2

Delete

  • dw - delete from cursor to next word
  • d$ - delete from cursor to the end of the line
  • dd - delete the whole line

operator [number] motion

  • operator - what to do (e.g. d for delete)
  • [number] - optional count to repeat the step
  • motion - moves over text to operate on (e.g. w for word, $ for end of line)

Motion

  • 0 - move to start of the line

Undo

  • u - undo previous actions
  • U - undo all changes on a line
  • CTRL-R - undo the undo

Lesson 3

Put

  • p - Put the deleted text after tech cursor.

Replace

  • r - Replace the following character.

change [number] motion

  • change - change from the cursor to where the motion takes you.

  • [number] - optional count to repeat the step

  • motion - moves over text to operate on (e.g. w for word, $ for end of the line)

  • e.g:

    • ce - change from the cursor to the end of the word.
    • c$ - change from the cursor to the end of the line.

Maybe instead of learning how to focus on how to