What specific productivity gains do Vim/Emacs prov

2019-01-20 21:36发布

This isn't meant as a troll or flamebait or anything like that. I've been using Vim as my console-editor of choice for a couple months now (for editing configuration files while in my terminal), but I don't think I could stand it for my normal, every day work of writing web applications, which I do with a GUI text editor (which one isn't important).

I feel like my GUI text editor can do everything I need for my work. It has a decent search/replace with auto-complete histories for both. It has syntax highlighting, line numbering, a tabbed interface, easy copying and pasting, etc. The only thing my current editor is missing is regular expression matching, but there are plenty of GUI text editors that will do regex search/replace.

Given what I just said, what productivity advantages does Vim (or even Emacs) have over a GUI text editor aside from that fact that it is installed on every computer. I'd like specific tasks that are better/faster on Vim/Emacs or that are just not possible with existing GUI text editors.

20条回答
Rolldiameter
2楼-- · 2019-01-20 21:47

In my experience, the main productivity gains which vim and emacs (I'm a vim person myself, but emacs is surely similiar) provide are:

  • You can have those features which modern IDEs provide (like one-keypress edit-build-run cycles and inline documentation and tab completion and whatnot) but you don't have to. The productivity gain? You see only as much as you want to see. In my experience, IDEs didn't make people more productive, also because they showed too much information (all kinds of browsers). This "extra bit of power, when you need it - but no sooner" is quite a productivity gain IMHO.

  • The editors are very popular among programmers, which means that there are huge repositories of scripts, books and usergroups available.

  • In my experience (I can only speak for vim here) the average vim user is a fairly good software engineer. I don't know why that is (or maybe I'm just lucky), but maybe people who took the barrier of getting accustomed to an 'old' tool like emacs or vim have the right dedication (and contact to other people like that). Maybe it's an indirect effect of these editors, but hanging out with other vim (or emacs) people on e.g. IRC turned out to be quite interesting, since the same people were also quite interested in all kinds of software engineering (or computer science) issues. These editors seem to attract a certain kind of personality. :-)

查看更多
祖国的老花朵
3楼-- · 2019-01-20 21:52

You know, for vi I think it comes down to having an insert and command mode. While it may seem a throwback to a time when you could not depend on cursor or special keys what it really means is that many powerful motion and text maniuplation commands are a minimal number of keystrokes. Productive coding is not about bulk text entry (the default in "modern" editors) but a burst of bulk text followed by considerable small tweaks and even larger periods of browsing.

This came to the fore for me personally using vi over a high latency campus network. You could easily get 10 or 15 characters ahead of the response. With vi I could comfortably predict where those commands would leave me and be able to work at near normal speeds. This twisted expertise is a continued benefit under normal conditions -- less visual brainpower dedicated to constant graphical feed back.

The commonplace * and # word search accelerators are great for flipping through code. And % for matching parenthesis is extremely useful. Sure, hardly seems like much compared to ctl-] but half the keystrokes adds up.

Personally, I use winvi which adds a couple big things that I'm sure vim has as well. A quick jump into hex mode cracks a lot of "what the hell is going on" text problems. And the completely flexible handling of line endings is a godsend that has become an expected feature for a text editor. Finally, it can open any file no matter what the contents. This amounts to an elite hacking skill of the first order.

Under Unix you can quickly capture program output or even filter sections of your file through external commands. An extremely powerful yet I think underutilized function.

查看更多
时光不老,我们不散
4楼-- · 2019-01-20 21:56

(vim's my poison; I'm sure emacs offers similar gains)

The biggest gain: not needing to touch the mouse.

For me, the handiest thing is to jump forward to (or just before) a specific letter or combination of letters, or jump back, with a couple of keystrokes. Jumping forward by the same condition twice, or ten times, is simply a matter of prefixing it with a number.

If you've to repeat an edit, you jump forward to that place (2-3 keystrokes), then hit "." to repeat the last edit. Jumping forward (or backward) is easier - one keystroke - if it's the same search condition.

Basically, with a small lead-time, you can learn ten or twenty keyboard shortcuts that mean you don't have to keep shifting your hand to grab the mouse. That gives you three or four times as many editing movements/commands as you'd do if you had to keep grabbing the mouse.

After a few days, you'll find yourself getting grumpy every time you have to reach for the mouse (or hit <Down> 15 times), when you're in a GUI editor.

查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-01-20 21:56

Remote Desktop shows quickly only native Windows application. We've tried to use Eclipse to develop under unix. And you know what? It wasn't even possible.

Second reason is that we could extend our Vims and Emacs to do all the project specific tasks from DB browsing in a special way to highlight and auto complete our owns meta language.

查看更多
贪生不怕死
6楼-- · 2019-01-20 21:57

For me the big productivity things are

  • I can do pretty much everything from the keyboard.
  • Powerful macros.
  • In my 20 year carreer using 9 OSes the basic keyboard bindings haven't changed. I can hop on pretty much any system and already know my way around the editor.
  • Pretty much any feature you might ever want in a text editor has already been added.
查看更多
forever°为你锁心
7楼-- · 2019-01-20 21:57

I use Vim quite often. It doesn't replace UltraEdit for me though. Since a lot of positives have been listed, I guess I'll go against the grain, and list some annoyances with Vim.

  • Weak FTP handling. I "sort" a lot of sites, and not being able to easily browse and edit files on a remote FTP server is a big deficiency for me. NWRead is not good enough.
  • Console weirdness inherited from the general terminal issues that seems to plague Linux. I usually use PuTTY to connect to my Linux box (running Ubuntu), and for some reason, the arrow-keys maps to A/B/C/D in insert mode (and the whole color support issues). In gVim, ctrl-tab can be mapped to "bn" easy, but not in console mode, such issues abound.
  • The search/replace options are very weak, interface wise. Having to type the whole thing into a single line, is just not good enough. I feel the much more elaborate dialogue in say UltraEdit gives me much more power in the end, even if the actual regular expression support may be much weaker.
  • Too strong a reliance on US keyboard layouts. A lot of keys that are used for primary functions, such as `, are non-printing on my Danish keyboard-layout (and located arkwardly, same with $, and many others). Makes it quite awkward to use some functions.
查看更多
登录 后发表回答