Skip to content

Instantly share code, notes, and snippets.

@ferhaterata
Forked from k3yavi/spacemacs-cheatsheet.txt
Last active March 18, 2020 03:39
Show Gist options
  • Save ferhaterata/27d77fd680803ce537ef5be803c23738 to your computer and use it in GitHub Desktop.
Save ferhaterata/27d77fd680803ce537ef5be803c23738 to your computer and use it in GitHub Desktop.
Spacemacs cheatsheet
Useful Spacemacs commands
SPC q q - quit
SPC w / - split window vertically
SPC w - - split window horizontally
SPC w = - balance split windows
SPC 1 - switch to window 1
SPC 2 - switch to window jkk2
SPC w c - close current window
SPC w d - delete current window
--------
SPC TAB - switch to previous buffer
SPC b b - switch buffers in helm
SPC b p - previous buffer
SPC b n - next buffer
SPC b d - kill current buffer
SPC b M - move buffer to another window
--------
SPC f f - find a file in helm
SPC f s - save a file (:w also works)
SPC f r - recent files in helm
SPC f t - open treemacs
SPC f T -
--------
SPC p p - open project
SPC p h - helm projectile
SPC p f - find a file in current project
--------
SPC v - enter expand-region mode
SPC ; ; - comment/uncomment
SPC h m - describe the current mode
apps
--------
SPC a u - undo tree visualize
SPC a d - dired
avy/jumps/imenu
--------
SPC j j - avy timer (avy-goto-char-timer)
SPC j w - avy word (avy-goto-word-or-subword-1)
SPC j i - Jump to a title, a function definition, a class, etc. with helm
iedit
--------
SPC s e - iedit word under cursor
SPC v e - expand selection and iedit
n - navigate forward
N - navigate backwards
F - restrict selection to current function
TAB - toggle selection
L - restrict selection to the current line
J - include above
K - include below
SPC s s - swoop in helm
J - include above
K - include below
git
--------
SPC g s - show Magit status view
SPC g f l - show git log for the current file
SPC g b - open a =magit= blame
SPC g B - quit =magit= blame
SPC g c - commit changes
SPC g t - launch the git time machine
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
gd - go to defitinition (doesn't work on sml)
G - last line
C-u - up half page
C-d - down half page
C-f - forward one page.
C-b - backward one 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 backwards for word under cursor
/ - 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)
SPC i j - evil insert line below
SPC i k - evil insert line above
Emacs in insert state
--------
C-f (forward-char)
C-b (backward-char)
M-f (forward-word)
M-b (backward-word)
visual mode
--------
v - visual char mode
V - visual line mode
C-v - block visual mode
dired mode
--------
RET or f Open file or directory
o - Open file in a separate window
^ - Up directory
+ - Create a directory
R - Rename / move
C - Copy
M - Change file/directory mode (unix file/directory permissions)
d - Delete
m - Mark
u - Unmark / undelete
x - 'Expunge' -- i.e. actually delete files/directories marked for deletion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment