Press SPC w t
to dedicate the current window to the current buffer. This is helpful when you have an important buffer that you don't want to get replaced by another buffer.
Press SPC r d
to dedicate the current window to its current purpose.
Press M-m t E e
when you are in Emacs (holy) mode.
Press SPC t E e
when you are in Evil mode.
- C-] - go to tag
Press , c p
to preview the current Markdown buffer in your browser.
Press , i l
to insert an HTTP link. For example:
To surround the selected text:
- Select text in visual mode.
- Press
s
key. - Press a character like '(', ')', '"', or even an XMl tag like "".
For character pairs that have a different opening and closing character, use the closing character to avoid adding additional spaces.
Examples:
The [ and ] characters represent the selected region:
Before:
The [quick] brown fox.
After:
The "quick" brown fox.
Before (the entire line is selcted using Shift-v):
[The quick brown fox.]
After:
"
The quick brown fox.
"
Before:
The [quick
brown] fox.
After:
The "quick
brown" fox.
Unlike the last tip, this one forces the surrounding text to be on their own lines.
- Select text in visual mode.
- Press the
gS
key sequence. - Press a character like '(', ')', '"', or even an XMl tag like "".
This is especially helpful for Scala pattern matching. You can easily turn:
case Some(x) => Right(x)
into:
case Some(x) => {
println(x)
Right(x)
}
Just select the text: Right(x)
and then type gS{
and then indent the code to your liking.
Examples:
The [ and ] characters represent the selected region:
Before:
The [quick] brown fox.
After:
The "
quick
"brown fox.
Before (the entire line is selcted using Shift-v):
[The quick brown fox.]
After:
"
The quick brown fox.
"
Before:
The [quick
brown] fox.
After:
The "
quick
brown
"fox.
To wrap some text in a function call:
- Select the argument(s) to the function call.
- Hit the 'sf' key sequence. Mnemonic: "surround Function"
- Enter the function name. Don't enter any parenthesis.
- Press ENTER
Examples:
Before:
[name]
After (using foo as the function name):
foo(name)
Before:
valid = [flag];
After:
valid = bool(flag);
** In Normal Mode
Similar to visual mode but the key sequences are different.
- Instead of 's' use 'ys'.
- Instead of 'gS' use 'yS'.
To change the surrounding characters use the 'cs' key sequence. Just put the point (represented by the '|' character) on the first of the surrounding strings. Then press the current surrounding character and then the surrounding character you want.
Examples:
Before:
The |'quick' brown fox.
After:
The "quick" brown fox.
Before (type 'cs<' to change the tags and make sure to enter the angle brackets (e.g. "<quote>")):
The |<bold>quick</bold> brown fox.
After:
The <quote>quick</quote> brown fox.
To delete the surrounding characters us the 'ds' key sequence.
Examples:
Before:
The |"quick" brown fox.
After pressing the `ds"` key sequence:
The quick brown fox.
If you have a region selected, pressing SPC v
will 1) expand the region and 2) display a transient menu that shows you other operations you can perform on the region.
This goes great with using the o
key to position the point to the other end of the region.
Sometimes your undo history branches. With SPC a u
you can navigate the undo tree and see what your buffer looks like each step of the way. Press q
to quit.
Press SPC b e
and you will be prompted to see if you want to erase the current buffer.
Press SPC a p
and you'll see a buffer with the processes listed in it. Pressing d
when point is on a process will kill that process without prompting you.
Press q
to close the buffer.
Press SPC b i
to open a buffer that shows the current buffer's hierarchy. Navigate around and press ENTER
to navigate to the selected portion of the document.
Press SPC b .
to get a transient menu that has some helpful options you can run to navigate, kill, bury, and relocate buffers.
Press SPC b m
a to show the Messages buffer.
Press SPC b s
a to show the Scratch buffer.
Press SPC b w
to toggle the read-only state of the current buffer. This has interesting behavior in a Dired buffer. It makes your directory editable.
Did you accidentally close a buffer? Press SPC b u
and the last buffer you closed will re-open. This won't bring back changes made to a buffer if you didn't save them and deleted the buffer.
Press SPC b I
to open Ibuffer. Ibuffer has lots of functionality. You can mark buffers and save, revert, kill, etc. marked buffers.
Want to temporarily hide comments to focus on the code? Press SPC c h
to hide comments. Press the same sequence again to reveal the comments. Of course, this is only useful if the code has comments.
To see the list of errors for the current buffer, press SPC e l
. If you want to see the errors and navigate through the error list, press SPC e L
instead.
To see a transient menu that lets you easily navigate your errors in the current buffer, press SPC e .
.
To yank the full path to the current buffer's file, press SPC f y y
.
To yank the directory of the current buffer's file, press SPC f y d
.
To yank the file name of the current buffer's file, press SPC f y n
.
To yank the file name (without the file extension) of the current buffer's file, press SPC f y N
.
Press SPC f o
to open the current buffer's file in an external application.
Press SPC f D
and you will be prompted to delete the current buffer's file. If you proceed with the delete, the current buffer will be deleted.
Press SPC f R
and you will be prompted for a directory and filename to rename the file to. If any directories in the path you supply don't exist, Emacs will offer to create them for you.
If you want to create a temp file to experiment on, press SPC f J
and you will be prompted for a file extension. If you enter an extension and press ENTER
, Emacs will create a junk file for you and visit that file.
Press 'SPC j l' to enter an interface for selecting a LINE that's currently visible.
Press 'SPC j w' to enter an interface for selecting a WORD that's currently visible.
Press SPC j c
to jump to the location of your last change.
Press SPC n r
to narrow to the selected region
Press SPC n f
to narrow to the current function.
Press SPC n w
to widen to the entire buffer.
Press SPC p o
to open the current project's TODOs.org file.
Press SPC s s
to start searching through lines of the current buffer by text or regexp.
Press SPC s C-s
to start searching through lines of the all buffers by text or regexp.
- Select the first region.
- Press
g x
. - Select the second region.
- Press
g x
.
If you've ever wanted to make some experimental changes but "keep a backup", of the lines, select the lines you want to modify and press g y
.
Press g i
.
Press SPC x K
. You can repeatedly press k
and j
to move the text up and down respectively.
Press SPC x J
. You can repeatedly press j
and k
to move the text down and up respectively.
Press M-n
and M-p
navigate forwards and backwards through history.
Press C-SPC
to select the current file and move to the next file.
Press TAB
to preview the current file.
Press C-c C-i
to insert the the Helm selection into the current buffer.
Press C-v
to scroll down and M-v
to scroll up.
Press C-t
to move the Helm window to a vertical window and back to horizontal.
** f
- t - find project file in Treemacs ** g - version control
- / - git grep
-
-
- git grep at point
-
- b - blame transient state
- m - magit dispatch
- r - smerge transient state
- t - time-machine (AWESOME) *** f - file - l - log for commits for this file *** j - d/D - dired same/different window - f - jump to lisp function - I - imenu all buffers (Just try it!) *** o - org ** n - narrrow/numbering
-
-
- increase number
-
-
-
- decrease number ** p - Project
-
- a - toggle between implementation and test
- b - switch to project buffer
- o - project todo list ** r - rings / registers
- y - kill ring
- e - show registers
- P - set window purpose
- s - last search buffer
** s
- s - swoop
- C-s - swoop all buffers
- r,b - search buffers
- g
- p - select the last pasted region.
- t/T - go to the next/previous tab.
- M - go to middle of line
- & - repeat global substitute
- ; - go to last change
- i - insert resume ** x - text
- t,w - transpose words
- Org mode
** g
- h - go up element
- k - go backward element
- j - go forward one element same level ** , *** * - toggle heading