Dayalan Saravanan


Vim Reference

Thursday, May 28, 2020

Movement in insert mode

Moving screen

Marking location

Macros

Registers

To search for similar word under the cursor type / then press ctrl-r and ctrl-w ← this will copy the word under the cursor to command line. Now you can edit it and press enter. To return to your previous possition hit ctrl-o.

Editing

Indent

Correcting Text

Combination with c or d
- t<char> exclusive match: continue up to the next <char> on this line
- f<char> inclusive match: continue up to the next <char> on this line
- i<char> exclusive inner match: apply to the text bounded by <char>
- a<char> inclusive inner match: apply to the text bounded by <char>

Say that I have the code below, and I want to completely replace the code inside the map() with something else:

signal.map(count -> String.format(“%d cookies, ah ah ah”, count));

The first thing I need to do is get my cursor anywhere inside the parentheses belonging to map(). The exact command I use depends on where I end up:

Some usefull commands:
- dw → delete to the end of a word
- diw → delete the entire word at the cursor
- cit → change the content inside an HTML tag
- cip → change the content inside a paragraph
- ci" → change the content inside a “…”
- y4j → copy 4 lines

Working with files

Tabs

Explore file system

Visual mode

Search and replace