DEV Community

Guilherme
Guilherme

Posted on

VIM - Insert and Change

As I mentioned in the post before, VIM is one of the techs I want to learn this year. VIM has been always present since my early days in tech but I never spend time on it. I guess now it is time to make an amend with the past. 😅

Insert Mode:

i - insert before the cursor
I - insert in the beginning of the line
a - insert after the cursor
A - insert in the end of the line
o - insert below the line
O - insert before the line
[count] [motion] text - repeat the motion [count] times

Examples:
8 i * - insert the character * 8 times in the same line
8 o # - create 8 new lines starting with #

Change:

R - overwrite the existing text
r - Replace one character
c w - change the word
c c - Change the entire line
c $ or C - replace from your current cursor to the end of the line
~ - Switch character from upper/lower case.
g ~ w - Switch a letter from upper/lower case.
g ~ $ or g ~ ~ - Switch the line to upper/lower case.
g U w - make the word uppercase
g U U - make all the line uppercase
g u w - make the word lowercase
g u u - make all the line lowercase

Joining lines:

J - Join lines with a space by the end of the current line.
g J - Join lines without a space be the end the current line.
[count] J - Joint [count] lines together

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay