Vim tutorial for beginner! (Part 1)
Wumi4 (486)

What's up guys!

You might ever heard of Vim, it is a pretty amazing and powerful (but sometimes a nightmare with other people) text editor. So, in this tutorial, you will learn about how to use Vim properly and without a hassle! :D

This is the part 1 of this tutorial series. I will also do the part 2 if I have enough time and motivation!

Without further ado, let's get started!


First, of course, we need to install Vim first, I'm using Neovim for this tutorial but you can also use pure Vim for this!

To install Neovim on your Linux system, you can simply use a package manager (like apt or pacman):

sudo apt-get install neovim
sudo pacman -S neovim

With MacOS, you do the same with Homebrew:
brew install neovim

In cases that you are using Windows, check out this.

Ok, so your Neovim has been installed, let's open it up! To open Neovim, make sure to type nvim ( Yes, nvim, not neovim).

You will be greeted by this:

If you see it from your Terminal, congratulations! You have just installed and start Neovim correctly! :D

Now, our text editor is ready and let's dive into Vim tutorial!

Modes in Vim

In Vim, there are 2 basic modes, insert and normal. insert mode is the mode thats allows you to enter code like you do in a normal text editor, and normal mode is the mode that you work with Vim key bindings and commands, you can only see your code (only see and cannot edit) in this mode.

Now, in default, we are in the normal mode, to change mode in Vim, use Esc for normal mode and i for insert mode.

Let's move on!

Basic movements in Vim: h, j, k, l

In Vim, we use h, j, k, l key to move the cursor instead arrow key. The key movement are:

h - left
j - down
k- up
l - right

Navigate text in Vim: w, e, b

To navigate text in terms of words, we will use w, e, b key!

w moves to the start of the next word, e moves to the end of the word, and b moves to the beginning of the word!

Number powered movements

Vim doesn't limited to individual keys in moving, you can mix a number with a movement key to make works better. e.g. 3w is the same as press the w key 3 times, and 9b is same as press the b key 9 times.

Insert text repeatedly

If you need to type a specfic number of a words e.g. 30 s words, you can do it by typing 30is Esc. You save your time! :)

Find words with f and F

To finds the occurence of the next or previous character, we will use f and F e.g. fq finds the next q character and vice versa, Fq finds the previous q character.

You can combine f and F with a number before the key, for example, 3fq finds the next 3rd occurence of q.

And that's the end of part 1 of this series, it's pretty short, but I hope you enjoy and like my work! If you like it, make sure comment down below! Have any issues or have an idea? Let me know!

And make sure that you have tried and practice all of them in your Neovim or Vim, practice is better than reading!

Oh, and if you don't know how to quit Neovim, just simply change to normal mode and type :q! to quit Neovim without saving!

Now, see you on the next part! ;)

You are viewing a single comment. View All
CodeLongAndPros (1589)

@Highwayman I think the CDN was premature, CWars was a little bit of cycle framing (Could have been done in three)