From e3fd207e72ba389be33b65e56e0e3a06162773dc Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 1 Dec 2020 21:41:19 +0000 Subject: deploy: 1b493919365ce70152643da3336c685b640105f2 --- tools/emacs.html | 209 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 176 insertions(+), 33 deletions(-) (limited to 'tools') diff --git a/tools/emacs.html b/tools/emacs.html index b8ad77e..9acc0ce 100644 --- a/tools/emacs.html +++ b/tools/emacs.html @@ -151,8 +151,10 @@

emacs(1)

help

  C-h ?         list available help modes
+  C-h e         show message output (`*Messages*` buffer)
   C-h f         describe function
   C-h v         describe variable
+  C-h w         describe which key invoke function (where-is)
   C-h c <KEY>   print command bound to <KEY>
   C-h k <KEY>   describe command bound to <KEY>
   C-h b         list buffer local key-bindings
@@ -160,57 +162,198 @@
                 eg C-x C-h -> list key-bindings beginning with C-x
 

package manager

-
  package-refresh-contents    refresh package list
-  package-list-packages       list available/installed packages
+
  key    fn                          description
+------------------------------------------------
+         package-refresh-contents    refresh package list
+         package-list-packages       list available/installed packages
+                                     `U x` to mark packages for Upgrade & eXecute
 

window

-
  C-x 0         kill focused window
-  C-x 1         kill all other windows
-  C-x 2         split horizontal
-  C-x 3         split vertical
+
  key      fn                      description
+----------------------------------------------
+  C-x 0    delete-window           kill focused window
+  C-x 1    delete-other-windows    kill all other windows
+  C-x 2    split-window-below      split horizontal
+  C-x 3    split-window-right      split vertical
+  C-x o    other-window            other window (cycle)
 
-

yank/paste

-
  C-<SPACE>  set start mark to select text
-  M-w        copy selected text
-  C-w        kill selected text
-  C-y        paste selected text
-  M-y        cycle through kill-ring
+

buffer

+
  key        fn                   description
+---------------------------------------------
+  C-x C-q    read-only-mode       toggle read-only mode for buffer
+  C-x k      kill-buffer          kill buffer
+  C-x s      save-some-buffers    save buffer
+  C-x w      write-file           write buffer (save as)
+  C-x b      switch-to-buffer     switch buffer
+  C-x C-b    list-buffers         buffer list
 
-

block/rect

-
  C-x <SPC>                     activate rectangle-mark-mode
-  M-x string-rectangle <RET>    insert text in marked rect
+

ibuffer

+

Builtin advanced buffer selection mode

+
  key        fn            description
+--------------------------------------
+             ibuffer       enter buffer selection
+
+  h                        ibuffer help
+
+  o                        open buffer in other window
+  C-o                      open buffer in other window keep focus in ibuffer
+
+  s a                      sort by buffer name
+  s f                      sort by file name
+  s v                      sort by last viewed
+  s v                      sort by major mode
+  ,                        cycle sorting mode
+
+  =                        compare buffer against file on disk (if file is dirty `*`)
+
+  /m                       filter by major mode
+  /n                       filter by buffer name
+  /f                       filter by file name
+  //                       remove all filter
+
+  /g                       create filter group
+  /\                       remove all filter groups
 
-

mass edit

-
  C-x h                                 mark whole buffer (mark-whole-buffer)
-  M-x delete-matching-line <RET>        delete lines matching regex
-  M-x %                                 search & replace region (query-replace)
-  C-M-x %                               search & replace regex (query-replace-regexp)
+

isearch

+
  key    fn                           description
+-------------------------------------------------
+  C-s    isearch-forward              search forward from current position (C-s to go to next match)
+  C-r    isearch-backward             search backwards from current position (C-r to go to next match)
+  C-w    isearch-yank-word-or-char    feed next word to current search (extend)
+  M-p    isearch-ring-advance         previous search input
+  M-n    isearch-ring-retreat         next search input
+
+

occur

+
  key      fn           description
+-----------------------------------
+  M-s o    occur        get matches for regexp in buffer
+                        use during `isearch` to use current search term
+
+  C-n                   goto next line
+  C-p                   goto previous line
+  o                     open match in other window
+  C-o                   open match in other window keep focus in ibuffer
+
+
  key      fn                                 description
+---------------------------------------------------------
+           multi-occur-in-matching-buffers    run occur in buffers matching regexp
 

grep

-
  M-x find-grep <RET>           run find-grep result in *grep* buffer
-  n/p                           navigate next/previous match in *grep* buffer
+
  key    fn           description
+-----------------------------------
+         rgrep        recursive grep
+         find-grep    run find-grep result in *grep* buffer
+
+  n/p                 navigate next/previous match in *grep* buffer
+  q                   quit *grep* buffer
+
+

yank/paste

+
  key         fn                  description
+---------------------------------------------
+  C-<SPACE>   set-mark-command    set start mark to select text
+  M-w         kill-ring-save      copy selected text
+  C-w         kill-region         kill selected text
+  C-y         yank                paste selected text
+  M-y         yank-pop            cycle through kill-ring (only after paste)
 
-

lisp mode

-
  M-x lisp-interaction-mode     activate lisp mode
-  C-M-x                         evaluate top expr under cursor
-  C-x C-e                       eval-last-sexp
-  C-u C-x C-e                   eval-last-sexp and prints result in current buffer
+

register

+
  key             fn                 description
+------------------------------------------------
+  C-x r s <reg>   copy-to-register   save region in register <reg>
+  C-x r i <reg>   insert-register    insert content of register <reg>
+
+

block/rect

+
  key          fn                    description
+------------------------------------------------
+  C-x <SPC>    rectangle-mark-mode   activate rectangle-mark-mode
+               string-rectangle      insert text in marked rect
+
+

mass edit

+
  key       fn                       description
+------------------------------------------------
+  C-x h     mark-whole-buffer        mark whole buffer
+            delete-matching-line     delete lines matching regex
+  M-%       query-replace            search & replace
+  C-M-%     query-replace-regexp     search & replace regex
 

narrow

-
  C-x n n               show only focused region (narrow)
-  C-x n w               show whole buffer (wide)
+
  key       fn                    description
+---------------------------------------------
+  C-x n n   narrow-to-region      show only focused region (narrow)
+  C-x n w   widen                 show whole buffer (wide)
 

org

-
  M-up/M-down           re-arrange items in same hierarchy
+
  key              fn   description
+------------------------------------
+  M-up/M-down           re-arrange items in same hierarchy
   M-left/M-right        change item hierarchy
   C-RET                 create new item below current
   C-S-RET               create new TODO item below current
   S-left/S-right        cycle TODO states
 

org source

-
  <s TAB                generate a source block
-  C-c '                 edit source block (in lang specific buffer)
-  C-c C-c               eval source block
+
  key       fn     description
+------------------------------
+  <s TAB           generate a source block
+  C-c '            edit source block (in lang specific buffer)
+  C-c C-c          eval source block
+
+

comapny

+
  key         fn   description
+-------------------------------
+  C-s              search through completion candidates
+  C-o              filter completion candidates based on search term
+  <f1>             get doc for completion condidate
+  M-<digit>        select completion candidate
+
+

tags

+

To generate etags using ctags

+
  ctags -R -e .         generate emacs tag file (important `-e`)
+
+

Navigate using tags

+
  key      fn                       description
+-----------------------------------------------
+           xref-find-definitions    find definition of tag
+           xref-find-apropos        find symbols matching regexp
+           xref-find-references     find references of tag
+
+

lisp

+
  key   fn        description
+------------------------------
+        ielm      open interactive elips shell
+
+

In lisp-interaction-mode (*scratch* buffer by defult)

+
  key              fn                        description
+--------------------------------------------------------
+  C-j              eval-print-last-sexp      evaluate & print preceeding lisp expr
+
+  C-x C-e          eval-last-sexp            evaluate lisp expr
+  C-u C-x C-e      eval-last-sexp            evaluate & print
+
+

ido

+

Builtin fuzzy completion mode (eg buffer select, dired, ...).

+
  key              fn          description
+------------------------------------------
+                  ido-mode     toggle ido mode
+  <Left>/<Right>               cycle through available competions
+  <RET>                        select completion
+
+

evil

+
  key    fn    description
+--------------------------
+  C-z          toggle emacs/evil mode
+  C-^          toggle between previous and current buffer
+  C-p          after paste cycle kill-ring back
+  C-n          after paste cycle kill-ring forward
+
+

dired

+
  key    fn    description
+--------------------------
+  i            open sub-dir in same buffer
+  +            create new directory
+  C            copy file/dir
+
+  q            quit
 
-- cgit v1.2.3