[Update] This post was originally wrote two years ago. Since then, I have gradually moved most of my personal developing environment from Vim to Emacs. It is the time to rewrite part of it and add the updates.
I was hoping to find something like Python Progression Path or sort of “best practice” for Emacs, because the difference between Vim and Emacs was much larger than I thought. But what I found were either teaching about basic operations such as saving and quiting the editor for people who had access to comupter for the 1st time, or talking about tricks of using Emacs Lisp for the high-end hard-core players… It seemed like I was stuck in the middle, and would stay there for a very long time…
I will sort the contents here as incremental records simulating my Emacs learning process, as well as keeping track of nontrivial materials and thoughts.
Mindset and Starting Point
- Don’t panic – The Hitchhiker’s Guide to the Galaxy – “it looked insanely complicated , and this was one of the reasons… the other reason was that this device was in fact that most remarkable of all…”
- To customized the emacs, the starting point is the file
- One basic cheat sheet comes in handy. Most of the common keybindings can be easily referred.
- It’s also much easier to start with a package containing all basic modules. There are several options, which are listed in the following section.
- To install new package, the easiest way is
M-x package-install, and the following operations are similar to surfing the website via
lynx. It is even easier to update all installed package:
U(Mark all package with a newer available version), and
x(Download and install all marked packages). More info refers to the Package Menu Buffer.
- Though I don’t agree with many opinions that Steve Yegge have said, but his claim about Emacs is somewhat correct – “Real engineers use Emacs. You have to be way smart to use it well, and it makes you incredibly powerful if you can master it” – the emacs is highly configurable and can be very powerful, but the user has to be smart simply because the system is so twisted…
- It’s helpful to know some LISP, for both using Emacs and becoming a better programmer.
- An off-topic thought. I also agree with Steve’s view about languages, especially – “C++ is dumb, and you can’t write smart systems in a dumb language. Languages shape the world. Dumb languages make for dumb worlds.” =P
- Prelude – very easy to setup, and add/disable modules and/or modes, which are defined at init.el and prelude-modules.el.
- Oh-my-emacs is an alternative, but I met quite a few incompatible issues for the OSX. Emacs24 Starter Kit is also well-known but not actively developed recently.
- Emacs is able to do spelling check natively, or with more advanced Fly Spell.
- Evil, the Vim mode. This makes my live much easier, maybe just because it provides a decent editor inside of the emacs OS =P. And, there is a trick to copy and paste large chunks of text in OSX.
- EWW: the web browser within emacs.
- Magit. “Magit is the most popular interface to git. If you are new to git and do not need support for other vcs this is likely the package you should try first” – quoted from EmacsWiki. The detail explanation can be found from Mastering Emacs.
- Auto-completion is
M-/, or Company for fancier scenarios.
- HighlightSymbol with self-explanatory name, but does not work well within Prelude.
- Haskell mode.
- Markdown mode.
- Geisier is able to integrate with Racket REPL, and use together with Quack.
- Alternatively, there is a Racket mode.
- These two great post are the starting point to enter the world of Emacs 1, 2.
- To switch between different modes, it might be helpful to open quite a few cheat sheets at the same time…
- GNU Emacs Manual and Emacs LISP Manual
- Guidelines for package management in Emacs.
- Emacs Wiki
- Mastering Emacs
- From Vim to Emacs+Evil chaotic migration guide
- Steve Yegge’s suggestion for improving productivity with Emacs
- My previous post to setup Emacs in Mac OS.
- How to turn Emacs to the ultimate Latex Editor
The difference between “killing” and “deleting” is that “killed” text can be reinserted (at any position), whereas “deleted” things cannot be reinserted in this way (you can, however, undo a deletion–see below). Reinsertion of killed text is called “yanking”. Generally, the commands that can remove a lot of text kill the text (they are set up so that you can yank the text), while the commands that remove just one character, or only remove blank lines and spaces, do deletion (so you cannot yank that text). <DEL> and C-d do deletion in the simplest case, with no argument. When given an argument, they kill instead. – This is valid for both vim and emacs.
- Multiple windows:
C-x 0delete this window
C-x 1delete all other windows
C-x 2vertically split window
C-x 3split window side by side
- Scoll down the page
C-v: page down
C-u 8 C-v: scoll down 8 lines
C-l: move the current line to the middle of the window
C-u 0 C-l: move the current line to the head of the window
- Getting help
C-h c \<Command sequence\>: a very brief description of the command.
C-h k \<Command sequence\>displays the documentation of the function, as well as its name
C-h tevoke the tutorial of Emacs within the editor.
C-h a topics RETsearches for commands whose names match the argument topics. The argument can be a keyword, a list of keywords, or a regular expression.
C-h i d m emacs RET i topic RETsearches for topic in the indices of the Emacs Info manual
C-h i d m emacs RET s topic RETsearches the text of the manual.
- Shell History (also Useful for Haskell REPL)
M-p (or) C-\<UP\>: Fetch the next earlier old shell command.
M-n (or) C-\<DOWN\>: Fetch the next later old shell command.
M-r: Begin an incremental regexp search of old shell commands.
C-c C-x: Fetch the next subsequent command from the history.
C-c .: Fetch one argument from an old shell command.
C-c C-l: Display the buffer’s history of shell commands in another window (comint-dynamic-list-input-ring).