Why emacs?
Previously I was developing with dynamic language, like js, ruby, python, via using vim. Vim is a great editing tools with different internal mode(command/visial/insert mode). But the original reason why I intended to migrate from vim to emacs is the powerful REPL
environment as well as other embedded function.
Trouble from vim to emacs
I was starting to read the documentation of emacs, and acquainted with new key-binding. Then I realized editing in emacs is less effective than in vim. Thus I came up to evil
, an extensible vi layer for Emacs. Combing emacs with evil will maximize the productivies, therefore it is not necessary for you to remember all the key-binding under emacs environment.
How to install on OS X?
Download and install emacs, no args will not install gui enviornment.
|
|
Keyboard setting on OS X
- open the terminal perference, and then set option as a meta key.
- recommend you to swap capslock with ctrl
Basic command you should remember
Emacs self key-binding
M-x help-with-tutorial
open emacs tutorialC-x C-c
quitC-x C-f
open fileC-x C-s
save fileC-g
quit a partially entered commandC-h m
list active modeC-x left-arrow
previous bufferC-x C-b
list buffersM-x desktop-clear
C-x 0
close current windowC-x 1
close other window except currentC-x 2
split window verticallyC-x 3
split window horizontallyC-x 4 C-f
open new window and move the cursor to itC-v
scroll down the windowM-v
scroll up the windowC-M-v
scroll the botton window without focusing the cursorM-;
comment on current line
Plugin default setting key-binding
tab
autocomplete in evil-insert modegv
reselect evil visual mode":%s/foo/bar/g
replace all matched words in evil-normal mode1g
orng
jump to the specific lineC-c b
send buffer to REPLC-c r
send region to REPLC-c f
format js/html/css by web-beautify
Emacs package system
There are four package servers, including GUN, ELPA, Marmalade, MELPA. Currently I choosed MELPA as a default package system, becasue I forked config from Steve Purcell emacs.d repository.
There are several starter kits you can begin with:
- emacs24-starter-kit is highly recommended if you want a clean environment and build it from scratch.
- emacs prelude is not recommended by novice.
- Steve Purcell's emacs.d.
- oh-my-emacs adapted el-get instead of the builtin package.el.
- redguardtoo's emacs is forked from Purcell's emacs.d, and make it localize if you have no access to network. In addition, it enhances some features on the top of Purcell's config.
Steve Purcell emacs config is really impressive and the structure is clean and tidy. So I highly recommmend you to fork his repos and localize your configure file into your home directory.
Note that if you encounter any difficulties, please run command emacs --debug-init
to check any error.
Increamtal plugin list besides purcell config
- evil is an extensible vi layer for Emacs.
- helm is Emacs incremental and narrowing framework.
- ac-helm integrates AC in helm mode.
- yasnippet is a template system for Emacs. The snippet syntax is inspired from TextMate's syntax.
- ace-jump-mode is A quick cursor location minor mode for emacs, like easymotion under vim.
- web-beautify is used to format HTML, CSS and JavaScript/JSON by js-beautify
Other notes
- Please
brew install ispell
before enabling flyspell - Using
node --interactive
as inferior-js-program-command in js-comint mode. - Please
(setq auto-save-default nil)
in order to disable auto-save-mode. - If you cannot download plugins, please
M-x package-list-packages
to refresh your package listReference
- http://ergoemacs.org/misc/list_of_emacs_starter_kits.html
- http://ergoemacs.org/emacs/emacs_package_system.html
- http://batsov.com/articles/2012/02/19/package-management-in-emacs-the-good-the-bad-and-the-ugly/
- http://toumorokoshi.github.io/emacs-from-scratch-part-1-extending-emacs-basics.html
- http://blog.csdn.net/redguardtoo/article/details/7222501