6/15/2016

EMACS frequently commonly used commands

ctrl-g quit the current operation
ctrl-x ctrl-s: save
ctrl-x ctrl-w: save as
ctrl-x ctrl-c: exit
ctrl-x b: change buffer or type in a name to new a buffer
ctrl-x k: kill buffer
alt-x revert-buffer: reload buffer from file
alt-x goto-line: go to line
ctrl space: copy mode
ctrl-w: cut
alt-w: copy
ctrl-y: paste
ctrl-x u: undo
ctrl-x 3: split window
ctrl-x f: open file
ctrl-s: search

alt-e: to edit the search string
alt-% (alt-shift-3): find/replace
ctrl-v: scroll down
alt-v: scroll up
alt-x customize-face: change the color of the syntax coloring of the current cursor word
alt-x list-faces-display: to change different colors
alt-x linum-mode: show line number
ctrl-c ctrl-c: to comment a block
alt-;: to uncomment a block
ctrl space to select region, then ctrl-x tab: to indent a block. ctrl-x tab again to indent again
ctrl space to select region, then ctrl-u -2 then ctrl-x tab: to unindent a block
alt-x python-mode: to turn on python, text-mode or c++-mode etc
ctrl-u: repeat the following commands 4 times
ctrl-u 2: repeat the following commands 2 times
To give a command a numeric argument of, say, 12, type C-u 12 before typing the command. If you type slowly, you'll see: C-u 1 2-
# Comment a block
alt-x python-mode, select region, then alt-x comment-region
ctrl-j: new line and auto indent
alt-/: auto complete words

alt-d: delete a word forward
alt-delete: delete a word backward
ctrl-k: delete a line
ctrl-shift-backspace: delete the current whole line
alt-f: move a word forward
alt-b: move a word backward
alt-x toggle-truncate-lines: wrap text off
ctrl-x ctrl-+: increase font size
ctrl-x ctrl--: decrease font size
whitespace-mode: toggle whitespace mode
alt-x ediff: diff two files
ctrl-x z: continue once the previous command
alt-x zap-to-char: delete everything up to a specific character
vc-annotate: display the git blame information

# Change split windows size:
C-x } (enlarge-window-horizontally) does likewise, horizontally.
C-x { (shrink-window-horizontally) is also bound by default

Following one of these commands with repeat (C-x z to initiate, and just z for continued repetition).


Navigating Parentheses:
  ctrl-alt-n     forward-list  Move forward over a parenthetical group 
  ctrl-alt-p     backward-list  Move backward over a parenthetical group 
  ctrl-alt-f     forward-sexp Move forward over a balanced expression
  ctrl-alt-b     backward-sexp  Move backward over a balanced expression
  ctrl-alt-k     kill-sexp  Kill balanced expression forward
  ctrl-alt-SPC   mark-sexp  Put the mark at the end of the sexp.

Set comment region charactert:
Alt-: (setq comment-start "#~")

In the directory view mode: (dired)
C: copy file
D: delete file or folder
R: rename file or folder
+: create a folder
q: quit the dir mode
m: mark file
u: unmark file
U: unmark all files
%m: regexp mark files
^: go to parent dir
>: move to the next subdir
<: font="" move="" prev="" subdir="" the="" to="">

No comments: