29 ms·
I'd advise you to learn vim, for a couple of reasons. The main one is the concept of composability [0] - in vim, you're speaking a mini-language. You have comm
by frederikvs 10y ago
I'd advise you to learn vim, for a couple of reasons.
The main one is the concept of composability [0] - in vim, you're speaking a mini-language. You have commands (delete, copy, make uppercase,...), and a number of movements (right, down, to the next occurrence of a word, to line 27,...) or objects (word, line, paragraph, html tag, text within quotes, ...) to work on. These can be combined in any way you like, any command can be applied to any movement or object. So if you have a plugin like vim-angry that adds a "C-style function parameter" text object, all the commands you know can be applied to that. In contrast, in emacs, you have a number of commands (kill-line, kill-word, ...), and that's it. You have to get by with those. If they didn't implement the command you'd like to use, tough luck.
A second (minor) reason for me is that I work in the embedded software world, and usually on an embedded linux, there's at least some variant of vim or vi available, while emacs is very rare.
Take my advice with a grain of salt : I've never really used emacs, so I can't compare from first hand. From what I've heard, emacs is also a very good editor. To me, the question "should I use vim or emacs" is more or less the same as "should I use firefox or chrome" - I'm a chrome guy myself, but I don't consider firefox to be crap, nor its users to be idiots. Internet explorer on the other hand,...
So my advice : learn vim. And if you don't, learn emacs. Just learn to use either one properly, and you'll be way faster at editing than people who don't use those.
[0] a.o. https://medium.com/@mkozlows/why-atom-cant-replace-vim-433852f4b4d1#.ot06wyos5 https://medium.com/@mkozlows/why-atom-cant-replace-vim-43385...
- omaranto 10y agoI'm not sure I'm convinced by the composability argument. Isn't composable the default for text editors? Emacs (and most text editors) let you select a portion of text (Emacs calls this marking a region) and then decide what to do with it: delete it, cut it (Emacs calls this killing), convert to upper case, etc. Vim mostly uses the other order: Commands first, motion or text object later (except in visual mode where it's like other editors: Select something first, command later). So you just need to implement a bunch of selection commands to get Vim-style composability. I think lots of these modern text editors like sublime or atom come with select word, select parenthesized expression, select paragraph, etc. If the editor is extensible you can define new selection commands and compose them with the existing commands that operate on a region, just like Vim. Emacs certainly has a bunch of marking commands. The extra commands you mentioned in Emacs (kill-word, kill-line, etc.) are just for convenience: Shortcuts for common cases. In Vim you can delete to the end of the word with dw. In Emacs you could also do a 2 keystroke solution: do mark-word, delete-region (you could use backspace, Control D or delete for that second second thing since they "operate on the region of the selection is active", so C-@ <backspace> would do it). Unlike Vim you also have the option of a single chord with the convenience command kill-word.
- alwillis 10y agoThis is the best article I've seen that describes the huge advantage of composability: Why Atom can't replace Vim: https://medium.com/@mkozlows/why-atom-cant-replace-vim-433852f4b4d1#.myhl1trb0 https://medium.com/@mkozlows/why-atom-cant-replace-vim-43385...
- omaranto 10y agoI think I understand the advantage of composability. What I was saying is that it is not unique to Vim. Vim uses "command; motion-or-textobject" in normal mode where most editors use "select-what-you-want; command" (which is what Vim does in visual mode). If your editor has a good stock of selection commands (some have select word, line, paragraph, parenthesized expression, etc. -- I don't use atom but Emacs and Textadept have all those and more, like select LaTeX environment) and a good stock of commands that operate on the selection (like delete, cut, wrap in parenthesis, uppercase, etc.), I'd say you have composable editing. I don't think the link you have addresses my point at all.
- alwillis 10y agoIt seems pretty clear to me that it does indeed address your point. That you can build up sophisticated actions just by knowing the primitives and text objects is the point, right? And not having to memorize different commands and different selections. From the article: But now let’s look at delete commands. Let’s say you want to delete a word, delete to the end of the line, delete to the end of the file, or delete to the end of a paragraph. Emacs only has two of these functions: kill-word and kill-line. Atom has the same two, more or less: deleteToEndOfWord() and deleteLine(). Vim, though, is different. Vim only has one command: d, which is “delete.” What does it delete? You name it, literally. The d command gets combined together with those commands for movement: dw deletes to the next word, d$ to the end of the line, dG to the end of the file, and d} to the end of the paragraph. This is where Vim’s composability leads to its power. Emacs and Atom don’t have commands for deleting to the end of a file or a paragraph — even when they have commands to move to those places. But in Vim, if you can move to a location, you can delete to that location. And composability is about more than just power, it’s also about learnability and consistency. The command for copying text in Vim is y. Do you know how to copy to the end of the line/file/paragraph? Of course you do: It’s y$, yG, and y} respectively. The command for increasing the indent is >, so you instantly know >$, >G, and >}. Convert to lowercase is gu, so… sure enough: gu$, guG, gu}.