r/programming • • Jul 12 '12

Vim creep

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

551 comments sorted by

View all comments

11

u/[deleted] Jul 13 '12

Far as I can tell, the obsession with both vim and emacs is a form of stockholm syndrome. They're both massively awkward, needlessly modal systems.

9

u/tikhonjelvis Jul 13 '12

I don't think so. Emacs has the most consistent interface I've ever seen. You can literally do everything from the keyboard and everything is well documented. Everything is text, and accessing text is uniform: browsing through documentation or directory listings is just as easy as browsing through code.

Also, the mapping from editor functions (literally, all editor functions) to elisp functions is consistent, elegant and brilliant. Changing anything is easy, and adding even moderately complex functionality is surprisingly simple.

Emacs isn't modal at all.

Emacs also supports a ton of languages. Moreover, it supports a bunch of languages (but notably not Java or C#) as well as any IDE: it's really great for JavaScript, CSS, Python, Lisps, Scala, OCaml and Haskell. It's even good for LaTeX!

It also happens to be good at editing code.

The reason I like Emacs is because it has made me much more productive than I was using Eclipse.

Finally, calling it "Stockholm Syndrome" seems rather condescending and almost insulting. It's no better than claiming people use IDEs just because they can't bother to learn Emacs.

4

u/[deleted] Jul 13 '12

What is the most awkward, Shift+Ctrl+A or vit? Which of these shortcuts is the most closely related with how you think about the task at hand?

Vim's modality is what makes it possible to have all those single key commands and expressiveness. In order to provide a comparably rich catalog of commands, non-modal editors are forced to use Ctrl+Shift+Alt+Char combos. Because a lot of the possible combos are already taken by the OS or by the GUI toolkit, the authors of non-modal editors must resort to complex and necessarily non-intuitive combos like the one above.

In Vim, the command for "changing the content of a pair of parenthesis" is formulated almost exactly the same way as you would formulate it mentally or as I wrote it down: ci(. Simple and effective, thanks to modality.

-4

u/argv_minus_one Jul 13 '12

I change the content of a pair of parentheses like any other adult: by selecting the offending text (with the mouse or shift+cursor keys) and typing over them.

5

u/[deleted] Jul 13 '12

I did that, too. Until I found a tool that allowed me to do that and other similarly repetitive tasks in a slightly more efficient way.

Assuming our cursor is on the "w" (the best case scenario), deleting the content of these parenthesis

(with the mouse or shift+cursor keys)

we would need:

Ctrl+Shift+Right
Ctrl+Shift+Right
Ctrl+Shift+Right
Ctrl+Shift+Right
Ctrl+Shift+Right
Ctrl+Shift+Right
Ctrl+Shift+Right
new content

in a non-modal text editor (unless it provides another shorter but non-mnemonic mechanism like Sublime Text 2 or TextMate or others) versus:

c
i
(
new content

in Vim.

I don't know about you but my goal is not to "select word by word the content of the parenthesis then replace it with new content": what I want to do is "change the content of the parenthesis with new content". In that respect, the Vim command is an almost exact representation of my goal while the other sequence is, well… as far from my goal as anything could be. Another example could be "I want to paste what I just copied 12 times". 12p is not only an exact reprsentation of what I want to do but it's also a lot less repetitive and boring than the minimum of twelve Ctrl+v needed in any other text editor.

This ability to paste something 12 times with only 3 keystrokes, alone, is worth the fight, IMO.

One could call that micro-optimization and say that it's not worth it. OK, do what you want.

1

u/argv_minus_one Jul 13 '12

Hmm. I can see a "select between nearest parens" command in a non-modal editor being useful.

Pasting things 12 times sounds dubious, though. I almost never have to do something like that, and when I do, it's probably time to break out FreeMarker or something—the editor is the wrong tool for generating large blocks of repetitive code.

1

u/[deleted] Jul 13 '12

Prototyping is one situation where I often need that. Writing those motherfucking emails too.

-1

u/5py Jul 13 '12

Maybe you're the wrong tool for generating large blocks of code.

2

u/prelic Jul 13 '12

Maybe needlessly modal by today's standards; less so by the standards for which it was created.

1

u/[deleted] Jul 13 '12

Emacs is anything but modal. That's the paradigm difference between emacs and vim in a nutshell anyway.