2012-02-14

My valentine day's post for Vim

WTF is Vim?
From vim.org:
Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.
Vim is often called a "programmer's editor," and so useful for programming that many consider it an entire IDE. It's not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files.
Asides the official/commercial crap it's a minimalistic editor meant for text editing. It has a totally different approach to editing so it takes some time learn it. Yet it is impossible to completely master it. Why? Because it has almost infinite ways to be customized and there will always be a something that you forgot/did not knew about it. Despite that it is really small. 

Why do people use it?
Vim usually comes with all major Linux distributions (or at least Vi - older and even smaller version of Vim). So it means that if you ssh to a server - you probably will find Vim to edit files/configs with.

It's cross platform so you can have same editor (with mostly same configuration and same look and feel) in your Linux server, Mac home box and Windows work-desk. 

Since it has crap-tons of plugins - it can be extended to change IDE.

Options
As mentioned before - it has crap-tons  of plugins so you can end up most of the arguments with - "there is a plugin for that". Sure with the exception of image processing. That's left for Emacs.

Also if you don't like cmd/terminal apps there is GUI versions of vim as well, but primarily I concentrate on Terminal version, because I'm geek like that. Sure there is even different spins of Vim (pre-configured Vim's) or easy Vim (evim), but I tend to ignore those as well, because in the end you will end up with your own version of Vim anyways...

But IDE is made for development of <insert programming language here>
Yes. And it works as a charm. Some of the IDE's can handle even few languages, but what happens if you need to edit just a config file? Using same IDE would be overkill. Just to load damn thing would take a considerable amount of time. So you would load up tiny text editor of some sort (just for that [sometimes edit a config file] learning Vim is not worth your time since you would just drop in, make changes and get out).

But what happens when you enter that tiny editor? Suddenly it becomes harder to navigate, there is no auto-completion, no tags, no manual shortcuts or what not. 

Yes I am aware that you can config gedit or other small editor to do quick tasks, but I'm trying to make a point so shut up. Also you cannot use gedit in Linux server. If you can - this means you have GUI there and that means that you're doing the whole server wrong - it's not windows. Back to the point.

IDE is meant for specific task. Like a screwdriver for a screw or hammer for the nail. But when it comes to different situations either you have to spend a lot of time reconfiguring damn thing or you will do a sloppy job using the very same IDE. Sure hammered in screw will hold, but one day you might end up screwing a nail...

Whole academic world uses Emacs!
That's not entirely true. Yes Emacs is a lot more popular in academic world and I know few professors who use it, also database Stanford online courses was recorded while professor was using Emacs. Yet if you would look at system administrators - Vim is a lot more popular there as well so 1-1.

Jokes aside Emacs is a great tool to create text. Yet I personally don't like it's ideology. It tries to become everything at one. Need an extra terminal window - here Emacs terminal. Want to see that picture - here you go. Want to watch that film sure!? So Emacs tries to be your OS and change tools that is meant for specific tasks to make things more "unite". That's why there is a joke that Emacs is a great OS, yet it lacks decent text editor and I have to say it is soo true. So if you need complete and easy package for doing anything - Emacs way to go. But If you leave films for tools such as VLC and in search for tool to edit text - Vim is way to go.

My story
Why I use Vim - simple. I always fancied that hacker style desktops with tons of text and ncurses GUI's, also I love Linux and do web development - this means I have sometimes to do editing/configuration in servers and I wanted a tool that would be the same in everywhere. Oh and Ubuntu server (I started my Linux career there) have Vi pre-installed.

I've used to use heavily configured Gedit, yet it felt lame. Potential of an editor ended up quickly... At my first Job I tried to use IDE as a "professional" developer (net-beans) yet it also did not stick. It loaded slowly, felt bulky and boring stuff taken too much screen space. It distracted me and was pain to configure/personalize. Since I knew basic usage of Vim - I started to use it more and more especially when few colleges were using it as well, they helped me to move along and showed plugin magic. Now I wouldn't change it to any IDE.

So, WTF is Vim?
It's an editor. Primarily - a code/configuration file editor. If you would monitor what you're doing with a text, you would see that most of the time you're changing text not creating it. And by changing I mean moving or modifying text. That's why Vim has 3 modes. To insert text (you do that the least amount of time), to manipulate text (normal mode) and to highlight text for easier bulk manipulation of it. It is build in mind that moving around has to be simple and efficient, that change text should be easy and comfortable.

That's why academics prefer Emacs - they are creating texts, not editing them and that's the same reasoning why system administrators prefer Vim - they're changing aka editing config files, not creating those.

Development is also primarily consist of existing projects support or development - extending the same project and thus requires mainly to edit the code not to create it.

Don't get me wrong by edit I mean also extend it and all those fancy features for auto-completion and syntax checking is included. As I mentioned - "there is plugin for that". Think with a bit more open mindset when reading this.


Final notes
I had this article/post/blah in mind for over a couple of months and just now I decided to put it finally on bits, probably kilobytes... (wanted to say paper but damn that's internet)...

The main idea is that Vim is great tool for anything you trow at it. It might not be as easy to learn and it might make you mentally ill by using "hjkl" everywhere but it is worth it.

Some people will love it, some will hate it. So choose your own weapon for work. If you're still reading this and not writing an angry comment - it might be just for you. Otherwise I will not even bother to give a suggestion since you're not reading and you already have an editor you (probably) love.

So it happens that today is Valentines day and this is how show my love to my weapon of choice. Now it's time to go home and show some love to a person I truly love, so I'm leaving you here with your thoughts. If you will be patient enough you will find more articles about Vim here, yet I cannot promise when it might happen or how many of these [articles] you will have to skip until mentioning Vim again.