Vi for Scala Keybindings

Key bindings for my Vi setup for editing Scala, [available here][1].

Vi
Buffers
,b Next Buffer
,B Previous Buffer
:buffers List all current buffers
Folding
za Toggle current fold, current level
zo Open fold, current level
zc Close fold, current level
zA Toggle current fold, all levels
zo Open fold, all levels
zc Close fold, all levels
zr Open one more level of folds, whole buffer
zR Open all folds, whole buffer
zm Close one more level of folds, whole buffer
zM Close all folds, whole buffer
Visual Block Mode
v Enter block mode
I Insert into block at current cursor position
h Move block end to the left
j Move block end down
k Move block end up
l Move block end right
x Delete block
Same as l, move block end right
A Append to block at current position
Movement
j Move one line down
k Move one line up
l Move one character right
h Move one character left
{ Jump to previous blank line
} Jump to next blank line
Windows
:split Split window
,sw Size current window to fit
lines in file (for small files)
:resize 10 Size current (horiz) window to 10 lines
:vertical resize 10 Size current (vertical) window to 10 columns
C-w= Make all windows the same size
C-w- Make current horizontal-split window smaller by one line (can prefix with number)
C-w+ Make current horizontal-split window larger by one line (can prefix with number)
C-w< Make current window narrower by one column (can prefix with number)
C-w> Make vertical split window wider by one column (can prefix with number)
:new XXX Open file xxx in new window. Prefix with number to set size of window
,t Open corresponding Test file in a split below this window
,T Open corresponding Test file in this window (new buffer)
,vt Open corresponding Test file in a split to the right of this window
,at Open corresponding Test file in a split above this window
,lt Open corresponding Test file in a split to the left of this window
Comments
,cc Comment-out marked region
,cu Remove comments from marked region

 

QuickFix
\ff Jump to first compile error
\fn Jump to next compile error
:cope [n] Open window with list of errors. n is optional window height
:ccl Close list of errors

 

Tags
:tag XXX Jump to definition of symbol XXX
C-] Jump to definition of tag under cursor
C-t Jump back to point before jumping to definition

 

NERDTree
C-n Toggle NERDTree window
r Refresh current dir
R Refresh from root dir
P Jump to root node
o/RETURN Open file, dir or bookmark
go Open, but cursor stays in tree
t Open in new tab
T Like t, but focus stays on current tab
i Open in split window
gi Same as i, but cursor stays in tree
s Open in vsplit
gs Same as s, but cursor stays in tree
O Recursively open selected dir
x Close current nodes parent
X Recursively close all children of current node
e Edit current dir
D Delete current bookmark
p Jump to current roots parent
K Jump up inside dirs at current depth
J Jump down inside dirs at current depth
C-J Jump down to next sibling of current dir
C-K Jump up to prev sibling of current dir
C Change root to selected dir
u Move tree root up one dir
U Same as u, but old root left open
m Display action menu
cd Change cwd to dir of selected node
CD Change root to dir of current node
I Toggle hidden files
f Toggle file filters
F Toggle display of files
B Toogle bookmark table
q Close NERDTree window
A Maximize NERDTree window
? Quick help
Marks
mx Set mark “x” (where x is any lower-case letter)
‘x Go to beginning of line of mark x
`x Go to exact position of mark x
mX Create mark on this file called X (uppercase letter)
`X Go to file marked X (uppercase)
‘X Same as `X
Special Marks
Last position before a jump
< Start of visual
> End of visual
[ Start of previously changed text
] End of previously changed text
^ Last insert
. Last change
( Start of sentence
) End of sentence
{ Start of paragraph
} End of paragraph
Control-P
Miscellaneous
C-p Invoke in file mode
C-P Invoke in mixed mode (files, buffers, MRU)
Purge cache
C-f/C-n Cycle through modes
C-d Filename-only mode (instead of full path)
C-r Regex mode
C-j/C-k Navigate result list
C-t/C-v/C-x Open selected entry in new tab or new split
C-n/C-p Next/Prev prompt history
C-y Create new file and parent dirs
C-z Mark/Unmark multiple files
C-o Open marked files
Search
:retab Change tabs to correct spaces in current file
,cd Change cwd to dir of current file
,g Prompt to grep in subdirectories for a pattern (:Grep)
Pass current file through Scalariform, formatting it (:Autoformat)
/ Search for expression forwards
? Search for expression backwards
n Next match forwards
N Next match backwards
* Search forward for word under cursor
# Search backward for word under cursor
gD Jump to first occurrence of this word in this file (Goto definition)
Editing

c%Change to next matching symbol (see this)

ct) Change until the next “)” (or any other text object – see list)
di) Delete inner parentheses
ci) Change inner parentheses
vi)i) Select inner, then expand to next inner
Actions
ci Change inner
di Delete inner
vi Select inner
ca Change all
da Delete all
va Select all
Text Objects (for use with action commands)
( or ) Parenthesis
{ or } Curly braces
[ or ] Square brackets
< or > Angle brackets
Double quotes
Single quote
` Backticks
w Word
W Word with stricter boundaries
s Sentence
p Paragraph
t Tag
XTemplate
freespec C-\ Insert ScalaTest FreeSpec template

 

Tmux

C-a C-up, C-a C-left, C-a C-right resize by 1 row/column
C-a C-down resize smaller by 1 row
tmux new-session -s work Start a new session
tmux attach-session -t work Attach to an existing session
C-a $ rename the current session
C-a ( previous session
C-a ) next session
C-a L last (previously used) session
C-a s choose a session from a list
C-a c create a new window
C-a 1 … switch to window 1, …, 9, 0
C-a p previous window
C-a n next window
C-a l last (previously used) window
C-a w choose window from a list
C-a left go to the next pane on the left
C-a right (or one of these other directions)
C-a o go to the next pane (cycle through all of them)
C-a ; go to the last (previously used) pane
C-a q Briefly display the pane indicies
C-a M-down Make current pane 5 lines smaller
C-a “ Split horizontally
C-a % Split vertically
C-a x Close current pane
C-a [ Enter scroll mode (j/k to move
up/down, RETURN to exit)
[1]: https://github.com/michaelpnash/vi-for-scala