readme.md 3.23 KB
Newer Older
Mohcine Chraibi's avatar
Mohcine Chraibi committed
1 2
[![pipeline status](https://gitlab.version.fz-juelich.de/chraibi1/san_emacs/badges/master/pipeline.svg)](https://gitlab.version.fz-juelich.de/chraibi1/san_emacs/commits/master)

Mohcine Chraibi's avatar
Mohcine Chraibi committed
3 4 5 6 7 8
# Install 

```bash
sh -c "$(wget https://gitlab.version.fz-juelich.de/chraibi1/san_emacs/raw/master/init.sh -O -)"
```

Mohcine Chraibi's avatar
Mohcine Chraibi committed
9 10 11
# Notation
- C: Ctrl
- M: Alt
12 13 14 15 16 17 18 19 20 21
- C-x means: Hold Ctrl and x at the same time
- C-M-x means: Hold Ctrl, Alt and x at the same time

---

_Important:_

Always use `C-g` when you mess up
(quite commands)

Mohcine Chraibi's avatar
Mohcine Chraibi committed
22
![How to Learn Emacs: A Hand-drawn One-pager for Beginners / A visual tutorial](http://sachachua.com/blog/wp-content/uploads/2013/05/How-to-Learn-Emacs-v2-Large.png)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
23
# Window management
24 25 26 27 28 29 30 31
  - `C-x 0` close _this_ window
  - `C-x 1` close _other_ windows
  - `C-x 2` split window horizontally
  - `C-x 3` split window vertically
  - `C-x o`: move around windows
  - `C-x arrow`: move around windows
  - `C-c left or right` "undo" (and "redo") changes in the window configuration
  - `C-c b` list buffers
Mohcine Chraibi's avatar
Mohcine Chraibi committed
32
  - [demo](https://youtu.be/lPKmYZXPJDg)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

# Files
  - `C-xf` open file or directory
  - `C-xs` save file
  - `C-xw` save as
  - `C-xj` jump to files in this current directory

# Edit
  - First select with `C-space + arrows`, then:
    - `C-w` cut (kill)
    - `C-y` paste (yank)
    - `M-w` copy
  - `C-k` kill line
  - `C-_` undo
  - `M-_` redo
santu pham's avatar
santu pham committed
48
  - `C-x u` undo-tree then `q` to choose
49 50 51 52
  - `C-x space` column select
  - `C-c ;` comment/uncomment
  - `C-s` search forwards
  - `C-r` search backwards
Mohcine Chraibi's avatar
Mohcine Chraibi committed
53
  - `M-d` delete next word
54 55 56 57 58

# Navigation 
- `C-a` Go to the beginning of line
- `C-e` Go to the end of line
- `C-c g num` goto line <num>
Mohcine Chraibi's avatar
Mohcine Chraibi committed
59
- `C-x p` jump to last position of cursor
Mohcine Chraibi's avatar
Mohcine Chraibi committed
60 61

# General
62 63 64 65

- `C-xc` exit editor
- `f4` nav-tab
- `C-c n` search for pattern in a project (directory) 
santu pham's avatar
santu pham committed
66 67 68
- `C-xb` open list of buffers, then `x` to kill
- 'C-x b' swith buffers

Mohcine Chraibi's avatar
Mohcine Chraibi committed
69 70

# Spelling
71 72
  - `f6` change dictionary
  - `f8` correct word
Mohcine Chraibi's avatar
Mohcine Chraibi committed
73
  - `M-x flyspell-mode` activate flyspell
Mohcine Chraibi's avatar
Mohcine Chraibi committed
74
# Multiple-cursors
75 76 77
  - `C-c z` multiple cursors
  - `C-c i` insert numbers
  - `C-x k` kill buffer
Mohcine Chraibi's avatar
Mohcine Chraibi committed
78
  - [demo](https://www.youtube.com/watch?v=MZjDi3iI0eA)
79 80
  - [mind blowing demo](https://youtu.be/jNa3axo40qM)
  
Mohcine Chraibi's avatar
Mohcine Chraibi committed
81
# LaTeX
Mohcine Chraibi's avatar
Mohcine Chraibi committed
82
  - `C-c p` preview mode (GUI-mode only)
83 84 85
  - `C-cc` compile and view
  - `C-cl` view log
  - `C-cv` view pdf in evince (not needed in preview mode)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
86
  - `C-c=` invoke table of contents
87 88
  - `C-ce` add environments 
  - `C-c Enter` create macro
Mohcine Chraibi's avatar
Mohcine Chraibi committed
89
  - [demo](https://youtu.be/O6OL8LtnBM8)
90

Mohcine Chraibi's avatar
Mohcine Chraibi committed
91
# org-mode
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
  - `C-c a a` calendar view
  - `C-c c` make journal, meeting notes, etc
  - `C-cc` finish
  - `C-cs` schedule
  - `C-cd` deadline
  - `C-ce` export
  - `C-ct` make todos
  - `C-cxi` clock IN
  - `C-cxo` clock OUT
  - `C-cxd` Time spent on task
  - `C-M-Arrow`: move section up or down
  - `Tab` show/hide headers
  - `C-co`  open link it in browser
  - `C-c l` org-store-link
  - `C-cl` org-insert-link
Mohcine Chraibi's avatar
Mohcine Chraibi committed
107
 
Mohcine Chraibi's avatar
Mohcine Chraibi committed
108
# Git (Magit!)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
109
  - `C-c m`: Enter Magit-mode. Equialent to `git status` [crazy demo](https://www.youtube.com/watch?v=rzQEIRRJ2T0)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
110
    - `s` stage
Mohcine Chraibi's avatar
Mohcine Chraibi committed
111
    - `c` commit, finish with `C-cc`
Mohcine Chraibi's avatar
Mohcine Chraibi committed
112
    - `P P` push
Mohcine Chraibi's avatar
Mohcine Chraibi committed
113
    - `Tab` on files to see diffs
Mohcine Chraibi's avatar
Mohcine Chraibi committed
114 115
    - `l` log
    - `i` gitignore
Mohcine Chraibi's avatar
Mohcine Chraibi committed
116 117
    - `z` stashing
    - `b` branching
Mohcine Chraibi's avatar
Mohcine Chraibi committed
118

119 120 121
# Advanced
  - `C-M-n` Jump forward to matching paren.
  - `F3` Record your keyboard input to play it back later.