by Raphmedia · 9y ago · 0 comments
I really want to learn either Vim or Emacs but I've never been able to decide which one to learn. Every time I've tried to search about this topic I end up in petty wars. Help?
(Disclaimer: I am a happy Spacemacs user, and it would take a lot to pry it away from me.)
I'd recommend learning vi, so you can learn how awesome modal editing is. Then, learn Emacs' basic commands for line editing (so as to make readline apps easier to work with). Once you've done that, evaluate whether a (Neo)vim with plugins or Spacemacs setup is better for you, then choose one of those.
- *-mode (specific syntax highlighting, commands, etc. based on project or task)
- edit/save remote files via built-in TRAMP [0]
- built-in plugin manager (interactive, or via emacs init config)
- MELPA [1]
- Non-blocking (e.g., run tests in one buffer while editing source in another)
- client-server approach (neovim adopted this, but emacs has had far more time to work out the kinks)
The main reasons I stay with vim are:
- already committed to vi-like muscle memory (and evil-mode, while admirable, doesn't cut it)
- no translation of VimL configs and plugins to Emacs Lisp
- many plugins for languages, frameworks, etc. which I use daily are severely out of date in emacs (and I'm too lazy to maintain them myself)
[0]: http://askubuntu.com/questions/79100/how-to-open-a-remote-fi...
[1]: http://melpa.org/
Do you use neovim?
Use vim, learn vim all the way. If/when you're working on an "old" vi (e.g. the one in busybox, for embedded developers), you'll need to drop some of the more advanced stuff, but you'll still be able to do what you want, edit some config file or such, though it may feel a bit awkward at times. But when you're doing the heavy editing, you really want to use all of vim.
Your advice is very misleading in 2016.
I don't think there is an active vi codebase, vi is actually vim in compatibility mode in most operating systems.
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-43385...
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.
But the "select text and then apply command", as I understand it, still has a major drawback compared to vim's way of working : the dot-command. In vim, you go "daa" (delete an argument - i.e. delete the argument, including the comma which separates it, if you have the vim-angry plugin). Then you move to another argument, you just press dot, and the same thing happens.
Also, does the selection thing accept counts?
1. Yes, the ability to repeat with dot is advantage of the Vim model. Emacs just repeats the command part not the marking part too, not as useful as dot in Vim!
2. In Emacs every command accepts counts, just like Vim. Textadept doesn't offer counts, I believe. I think counts are probably an advantage of Vim and Emacs over most(?) other editors.
3. About Vim having more motions & text objects: Probably, but Emacs is close. Without extra packages you have: words, symbols and S-expressions (the names come from Lisp but these do something sensible in most languages: Symbol is usually identifier and S-expression is something like delimited expression: A string, a parenthesized expression, a block in curly braces or brackets, etc.), lines, sentences, and paragraphs. Texts packages add other targets like LaTeX environment. One thing definitely lacking in Emacs is that Vim usually offers two variants that differ slightly at the ends (like w vs e, or i( vs a(), those minor variations are pretty useful.
My point is just the saying other editors don't have the ability to combine commands with different things to operate on is obviously false, and claiming is unlikely to convert anytime to Vim. Instead Vim bloggers should focus on how Vim makes the basic composability idea even better with things like counts, repeatability of composed commands, and richer set of selection commands.
Why Atom can't replace Vim: https://medium.com/@mkozlows/why-atom-cant-replace-vim-43385...
I don't think the link you have addresses my point at all.
I then discovered kakoune[1] and liked its design. I started getting familiar with it and using it more and more, and I think its core is much more solid than vim/emacs. It definitely doesn't have the same community support and plugins but it's already quite feature rich.
Then, if your friends use emacs, use evil-mode because vim is the best.