Spacemacs Cheatsheet


줍줍한 것들 기록. 아는 것들 이외에 모르는 것들에 집중.

Example 1

/from http://www.saltycrane.com/blog/2015/12/switching-emacs-vim-actually-spacemacs

Useful Spacemacs commands

SPC q q - quit SPC w / - split window vertically SPC w - - split window horizontally SPC 1 - switch to window 1 SPC 2 - switch to window 2 SPC w c - delete current window SPC TAB - switch to previous buffer SPC b b - switch buffers SPC f f - find a file SPC f s - save a file (:w also works) SPC p p - open project SPC p h - find a file in current project SPC b d - kill current buffer SPC b M - move buffer to another window SPC v - enter expand-region mode

Useful Vim key bindings

movement


0 - beginning of line ^ - beginning of non-whitespace $ - end of line 9j - move down 9 lines w - move forward by word b - move backward by word gg - first line G - last line C-u - up half page C-d - down half page f/ - move forward to first "" character t = move forward right before the first "/" character ; - repeat that command again H - head of the screen M - middle of the screen L - last of the screen } - move forward by paragraph or block { - move backwards by paragraph or block ,* - search for word under the cursor n - search again forward N - search again backwards

/ - search forward ? - search backward % - find matching brace, paren, etc ma - mark a line in a file with marker "a" `a - after moving around, go back to the exact position of marker "a" 'a - after moving around, go back to line of marker "a" :marks - view all the marks '' - go to the last place you were [{ - jump back to the "{" at the beginning of the current code block

editing


x - delete char under cursor X - delete char before cursor A - add to end of line I - insert at the beginning of the line dd - delete line D - delete from cursor to end of line di' - delete text inside single quotes yy - copy line Y - copy from cursor to end of line cc - change line C - change from cursor to end of line cit - change text inside html tag ci' - change text inside single quotes ci{ - change text inside curly brackets. ci... - etc p - paste after cursor P = paste before cursor o - add line below O - add line above . = repeat last comment r - replace character R - replace. (overwrite) (good for columns of text) J - join line (cursor can be anywhere on line)

visual mode


v - visual char mode V - visual line mode C-v - block visual mode

Example 2

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u 3. Lower Case : M-l
  • Helm-projectile find file : M-m p f
  • Helm-projectile-grep : M-m p s g
  • Toggle Auto complete : M-m t a
  • Neotree root directory : M-m p t
  • Linum-relative : M-m t r
  • Ace-jump mode : M-m SPC *. Helm-bookmarks : M-m h b
  • Iedit mode : 1. M-<left>, M-<right> to navigate, 2. C-; to select/deselct all for edit at once
  • Expand Region 1. Expand: M-m v 2. Contract: M-m V
  • Winner mode: 1. Undo : C-c <left> 2. Redo : C-c <right>
  • Toggle Aggressive Indent Mode : M-m t I
  • Open file in new buffer after M-m p f : C-c o
  • Dired mode : 1. Copy file : C 2. Delete the file : D 3. Rename the file : R 4. Create a new directory : + 5. Reload directory listing : g
  • Search : 1. The last searched query : C-s C-s 2. The string under the cursor : C-s C-w
  • Un-indent by 4 spaces : C-u -4 C-x TAB
  • Open emacs dired mode: M-m a d
  • Erase contents of buffer: M-m b e
  • Replace contents of buffer with the contents of the clipboard: M-m b P
  • Copy contents of the whole buffer: M-m b Y
  • Open current file directory: M-m f j
  • Rename current file: M-m f R
  • Indent region/buffer: M-m j =
  • Kill all buffers (of current project): M-m p k
  • Reload spacemacs conf: M-m f e R
  • Kill all buffers except the current one: M-m b K
  • Go to conf file (~/.spacemacs): M-m f e d
  • Toggle display fill-column(column 80): M-m t f
  • Enable/Disable read-only mode C-x C-q
  • Go one level up in directory: C-x C-j
  • Indent/unindent region by n/-n spaces(n=4,8,... usually): C-u <n> C-x TAB
  • Go to previous cursor position(before ace-jump): `M-m SPC ``
  • Do ag (code search) inside project : M-m s a p
  • Narrow to function : M-m n f (M-m n w to exit)
  • Enable rainbow mode: M-m t C c
  • Search selected region or current word through ag in project: M-m s p
  • Highlight search results in another buffer (helm swoop): M-m s s (M-m s s to exit)
  • Toggle current frame transparency: M-m T T
  • Toggle non-matching lines for iedit mode: C-' when in iedit mode (C-;)
  • Helm-resume background task: M-m h l
  • Enter .spacemacs diff mode: M-m f e D
  • Show kill ring history: M-m r y
  • When in dired mode, press ? to display a list of commands.
  • Search within given buffer (helm-swoop mode): M-m s s
  • List all functions in the given buffer (imenu): M-m s l

Related-Notes

References