A modern Emacs setup in OS X
About a year ago I switched from Vim to Emacs, and I couldn't be happier about the move. I spent some time getting a setup I was happy with, and thought I'd share it for those who are also looking to move to Emacs.
For more information, my entire .emacs.d
is available in my
dots repository on GitHub.
Prerequisites
Install Pallet, a wrapper for Cask used to manage your Emacs
packages (think apt-get
, yum
, etc.)
Copy my Cask file into your ~/.emacs.d/Cask
, and run cask
install
. This will pull down all the listed packages into the .cask
directory and let you immediately get started.
Customization
In terms of structuring and managing an ever-expanding set of customizations, I've found the following layout seems to work well.
For your ~/.emacs.d/init.el
, use the following:
This instructs Emacs to initialize packages with Cask/Pallet, and then
loads all the customizations in the order you specify in your
~/.emacs.d/customizations
.
Entries in the ~/.emacs.d/customizations
are of the form
02-global.el
. This guarantees initialization ordering (which
can be useful), and allows you to separate settings naturally (one
file for each language, etc.)
I'll quickly mention a few generic customizations I've added, but see the full .emacs.d for a more complete set of changes (including various customizations for Haskell, Go, Python, Julia, R, LaTeX, Scala, JS, etc).
Some Useful Shortcuts
This is just a laundry-list of shortcuts I've found useful at various times. They rely on various packages and custom functions - see the full repository for details.
Magit
This makes it cleaner to switch into Magit - simply pressing C-c C-g
puts Magit into fullscreen mode, where you can
cleanup/stage/commit/amend/push with only a few presses, and then
pressing q
takes you back to the window state you had before
entering Magit. It's really a pleasure to use.
GitHub Gist utilities
This makes it easy to take a buffer or region in Emacs and view it in various external services - currently mkdown.com for pretty Markdown viewing and iPython NBViewer for iPython notebooks. These are the kind of small, useful functions that can be easily written with elisp (as opposed to the pain of trying to use vimscript for anything non-trivial).
Sources of Inspiration
A few resources I used over the past year:
- Yegge's Effective Emacs is an excellent resource.
- Phil Hagelberg's
better-defaults
is great (and in the - aforementioned Cask file).
- what the emacs.d? has some excellent snippets you can use.