Back Hamza Tamenaoul's blog

Vim for starters - the minimum you need to know

The first time I heard about Vim, it was 5 years ago. And my natural reaction was : ” Why in God’s name, will I sacrifice the comfort of a modern text editor like sublime text, for an outdated, ugly, and complicated text editor ? “ (You can’t even use the mouse !).

Last year, I immersed in the fabulous world of Linux customization, this fixed the ugly part. So I decided that maybe I should give Vim another shot. And now, I am a happy Vim user for six months.

In this article I will not try to convince you to switch to using Vim, I will only give you the basics, the “what you need to know as beginner” to dive in the fabulous world of Vim.

Let’s start !



Well you need to download the installer from the vim website, install it, and you are good to go !

Linux ( Debian based distributions ) :

It’s as simple as it seems !

sudo apt-get install vim

Mac :

You can use Homebrew.

brew install vim


A little bit of theory (just kidding)

Before you start using Vim, you should be aware that vim has a different philosophy. For starters, your mouse in the beginning is useless. Secondly it interprets what you type on your keyboard based on which mode you are in. Depending on the mode, your input will trigger different Vim behaviors. The default mode, the one you’ll find yourself using when you open vim is the normal mode. it’s in this mode that you’ll be navigating in your file or executing vim commands. The second one is the insert mode, the most friendly, since it makes vim do what you expect a text editor to do, write text. There are other modes that I won’t cover in this article since they are more advanced. As a reminder, if you find yourself lost in a mode, then the escape key is your friend, it will put you in the normal mode.

#The fun part !

Opening or creating a new file:

Now open your favorite terminal (or CMD/PowerShell), and type the command :

vim name_of_your_file

This will open the file you specified, or the create a new one if it doesn’t exist. Once you do this you’ll find yourself in the normal mode. We are not writing text right away, first you need to know some basic Vim commands. A Vim command usually start by typing ‘:’ then the command, and the first one is exiting Vim since it’s the most asked question about Vim.

Writing some text (Finally …):

Well if you survived until here, you’ll find your reward by typing “i”. It will put you in the insert mode, and now you can type text as you please. And when you are done, you can use your escape key to go back to the normal mode to save your changes or quit.

Some other useful shortcuts (In the normal mode) :

Bonus (Showing line numbers):

:set number


Vim, or not Vim, this is not the question. A text editor is ,first of all, just a tool to achieve bigger things. But a great tool, makes them easier. I hope that, with this article, I have helped you in your quest of finding the adequate text editor for you. And that this quick introduction to Vim, have opened your appetite to learn more about Vim, or a least have expended a little bit the horizon of your knowledge.

PS: This is my first blog post ever, and english is my third language, so I am open to feedback and good criticism, and thanks for reading ! ) “

Contact me by mail © 2018 - 2019