Emacs tips for Vim users
Introduction
As a fellow Vim user, I can safely say that Emacs is awesome. Org Mode was the main reason for me to switch and I don't regret it at all.
BUT if you do make the switch, only do so when you're able to set aside some time to learn. And keep Vim handy (after 6 months, I still frequently use Neovim in the command line). Any non-trivial configuration will require at least a rudimentary understanding of Elisp. I'm not saying you have to learn the language (even though, with time, of course you will), but you'll have at least to get used with some common patterns (like how a function look like), and living with a lot of parentheses overall.
In the configuration side, use-package and general.el are absolutely required in order to keep your sanity. Without those, things that take a single line in our .vimrc
can easily be a 5 lines affair. On the other hand, Emacs configurations feel a lot less hacky, since things are more local and explicit.
If you are like me and need to customize your environment a lot, than stay away from Doom or Spacemacs (but maybe try them for a few hours, just to get some ideas of what you can do and maybe copy some stuff to your own configuration). If you like things plug-n-play without making a lot of changes, then they are both great Evil focused options.
Recommended Modes
- NOTE:
modes
are the Emacs equivalent ofplugins
. They're sometimes calledpackages
too. I don't know the difference, so I'll just usemode
most of the time.
Configurations
- Use-package: sane package management. Use with MELPA.
- General.el: sane keybindings management focused on Evil (but not exclusively). Can create leader keys.
Ivy: completion mode that includes
Swiper
: powerful searchCounsel
: greatly enhances many built-in commands
NOTE: Ivy can be replaced with Helm, which is generally considered to have more features, but heavier for regular usage (not all Helm commands are heavier than Ivy counterparts, though). Unless you need some specific feature from any of those packages, this is mostly a personal choice.
Which-key: dynamically displays possible key combinations (useful when you're starting out).
Vim-Like Stuff
- Evil + Evil Collection: essential Vim-like functionalities
- Evil-Surround: vim-surround emulation
Evil Org: Vim-like keybindings for Org-Mode.
NOTE: Org Mode is now an Emacs built-in and doesn't need to be installed. You can install a newer version if you want, but I'm on Emacs 27 already, so I don't know to do that. It's usually unnecessary anyway.
Suggested Modes
Window Management
- Popwin: makes some windows (like help ones) “popup” by default, so the can be closed with
q
and don't upset your layout. - Shackle: rules for windows based on regex (Emacs window management can be very annoying without a mode like this).
- Eyebrowse: dynamic window management using workspaces.
- Ace-window: better window switching, with a lot of extra functions (great to use in a Hydra).
Miscellaneous
- Hydra: creates sequences of commands tied with a common prefix and
customizable visual mnemonics. Great way to organize the dozens of commands you're gonna use, reducing the cognitive load (it completely replaced
Which-key
for me). - Helpful: reformat contents of the help buffer to make it more readable, also providing more contextual information (you'll use help a lot).
- vimrc-mode: syntax for
.vim
files. - Avy + evil-easymotion: some vim-easymotion functionalities.
- Evil-magit: vi-keybindings for Magit (beloved Git mode).
Recommended Configurations
- My configuration: has configurations for all the packages I linked and many more.
- Sacha Chua's Emacs configuration: a famous and beloved configuration. The one thing I'd suggest you do differently from Sacha is using general.el, cause it will make your life a lot easier.
Usage Recommendations
Do not, I repeat, do not waste your time trying to get some “pure” Emacs experience. Richard Stallman is probably the only person using pure Emacs. Emacs keybindings are shit. Some people like them, but they are objectively inferior to Evil. Don't worry too much about it. BUT Evil-Collection doesn't work with every mode, so it's probably a good idea to have a passing familiarity with them, so keep the refcard handy for you to use until you memorize them or have time to manually configure these modes to something more Evil friendly.
If you don't know the key for somecommand
, just hit M-x somecommand
(this means Alt+x
in Emacsian) that Counsel
will tell you the associated key (and if it doesn't, describe-function
or helpful-command
will). With the helpful
package, the previous commands will show all keybindings for the command in every single mode! To do the opposite (find the command from the key), just run M-x describe-key
or M-x helpful-key
and hit the key combination you wanna check. I don't know many Emacs keybindings (cause I have my own. Also: it doesn't matter because Emacs is self-documenting), and I have been using it with Evil for the last six months. Emacs is a huge fucking beast, and no one knows it all. You just have to know enough. Good luck!