Run VIM
I’m a fan of SublimeText and it suits well for my work (I code Python, MATLAB, LaTeX and sometime C++). People often tell me that if something works well for me, I shouldn’t change it. However, I’m a curious guy and VIM is recommended to me several times in … 10 years and I was too lazy to try it. So I write this blog post as a simple tutorial, a simple first step for myself. If it isn’t suit my work-flow, it’s still nice to know about this tool. I also hope this would be useful for other people who want to learn VIM from zero.
There is a joke from linux users about Windows user: “The easiest way to generate a random string is telling a Windows User type in VIM”. Starting as a Windows user, it’s funny that it was true for me the first time I used VIM (long time ago) and I don’t have time to use it again, until recently.
To install vim:
sudo apt-get install vim
How to create a text file with vim:
Open vim by opening the terminal and input:
vim
Then press Enter, what we should have is like this:
To go to inter mode, press i, to return to command mode (default), press Esc.
We can navigate through text in the command mode with directional buttons as H-J-K-L, equivalent to left-up-down-right.
Now as told earlier, press i to go to Insert mode (VIM will tell us with INSERT at bottom left corner). Insert whatever text you like.
Now, to save it, we need
w
command, press Esc to quit Insert mode, type
:w testtxt.txt
and press Enter.
As a result, VIM will create a testtxt.txt file, note that because I run the terminal in Home folder, then the saved file is located there.
[to be continued…]