Vim tutorial for beginner! (Part 1)
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,
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 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
normal mode and
Let's move on!
Basic movements in Vim: h, j, k, l
In Vim, we use
l key to move the cursor instead arrow key. The key movement are:
h - left
j - down
l - right
Navigate text in Vim: w, e, b
To navigate text in terms of words, we will use
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
To finds the occurence of the next or previous character, we will use
fq finds the next
q character and vice versa,
Fq finds the previous
You can combine
F with a number before the key, for example,
3fq finds the next 3rd occurence of
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! ;)
Please don't post "parts" or a series of posts to the Tutorials board. Write a good tutorial in one post and post it. Otherwise, it can be considered cycle farming/squeezing. This is just a warning.
@Vandesm14 I'm sorry, it's pretty late when I write this post (9 o'clock, I think) and it was 9:30 when I done, so I need to set the tutorial to parts. I already have plan to write all the stuff of Vim in one single post. But it 's 11:07 PM in my country in the time I write this reply...
Edit: Maybe I will fix the title and edit the post to make it a single tutorial post if I have time tomorrow.
@MATTHEWBECHTEL I apologize if I accidentally warned you. You we're warned for asking for upvotes on one of your posts/comments. Due to the way the moderation system works, I am not able to go back and take a look at the evidence as it's most likely been deleted. I apologize for the inconvenience.