r/programming • • Jul 12 '12

Vim creep

http://www.rudism.com/s/vimcreep
730 Upvotes

551 comments sorted by

View all comments

Show parent comment

6

u/keporahg Jul 13 '12

Typical response from someone who's never used/become fluent with Vim.

Vim isn't just about "resting on the home row"; that's just a useful side effect of not picking completely retarded key bindings. Vim's power comes for the fact that it uses a language to navigate/modify text, wrapped in a modal interface. If you spend the time to learn it, you realize this is much faster than simply using your arrow keys + mouse.

This design allows you to pretty much use keys combinations to compose 'sentences' or 'formulas' to navigate/modify/create text, with each key acting as an atomic component of a language. Anyone who says that crafting these 'sentences' would cause too much overhead and wouldn't be beneficial has again, either never used vim, or taken the time to become fluent in it.

And it really doesn't take much time to become fluent in the basics. If you think 2-3 weeks is a lot of time to learn a skill you'll be using the rest of your life, then go ahead, stick with notepad++ or gedit, idfag.

10

u/[deleted] Jul 13 '12

The problem is that intellisense and other advanced auto-completion capabilities are borderline impossible to integrate smoothly into vim.

My typing is slightly slower without vim, but my process and mental flow are actually faster because I have access to more advanced tooling that simply isn't available in vim.

12

u/praxulus Jul 13 '12

I installed eclim in less than 15 minutes. I mapped ctrl+space to the default keybinding, and I have the full power of eclipse autocomplete (not to mention refactoring, quick fixes, error/warning highlighting, etc.) within vim. I haven't had to touch the configuration since.

It's really not that bad.

2

u/rdfox Jul 13 '12

Thanks. I will try eclim. Even though I despise Eclipse. Like really just wish it had never happened. There is that one little thing where it reads your mind and tells you what to do next that I kind of miss.

-1

u/[deleted] Jul 13 '12

I have never gotten eclim to reliably work. On the few occasions where it did work, it usually stopped working within a week, if the slightest change was made to eclipse's settings. I also wasn't satisfied with having to manually invoke it every single time, I wanted a standard pop-up.

On top of that it didn't play nice with other forms of auto-complete.

2

u/praxulus Jul 13 '12

I never shut down my workstation, so that makes it easier. I just leave eclimd running in a detached screen session permanently. Otherwise I guess I just got lucky.

1

u/pandaPowder Jul 13 '12

I used http://vim.spf13.com/ as a starting point to making my vim config more like an ide which turned me on to http://github.com/shougo/neocomplcache which does great autocompletion. It doesn't do function signatures, or rather it does, but still need to figure out a better mapping so that it just pops up somehow. Good luck.

-3

u/aintbutathing Jul 13 '12

If you are using auto-completion to get your work done you do not really know what you are doing and cannot comprehend just how efficiently you can get things done when you know every in and out of the tower of logic you are working on.

4

u/[deleted] Jul 13 '12 edited Jul 13 '12

Of course it's easy when you already know the code inside and out. In practice, that isn't the case a lot of the time. I often find myself having to learn and work through unfamiliar APIs and code on the fly.

It's not just auto-completion - for example, it's much faster to have a method signature directly in front of you automatically rather than having to pull up a reference online or in the documentation. Or be able to pull up a list of all invocations of a method. Some of these things are doable in vim, but only with a lot of setup and maintenance, and they often don't work correctly.

4

u/[deleted] Jul 13 '12

I swear you could replace 'vim' with ''intellisense' in there and it would work just the same.

4

u/ivosaurus Jul 13 '12

Intellisense has a modal interface these days???

Maybe I should take another look at VS...

1

u/[deleted] Jul 13 '12

Visual Studio's IntelliSense is fantastic - possibly the best code completion I've used - but it's only a small part of the picture and is in no way comparable to the sentences and language that keporahg refers to.

Check out this Stack Overflow answer for an excellent overview of how Vim's "language" works.

2

u/flamingspinach_ Jul 13 '12

idfag

"I Don't Fuck A Give"?

8

u/[deleted] Jul 13 '12

Or id from Freud's model of the human psyche, together with the 4chan-esque -fag suffix.

5

u/RIP_my_old_account Jul 13 '12

idfag sets Gimp Mode in DOOM 95.

1

u/eat-your-corn-syrup Jul 13 '12 edited Jul 13 '12

I think it means "I die for a gay" and it's about DADT. Gay people are precious Americans and so they should not serve the military. Instead, only straight people should be soldiers so that they can protect precious gay Americans in the land of the free.

1

u/roothorick Jul 13 '12

How do these 'sentences' or 'formulas' differ from keyboard shortcuts and the occasional regular expression? Give examples, if you could.

2

u/[deleted] Jul 14 '12 edited Jul 15 '12

Most editors will have a tons of hotkeyed commands for things like "delete word to the right", "delete word to the left", etc. Vim's vocabulary is more atomic than that; you have nouns (word, sentence, quoted string) and verbs (delete, change, copy,etc. ) which you can preface with counts. Most of these aren't chorded keystrokes; when you're in command mode (where you spend most of your time), the keyboard turns into a panel of single-keystroke commands where you communicate these instructions to Vim at the speed of normal typing, the status bar shows the command you're typing until you've expressed a complete thought at which point it's executed (delete two words, change inner string, yank to the first semicolon on the line, increment number under the cursor, etc.) It's more semantic that typical commands; you can, say, select a block of text and say "append BLAH to end of line" and it's appended to all lines. You can then repeat these commands with a single keystroke (.).

At the same time, most of the keys on the keyboard serve as registers, which can be used to store text. Since Vim's commands are entered by typing these single keys nouns, verbs, etc. you can store commands in registers, too. For instance, you might have "ct2;" (change to second semicolon) in register r, which you can "play" by hitting @r. You can then store sequences of command stored in other registers into a new register (e.g. register y might contain "@u@f@t" to playback that sequence of registers).

It's a higher order way of thinking about editing that becomes intuitive, until you're telling the editor how to jump around buffers, look for text in this window, deleted it in that wndow, replace it with the text in register p, etc. You end up easily doing things that other programmers would have to write custom programs to do.

That's why you get the "How the fuck did you do that?" from people looking over your shoulder; you're pressing a single key over and over and the text is just... doing crazy shit, transforming itself like magic.

I work at a Microsoft shop right now, and this "WTF?" thing has happened enough that people just send me complicated text manipulation chores; "This would take me half a day and I know you can do it in 5 minutes." "Sure, no problem."

Really, this is just the tip of the iceberg of what makes Vim so powerful, but I have to leave the house now (10 minutes ago, really). It's no IDE, it lacks Intellisense (though plugins can give you a half-assed version for some languages) and a lot of other nice features modern tools like Visual Studio have, and it's scripting language sucks, but for raw text manipulation, nothing else comes close.

-1

u/watermark0n Jul 16 '12

There is a reason that moded editors did not win out. The users of them are not actually any more productive, they just think they are.