DEV Community

Guilherme
Guilherme

Posted on

VIM - Search, Replace, Text Objects and Tags.

Same Line Search Mode:

f{char} - Forward search
F{char} - Reverse search
t{char} - move you to the next occurrence of the character afterwards
T{char} - Same as t but in reverse
; - Repeat in the same direction
, - Repeat in the opposite direction

Searching:

/{pattern} - Forward search
?{pattern} - Reverse search
n - Repeat search in the same direction
N - Repeat search in the opposite direction
* - Forward search for word where the cursor is current located
# - Reverse search for word where the cursor is current located

Substitute Command

Format:

:[range]s/{pattern}/{string}/[flags]
Enter fullscreen mode Exit fullscreen mode

Global Substitution:

:%s/{pattern}/{string}/g
Enter fullscreen mode Exit fullscreen mode

Text Object & Tags

Format:

{operator}{a}{object}
{operator}{i}{object}

Examples:

daw - Delete A Word
ciw - Change Inner Word
ci" - To change what is inside quoted strings
di[ - Delete what is inside brackets
yi< - Yank what is inside angle brackets
dap - Delete the entire paragraph
yas - Yank a sentence. A sentence is defined as ending at a '.', '!' or '?' followed by either the end of a line, or by a space or tab.

Image of Docusign

🛠 Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs