Sunday, December 16, 2012

Emacs cheatsheet



emacs customization files
--------------------------------------

.emacs.d  (customizations)
init.el      (loaded everytime)

Starter Kit
----------------
emacs-starter-kit (github)

Frames
-----------
M-x make-frame
M-x make-frame-on-display

Misc
--------
M-x man
C-x h (select all text of current buffer)
M-x untabify (to replace tabs with spaces)

Region
----------
Mark region then
C-x C-i (to indent the region)

Open Lines Like vi
The ‘o’ and ‘O’ commands of vi are closely equivalent to ‘C-a C-M-o’ and ‘C-e C-j’ 

Switching between buffers
---------------------------------------
C-x b    <----> C-x b  (switch buffers)
C-x C-b    D - Delete , U - undo , X - when done.

Help
------
C-h k  key
C-h i   (info page)
C-h f   (describe function)
C-h a (apropos)
C-h t  (tutorial)

CUA MODE
----------------
M-x cua-mode

C-space (mark) then C-ENTER then move cursor to select region
press C-enter again.
Now start editing anywhere in the block. The effect will be that
the text will appear on all lines of the region.
M-n (to start line numbering within the region)

Commenting
------------------
M-;  (acts on a region or when no region then single line)

Completion
----------------
M-/

?  send buffer to end of  list.

TAGS
--------
ctags -a -e -f TAGS *
find ... | xargs ctags -a -e -f TAGS
M-.  (find the tag for the text at cursor)
M-x visit-tags-table

Modes
----------
M-x whitespace-mode ( colors - yellow - mixed
                                                      black  - too long
                                                      red - trailing white spaces)
M-x follow-mode

M-x whitespace-report
C-h a whitespace

M-x fly-spell-mode (spell checking)
   - to see the suggestions for spelling fix , middle mouse click on word
     or Esc-\t  in text mode

M-x flymake-mode (to check syntax for the lang as u type)

Hooks?

M-x eval-buffer ?

Version Control
-----------------------
M-x vc-mode
C-x v (diff against HEAD)
C-x vn  revision ??
C-x vl   (view commit log)
C-x vi  (add file)

magit -- git extension for emacs

SHELL
---------
M-x shell
M-x shell-command
M-x shell-command-on-region

M-x eshell

$ ls > # (creates a buffer with the command output)


ELPA (Emacs Lisp Package Archive)
--------
M-x package-list-packages
i (mark package)
x (install marked packages)


download to .emacs.d
color-theme.el
yasnippet.el (textmate)


M-x irc
M-x tetris


Good Websites for Emacs

www.emacswiki.com
planet.emacsen.org



No comments:

Post a Comment

Followers

About Me

Torrance, CA, United States