Appendix Two

Quick Reference

This is a quick reference for all of the shortcut keys that have been introduced throughout this book. They are broken down into sections for each tool and then grouped roughly by feature.

Z Shell

The Z Shell shortcuts mainly deal with command line editing. Both the Emacs and Vi command line editing modes are covered.

Emacs Mode

Keystroke Action
<Backspace> Delete the previous character
<Delete> Delete the next character
<C-d> Delete the next character
<C-b> Move the cursor backward one character
<C-f> Move the cursor forward one character
<C-v> Insert next character literally
<Esc>b Move the cursor backward one word
<Esc>f Move the cursor forward one word
<C-a> Move the cursor to the start of the line
<C-e> Move the cursor the the end of the line
<Up> Move back one command in the history list
<C-p> Move back one command in the history list
<Down> Move forward one command in the history list
<C-n> Move forward one command in the history list
<C-r> Search incrementally backwards through the history list
<C-s> Search incrementally forwards through the history list
<Esc>< Go to the start of the history list
<Esc>> Go to the end of the history list
<Esc><Backspace> Kill the previous word
<Esc>d Kill the next word
<C-k> Kill to the end of the line
<C-u> Kill the entire line
<C-y> Yank the last killed text
<Esc>y Cycle through the last ten kills

Vi Mode

Keystroke Action
h Move the cursor one character left
j Move forward one command in the history list
k Move backward one command in the history list
l Move the cursor one character right
w Move the cursor one word right
b Move the cursor one word left
0 (Zero) Move the cursor to the start of the line
$ Move the cursor to the end of the line
/ Search backward through command history
? Search forward through command history
i Insert to the left of the cursor
a Insert to the right of the cursor
I Insert at the start of the line
A Insert at the end of the line
x Delete a character under the cursor
db Delete the previous word
dw Delete the next word
d$ Delete from the cursor to the end of the line
d0 Delete from the cursor to the start of the line

Aliases

Alias Action
gst git status
gaa git add –all
gcb {branch} git checkout -b {branch}
gc git checkout
gfo git fetch origin
ggl git pull origin $(current_branch)
ggp git push origin $(current_branch)
gb git branch
gbd {branch} git branch -d {branch}
gmom git merge origin master
gm {branch} git merger {branch}
gcmsg “message” git commit -m “message”
ts {name} tmux new-session -s {name}
tl tmux list-sessions
ta {name} tmux attach -t {name}
tkss {name} tmux kill-session -t {name}

tmux

All of the tmux related shortcut sequences that were used in the book are shown here. Keep in mind the <Prefix> key sequence is actually a combination of keys. By default tmux uses <C-b>, but if you followed along with my instructions it should be changed to <C-a>.

Shortcuts

Keystroke Action
<Prefix>d Detach from the current session
<Prefix>c Create a new window in the current session
<Prefix>, Rename the active window
<Prefix>n Move to the next window
<Prefix>p Move to the previous window
<Prefix>{N} Move the the window numbered {N}
<Prefix>w Show a list of windows to choose from
<Prefix>| Split the current window vertically
<Prefix>% Split the current window vertically
<Prefix>- Split the current window horizontally
<Prefix>" Split the current window horizontally
<Prefix>o Move to the next pane
<Prefix><Up> Move to the pane above the current pane
<Prefix><Down> Move to the pane below the current pane
<Prefix><Left> Move to the pane left of the current pane
<Prefix><Right> Move to the pane right of the current pane
<Prefix>{ Move the pane to the previous position
<Prefix>} Move the pane to the next position
<Prefix><Space> Cycle through pane layout options
<Prefix>: Activate the tmux command mode
<Prefix>( Move to the previous session
<Prefix>) Move to the next session
<Prefix>L Show a list of sessions to choose from

Commands

Command Action
new-session, new Create a new tmux session
attach Attach to an existing tmux session
list-sessions, ls List existing tmux sessions
kill-session Kill an existing tmux session
new-window Create a new window in the current session
send-keys Send keystrokes to a tmux window or pane
select-window Make the specified window active

Vim

The Vim related shortcuts are show here. They have been split into their respective Modes, and then roughly by feature.

Normal Mode

Motions

Keystroke Action
h Move cursor one character left
j Move cursor one line down
k Move cursor one line up
l Move cursor one character right
w Move cursor right one word
W Move cursor right one WORD
b Move cursor left one word
B Move cursor left one WORD
e Move cursor right to the end of a word
ge Move cursor left to the end of previous word
E Move cursor right to the end of a WORD
gE Move cursor left to the end of previous WORD
0 Move cursor to the start of the line
^ Move cursor to the first non-blank character of the line
$ Move cursor to the end of the line
) Move cursor forward one sentence
( Move cursor backward one sentence
} Move cursor forward one paragraph
{ Move cursor backward one paragraph
gg Move cursor to the top of the file
G Move cursor to the bottom of the file
{N}G Move cursor to line number {N}

Editing

Keystroke Action
x Delete a single character under the cursor
X Delete a single character left of the cursor
r{char} Replace the character under cursor with {char}
i Enter Insert Mode to the left of the cursor
I Enter Insert Mode at the start of the line
a Enter Insert Mode to the right of the cursor
A Enter Insert Mode at the end of the line
o Enter Insert Mode on a new line below the cursor
O Enter Insert Mode on a new line above the cursor
s Delete character under cursor and enter Insert Mode
S Delete the line and enter Insert Mode
p Put text from the register to the right of the cursor
P Put text from the register to the left of the cursor
u Undo the last change
. Repeat the last change
<C-r> Redo the last Undo
Keystroke Action
f{char] Find the next occurrence of {char} on the line
F{char} Find the previous occurrence of {char} on the line
; Move to the next match
, Move to the previous match
/{pattern} Find the next occurrence of {pattern} in the file
?{pattern} Fine the previous occurrence of {pattern} in the file
n Move to the next match
N Move to the previous match

Windows

Keystroke Action
<C-w>s Create a new horizontal split window
<C-w>v Create a new vertical split window
<C-w>w Move to the next window
<C-w>h Move to the window left of the current window
<C-w>j Move to the window below the current window
<C-w>k Move to the window above the current window
<C-w>l Move to the window right of the current window

Ctags

Keystroke Action
<C-]> Go to definition of symbol under cursor
<C-t> Return to previous location
g<C-]> Select from a list of definitions

Marks

Keystroke Action
m{a-z} Buffer local mark named a through z
m{A-Z} Global mark named A through Z
`{a-z,A-Z} Go to mark named a through z or A through Z
`` Go to previous location
`. Go to the last change location
`^ Go to the last insertion

Operators

Keystroke Action
d Delete
y Yank into register
c Change
gc Comment (with optional vim-commentary plugin)
g~ Swap case
gu Make lowercase
gU Make uppercase
> Indent
< Outdent
= Autoindent
i Operator modifier, inner area of Motion or Text Object
a Operator modifier, outer area of Motion or Text Object

Text Objects

Key Text Object
w Word
s Sentence
p Paragraph
t Text contained within XML or HTML tags
[ , ] Text within brackets
( , ) Text within parentheses
{ , } Text within braces
< , > Text within a tag
Text within a pair of single quotes
" Text within a pair of double quotes

Insert Mode

Keystroke Action
<C-r>0 Put text from register zero
<C-n> Activate the first code completion item
<C-p> Activate the last code completion item
<C-e> Close completion menu without inserting an item
<Esc> Return to Normal Mode

Visual Mode

Keystroke Action
v Activate character wise Visual Mode
V Activate line wise Visual Mode
<C-v> Activate block wise Visual Mode
<Esc> Cancel visual selection and return to Normal Mode

Command Mode

Command Action
:e[dit] {file} Open {file} into a Vim buffer
:w[rite] Write the active buffer contents to the file on disk
:q[uit] Close the active Vim window. If only one window, exit Vim
:q[uit]! Close the active Vim window and ignore unsaved changes
:wq Write the buffer to disc and close the active window
:! {cmd} Run a command in the shell
:ls Display the buffer list
:b[uffer] {N} Activate buffer number {N}
:b[uffer] {file} Activate buffer with file named {file}
:bn[ext] Move to the next buffer in the list
:bp[rev] Move to the previous buffer in the list
:bf[irst] Move to the first buffer in the list
:bl[ast] Move to the last buffer in the list
:split {file} Create a new horizontal split window and optionally open file
:split . Create a new horizontal split window and open Netrw
:vsplit {file} Create a new vertical split window and optionally open file
:vsplit . Create a new vertical split window and open Netrw
:Ex[plore] Open Netrw in the active window
:Sex[plore] Open Netrw in a horizontal split window
:Vex[plore] Open Netrw in a vertical split window
:grep {pattern} Search for {pattern} using the system grep
:co[pen] Open the Quickfix list
:ccl[ose] Close the Quickfix list
:cn[ext] Move to the next item in the Quickfix list
:cp[rev] Move to the previous item in the Quickfix list
:cf[irst] Move to the first item in the Quickfix list
:cl[ast] Move to the last item in the Quickfix list
:noh Remove highlight from search matches
:make {target} Run the system make and pass an optional {target} to run
:te[rminal] (Neovim only) Create a terminal buffer