Learn VIM and don’t die in the attempt

Jhonnata Gil Chaves
3 min readOct 18, 2022

--

Continue with our previous post relate to how to install vim and start using that, we learn in this little post about 3 principal things about vim, how to can I added content to a file using insert mode and exit for this, how to I can navigate in any file and finally how to I can move fast using vim, let’s begin.

First of all, we will a create a little file, please follow the next commands:

echo "This is a file to review in vim" > 2_file.txt

echo "this is a second line in my file" >> 2_file.txt

A little clarification at this point is if you need replace all information in a file using echo command you can use a >but if you need append data for an existing file you can use a >> for append more information, like a previous commands.

First of all, we need to open vim. For this you just need type in your terminal vim 2_file.txt and press Enter to join in this amazing world.

Something similar appear

Navigate

For start using vim you can move in the file, so with your file opened we can navigate using a normal arrows like ⇠ ⇡ ⇢ ⇣from our keyboard but is very special move using vim that can help to move in the next level for your moves, you can use a special keys hjkl for a graphical description we use the next ⇠h ⇡k ⇢l ⇣j

Insert

BTW for start modify our file we can use a insert mode for start using this feature you need to press i in you keyboard, with this the terminal mention to you that insert mode start

In this mode you can type anything that you like, for example we insert vim it's awesome for exiting from this mode, you need to press a ESC key in your keyboard

After that the INSERT mode is closed.

Exit

For close our current editor we need to type :q and press enter

The editor mention to us the current changes doesn’t save jet, so for force exit we need to add a exclamation to our command :q!

After press Enter the editor close the file without changes in our files, for the next section we covered how to we can save the changes in our files.

Previous section

Next section

--

--

Jhonnata Gil Chaves

I’m a System Engineer and Software Developer. I love Linux and your philosophy it’s very nice share all knowledge that every day I learn around tech and make so