We had this little Slackware Linux server running as a router/firewall/email server in a closet, in another building, next to a bunch of wiring for this little internet cafe I worked at.
We found out our 'sysadmin' was running a pirate FTP site off of it. They fired him and told me -- since they had seen me using IRC remotely on a shell and assumed that meant I 'knew unix' -- to take over administration of this machine. I was young, naive and thought it would be fun.
A few weeks later I screw up trying to remotely recompile and install an updated kernel (back when this was difficult), and suddenly it stops responding.
So, in the height of summer, I'm stuck in a hot, dark, tiny closet for hours, sitting on the floor cross-legged trying to figure out how exactly I'm going to get this working again.
...and the only editor that you could use was vi, which I had never used before.
It was in that moment that I decided I was going to learn that awful, twisted evil little program because there was no way I was going to be defeated by a text editor. After that I made sure I used vi any time I needed to edit any text file, just so I would know how to use it if the situation ever came up again.
Because it let's me modify text faster, and more precisely than any other text editor in existence. And the portability (console based, *nix) makes it so I can have the same text editing workflow on all of my machines including the several thousand headless servers I manage.
This is the right answer imho. It's not that vim somehow magically speeds up your workflow; I find for most tasks it takes about as long as a traditional editor still. It's just that vim's shortcuts are designed specifically to work the way you think when you work with text documents a lot. I've already internalized the shortcut for quickly cutting and pasting a single line, for instance, because I do that a lot when I'm making lists. And on top of this, it's console-based, which is a big plus over any graphical editor because it means I can use it on any machine.
The vast array of movement and editing commands, and the modal interface with which they're presented allows almost anything to be just a couple of keystrokes away rather than being hidden away in the menus of gui text editors. Yeah, there's a steep learning curve to vim, but once you get the hang of it, you'll feel completely crippled in anything else (of course, until you get really good with $othereditor, but then you can make this decision for yourself, and I'll bet $10 you'll choose vim).
just a couple of keystrokes away rather than being hidden away in the menus of gui text editors
Except that every GUI ever binds the menus to simple keystrokes. That way, "power users" can do things fast, while new users still have a chance to learn.
I mean, don't get me wrong, I absolutely understand the point about having an editor that I can use on a headless server pretty much anywhere, and I put up with vim during day to day use because of that. (cause really, VIM is better than nano at least)
That said, I vastly prefer pretty much anything else for actual coding. Sublime, Atom, TextMate, hell even Notepad++ if I happen to be stuck on windows (although NEVER notepad).
I even caved two years or so ago, and spent 6 months using nothing but vim to see if it changed my feelings about it. I really wanted to feel like I was being more productive, but in all measures, I wasn't. Turns out the mouse is REALLY damn good at doing things like selectively targeting text and precisely moving selections. It's almost like it was designed for that task. Plus it means I don't have to keep hundreds of esoteric key commands in my head!
90% of my editing (4-12 hrs/day depending on the day), is done through an ssh session, so gui editing isn't really even a valid comparison. But that's just my use case. Obviously if another tool works better for you, you should use it.
and spent 6 months using nothing but vim to see if it changed my feelings about it
That is not nearly enough time to learn vim. I learn new stuff about it (and it makes me better) every week, and I've been using vim as my exclusive editor (aside from when I'm giving new stuff a shot) for the last decade.
So this question of yours is here to prove the bottom part of the image, look at all the answers! You won't get mine, I'll go to vim to save those several productivity seconds for today :)
e.g. d is the prefix for all delete commands, y for all cut (yank) commands. So dw deletes to the end of a word, while yw cuts to the end of a word. dd deletes a line, naturally yy yanks an entire line
This is fairly natural and intuitive once you get accustomed to using plain keys as shortcuts (instead always coupled with a modifier)
Reason # 2: Discrete Modes
Insert Mode, Visual Mode, etc. These modes mean that keybinds can be far simpler, often only 1 or 2 characters as opposed to the arcane combinations of modifier keys and letter keys that emacs/nano/ etc demand.
I had personally been using vim in high school and university for quite a while, but without really knowing how to use it (being always in insert mode, using arrow keys and so on). This is not really productive, and my time would have been better served with using another editor.
However, when I started on my first job, I deliberately took the first month or so to really learn vim, and it has been one of the best investments of my time. It makes common text editing chores such a breeze, and all the key bindings get stuck in your muscle memory so they come automatically any way! The flipside, of course, is that I sometimes have hard time using other editors (and Word) without vim key bindings... :wq
70
u/iLostMyAcc Apr 20 '15
I really don't know why people use vim. Can anyone explain it to me?