DEV Community

Cover image for Why you should use vim as IDE
Kada Guetouache
Kada Guetouache

Posted on

Why you should use vim as IDE

vim is powerful text editor (like notepad in windows) that lives inside the terminal in any Linux distribution, and its a great tool for programmers that can make their live easier, vim is very customizable and extensible with plugins that adds all different types of functionality and give the user a lot amount of control that can transform vim from simple text editor to full IDE.

vim is so powerful bare bones not just when you start to add plugins to it, speaking of which before we dive any more deeper lets discuss very a important point.

there are two types of humans or programmers the ones that loves keyboard shortcuts and find them very helpful and accelerate their work and the one that find it very tedious and painful if you are in the second category then vim is not for you as it is heavly rely on keyboard shortcut to perform all types of action from moving cursor inside the text to copying saving and more and that is the strength of vim, but i still encourage you to read this post and give vim a try, but if you in the first category then i believe that vim will change your life in good way just like it did with mine.

Table of content

  1. Brief History
  2. Interface and Modes
  3. Customization
  4. Practice
  5. Conclusion

Brief History

When Bram Moolenaar had bought an Amiga computer, he wanted to use the editor he learned on Unix. Since there was no good Vi for the Amiga, he started with the best that was available (a program called Stevie) and started improving it.

At first, his goal was to imitate Vi. Later new functionality was added, and by version 1.22 Vim included more features than Vi. That time it was renamed from Vi IMitation to Vi IMproved. Over time the gap has grown wider, now it’s hard to think of a reason to use Vi instead of Vim. I would recommend all Vi users to switch to Vim.

Of course, ports to various operating systems have been done by different people. The port to Unix was a milestone, since Vim started competing with Vi. Currently Vim runs on more than a dozen different operating systems. That is awesome indeed.

The first version of Vim that was released to the general public was 1.14, which was published on November 2, 1991. Over time Vim has grown constantly. It has become a complex program. Adding functionality is taking much more effort now than before.

Here’s the timeline of Vim development:

1988 Vim 1.0 Vi IMitation on the Amiga
1991 Vim 1.14 First public release (on Fred Fish disk #591)
1992 Vim 1.22 Port to Unix, renamed to Vi IMproved
1994 Vim 3.0 Multiple windows
1996 Vim 4.0 GUI
1998 Vim 5.0 Syntax highlighting
2001 Vim 6.0 Folding, multi-language
2006 Vim 7.0 On the fly spell checker, support for tabs

The list shows only the most important features, but each version brought us a lot of nice features. For example, if we take version 6.0: the major new feature was folding. But, there were other great features such as UTF-8 support, multi-language support (translated messages and menus), vertical window split, improved performance for syntax highlighting, etc.

Vim has grown to an big open source project, but it’s also important to mention that it’s charityware. The basic idea with charityware is that everybody who uses Vim is asked to donate to a charity. Thus the use of Vim is free, if you think it’s worth something, you can give that money to a good cause. Moolenaar helped with establishing a foundation called ICCF Holland that works to support to a children’s center in Uganda. Source jovicailic.org

Interface and Modes

Interface

Like i explained vim earlier heavely relays on keyboard shortcut in fact that's exactly the vim interface, vim is simple page text editor with no menus of icons just an empty bar on the bottom that show the vim commands you enter and some information about the file.

Vim Modes

Vim Comes with 12 modes 4 of which are basic and in fact all i have find my self using, in here we are going to explore the 4 basic modes only:

  • Normal Mode - this is the default mode when you open vim, and it is the editor command mode.
  • Insert Mode - in this mode buffer can be modified with text entered.
  • Visual Mode - similar to normal mode but used to highlight areas of text then execute commands on areas of text.
  • Select Mode - works similarly to visual mode however if your type a printable character them vim insert that character and start insert mode.

Customization

Vim allow three levels of customization the first one is per-user basis using the command mode in which when the text editor restarted the changes will be discarded the second one is to set configurations to system-wide using vim configuration file which will make the changes stay until you deside to remove them the last level is to add a different functionality to vim using plugins.

Practice

Here comes the fun part Yeah !, you can open vim (inside the terminal) by typing vi or vim then name of file you want to (optional) like so vi then press enter.
this screen means that you are inside vim.
vim welcome screen
now if you try to type anything nothing will happen and if you try to exist you don't know how a moment of panic indeed in fact we all have the same feeling using vim for the first time, the explanation is that you are now in command mode you can't type in this mode and to exit just type :q or :q! the second one means quite without saving any changes, if you ever want the type a command use : follow by the command wanted.

to actually start typing or edit a file type i to enter insert mode the type anything.
vim with writing message
to save what you have edited in the buffer you must exit from insert mode to command mode by use C-c or control then c in keyboard then type :w for write then you can exit if you want.

navigation inside vim in command mode can be done either by arrow keys or h-j-k-l for left up down then right which is recommend, but in insert mode you have to use arrow key but that's not how we do it you should use command mode for navigation inside vim to get the most of its features.

Conclusion

Vim is a very powerful Linux text editor that lives inside the terminal which can be transformed into full IDE with any desired functionality, its highly loved in the developer community and it can make the life of programmer very ease, using vim at the beginning is very hard but as soon you get the hang you can't stop using it, like right now i'm using vim to edit this post.

Oldest comments (0)