|Learn VIM with the OpenVim Interactive Tutorial|
|Written by Nikos Vaggalis|
|Thursday, 20 June 2019|
Software development is flooded with IDE's and text editors, the general consensus being that VSCode is the most popular. What about Vim?
Hardcore Linux devs who like to get their hands dirty still prefer the timeless and venerable Vim. Personally, I think that anyone working with a Linux shell should first learn to use Vim. I use it for writing Perl, shell scripts or manipulating text without craving the bells and whistles that VSCode offers.
When I started out with Vi(m), there were just a few text-based tutorials, but now they come in a variety of formats, and certainly when I was starting out I would have found such a good flashy and interactive guide most helpful.
It is setup as a small notebook/laptop that displays instructions in scrolling text, just like someone is typing on the keyboard. To indicate which key you have to press when the user's input is required, it flashes the key's colour. For example, in order to enter the Vim's 'insert' mode it blinks the key 'i' having let us know that:
Vim has two basic modes. One is insert mode, in which you write text as if in normal text editor. Another is normal mode which provides you efficient ways to navigate and manipulate text.
At any time, you can see which mode you are in on the status bar which is located at the top of the editor.
Let's try it out! First, change to insert mode.
So you have to press 'i', type some text and next hit the blinking Esc key to return back to normal mode.
As with every online playground, the great convenience is that you don't have to own a Linux box, have access to a shell or have to setup Vim itself since everything runs inside the browser. This makes it a perfect match for those starting out, or wanting to first try Vim out so to decide whether it's a good fit for them.
In the next lesson you learn how to move around, but not in the classic way of the arrow keys:
In contrast to regular text editor, you use keys h, j, k, and l instead of arrow keys to move the cursor.
So far so good, but the real power of Vim starts to show with its alternative ways of navigating through text:
To navigate the text in terms of words, you can use keys w, b, and e (also W, B, E in real Vim).w moves to the start of next word; e moves to the end of the word; and b moves to beginning of the word.
Among the rest of the tutorials you get to learn how to find a character with f and F, go to matching parentheses, go to the start/end of line, use the g and G operators, search for text and besides the insert and normal mode, the visual mode.
There's more, however; after completing the tutorials you can put your newly gained skills to test by practicing on a block of text enriched with Context-Aware help.That is, when you perform a task, the help system tells you what your next action can be. For example, going into insert mode with 'i', it then tells you that the next thing you can do, after typing some text of course, is to press Esc in order to exit this mode and return back to normal.
Or, when pressing a number e.g. 5, the context switches to [n] [action/movement]. Replace [n] with 5 and [action/movement] with any of the following to available options :
G or [number]G
h, j, k, l
Although Vim has a reputation of being difficult to master, it is at the same time the hacker's best friend and OpenVim's intuitive way of going through the basics helps shape the next generation of hackers. What's more, the OpenVim engine is open sourced on GitHub making it readily available for forking or even contributing to.
So even if you have no previous experience with Vim but want to find out what the fuss is about, then this is your chance!
or email your comment to: firstname.lastname@example.org
|Last Updated ( Thursday, 20 June 2019 )|