OSDN Git Service

Regular updates
[twpd/master.git] / spacemacs.md
1 ---
2 title: Spacemacs
3 layout: 2017/sheet
4 category: Apps
5 updated: 2020-05-22
6 tags: [WIP]
7 intro: |
8   [Spacemacs](http://spacemacs.org) is a distribution for Emacs.
9 ---
10
11 Shortcuts
12 ---------
13 {: .-three-column}
14
15 ### Layers
16
17 | Shortcut  | Description       |
18 | ---       | ---               |
19 | `SPC` `f` | File              |
20 | `SPC` `p` | Project           |
21 | `SPC` `t` | Toggle            |
22 | `SPC` `b` | Buffer            |
23 | ---       | ---               |
24 | `SPC` `m` | Major mode        |
25 | `,`       | Same as `SPC` `m` |
26 | ---       | ---               |
27 | `SPC` `g` | Git               |
28 | `SPC` `l` | Layout            |
29 | `SPC` `a` | Apps              |
30 | `SPC` `h` | Help              |
31 {: .-shortcuts.-prime}
32
33 ### More
34
35 | Description | Shortcut    |
36 | ---         | ---         |
37 | **M-x**     | `SPC` `SPC` |
38 | Terminal    | `SPC` `'`   |
39 | Search      | `SPC` `/`   |
40 {: .-shortcuts-right}
41
42 ### `SPC` `h` - Help
43
44 | Description        | Shortcut |
45 | ---                | ---      |
46 | **Spacemacs help** | `SPC`    |
47 | ---                | ---      |
48 | Layers             | `l`      |
49 | Documentation      | `r`      |
50 | FAQ                | `f`      |
51 | Vimtutor           | `T`      |
52 {: .-shortcuts-right}
53
54 ### `SPC` `f` - File
55
56 | Description   | Shortcut |
57 | ---           | ---      |
58 | **Save**      | `s`      |
59 | Save all      | `S`      |
60 | Copy          | `c`      |
61 | Delete        | `D`      |
62 | ---           | ---      |
63 | Show filename | `y`      |
64 {: .-shortcuts-right}
65
66 ### `SPC` `b` - Buffer
67
68 | Description                | Shortcut |
69 | ---                        | ---      |
70 | Next buffer (`:bnext`)     | `n`      |
71 | Previous buffer (`:bprev`) | `p`      |
72 | Delete buffer (`:bd`)      | `d`      |
73 {: .-shortcuts-right}
74
75 ### `SPC` `f` `e` - Config
76
77 | Description              | Shortcut |
78 | ---                      | ---      |
79 | **Edit config**          | `d`      |
80 | Edit config and template | `D`      |
81 | ---                      | ---      |
82 | Reload config            | `R`      |
83 {: .-shortcuts}
84
85 ### `SPC` `w` - Window
86
87 | Description         | Shortcut              |
88 | ---                 | ---                   |
89 | Help                | `.`                   |
90 |                     | ---                   |
91 | Select              | `h` / `j` / `k` / `l` |
92 | Move                | `H` / `J` / `K` / `L` |
93 | ---                 | ---                   |
94 | Split               | `s`                   |
95 | Split & follow      | `S`                   |
96 | ---                 | ---                   |
97 | Split vert          | `v`                   |
98 | Split vert & follow | `V`                   |
99 {: .-shortcuts-right}
100
101 ### `SPC` `p` - Project
102
103 | Description             | Shortcut |
104 | ---                     | ---      |
105 | **Switch project**      | `l`      |
106 | Switch project          | `p`      |
107 | ---                     | ---      |
108 | **Open files & recent** | `h`      |
109 | Open files              | `f`      |
110 | ---                     | ---      |
111 | **Show tree**           | `t`      |
112 | ---                     | ---      |
113 | Open terminal           | `'`      |
114 | Open terminal in root   | `$` `t`  |
115 {: .-shortcuts-right}
116
117 ### `SPC` `l` `w` - Workspaces
118
119 | Description                 | Shortcut    |
120 | ---                         | ---         |
121 | Help                        | `?`         |
122 | ---                         | ---         |
123 | Switch previous layout      | `TAB`       |
124 | **Switch to nth workspace** | `0` ... `9` |
125 | ---                         | ---         |
126 | Rename                      | `R`         |
127 {: .-shortcuts-right}
128
129 ### `SPC` `t` - Toggle
130
131 | Description  | Shortcut |
132 | ---          | ---      |
133 | Line numbers | `n`      |
134 {: .-shortcuts
135
136 ### `SPC` `j` - Jump
137
138 | Description | Shortcut |
139 | ---         | ---      |
140 | Character   | `j`      |
141 | Line        | `l`      |
142 | Word        | `w`      |
143 {: .-shortcuts-right}
144
145 ## Major modes
146
147 ### Markdown
148
149 | Shortcut    | Description            |
150 | ---         | ---                    |
151 | `,` `-`     | Insert horizontal rule |
152 | `,` `h` `1` | Insert H1              |
153 {: .-shortcuts}
154
155 ## Other layers
156
157 ### version-control
158
159 | Shortcut              | Description            |
160 | ---                   | ---                    |
161 | `SPC` `g` `s`         | **Status**             |
162 | ---                   | ---                    |
163 | `SPC` `g` `m`         | **Open dispatch menu** |
164 | `SPC` `g` `m` `s`     | Stage                  |
165 | `SPC` `g` `m` `P` `p` | Push                   |
166 | `SPC` `g` `m` `c`     | Commit                 |
167 | ---                   | ---                    |
168 | `SPC` `g` `t`         | Open time machine      |
169 | ---                   | ---                    |
170 | `SPC` `g` `l` `l`     | Open in GitHub         |
171 | `SPC` `g` `l` `L`     | Show GitHub URL        |
172 {: .-shortcuts}
173
174 Version control is provided by Magit.
175
176 ## Emacs standard
177
178 ### File
179
180 | Description      | Emacs       | Spacemacs     |
181 | ---              | ---         | ---           |
182 | Save             | `C-x` `C-s` | `SPC` `f` `s` |
183 | Open             | `C-x` `C-f` | `SPC` `f` `f` |
184 | Close            | `C-x` `C-k` |               |
185 | ---              | ---         | ---           |
186 | Split horizontal | `C-x` `2`   | `SPC` `w` `h` |
187 | Split vertical   | `C-x` `3`   | `SPC` `w` `v` |
188 | ---              | ---         | ---           |
189 | Confirm          | `C-c` `C-c` |               |
190 | Abort            | `C-c` `C-k` |               |
191 {: .-shortcuts-right}
192
193 ## References
194
195 - [Spacemacs documentation](https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.org) _(github.com)_