So first of all, to quote one of my tweets:
After using it a while, I apologise to vim users. It isn't weird and crap, it's just weird.
I haven't exactly been the most positive of vim. After all, as a Linux user, it's nigh impossible to use many of them without one of them using vim or a vim-like interface for something. And while nano manages to be relatively easy to understand, vim does not. Because vim is weird.
But after a while of using it, I realise it's weird for a reason. Want to get rid of a line? In other text editors it's:
- Left arrow to start of line
- Hold shift
- Hold right arrow to end of line
- Press delete
In vim it's:
- Type dd
Don't like that 13 line function anymore, and want to delete it?
In normal editors it's:
- Up and left arrows to start of function
- Hold shift
- Down and right arrows to end of function
- Type 13dd
Weird, obtuse, but once you learn it, it's far more efficient. A final example. Suppose you want to rename that variable from $car to $vehicle:
A normal text editor?
- Search and Replace (somethings this is part of search anyway and under Ctrl-F, other times it's its own menu, under Ctrl-H)
- Type in $car.
- Type in $vehicle
- Type :%s/$car/$vehicle/
At this stage, I'm still not getting the most out of vim. After all, I only know a few basic commands (and even then I'm missing a few. Any vim users care to tell me how to Select All?). Yet I'm already finding it easier and faster than I did in other editors. vim is also cross platform, unlike the Windows-only Notepad++ and Linux-only gedit, which means I can use the one editor across all OSes. For that matter, it's even available on my jailbroken iPod touch.
Another useful feature of it is it's huge styling and plugin community. Again, Sirupsen pointed me to BusyBee. I didn't quite like that, so I found Mustang, the theme it was based on. I haven't yet found plugins that I'd reccomend, but the choice is huge. One of the inbuilt ones, allows you to set different options per language. I'm doing a project in Ruby atm, and in any other editor I'd have to change my settings to and from my personal preference of tabs and Ruby style of double spaces. With vim, I can set it to do tabs with all other files, and just do the silly double space thing with Ruby.