General
Leader Key |
, |
Fast Saving |
,w |
Sudo Saving |
:W |
Visual Mode
Search for Current Selection |
* or # |
Search Forwards |
<space> |
Search Backwards |
Ctrl-<Space> |
Ack Text (search for Text) |
,gv |
Search & Replace Selected Text |
,r |
Surround selection in ( ) |
$1 |
Surround selection in [ ] |
$2 |
Surround selection in { } |
$3 |
Surround selection in " " |
$$ or $e |
Surround selection in ' ' |
$q |
Insert Mode
Insert ( ) |
$1 |
Insert [ ] |
$2 |
Insert { } |
$3 |
Insert ' ' |
$q |
Insert " " |
$e |
Insert < > |
$t |
Date format: %d/%m/%y %H:%M:%S
Windows
Move to Upper Window |
Ctrl-j |
Move to Lower Window |
Ctrl-k |
Move to Lefter Window |
Ctrl-h |
Move to Righter Window |
Ctrl-l |
Buffers
Close Current Buffer |
,bd |
Close All Buffers |
,ba |
Go to Next Buffer |
,l |
Go to Previous Buffer |
,h |
Tabs
Open New Tab |
,tn |
Close All Other Tabs |
,to |
Close Current Tab |
,tc |
Move Current Tab |
,tm |
Go to Next Tab |
,t, |
Toggle b/w This Tab and Previous Tab |
,t1 |
Open New Tab w/ Current Buffer's Path |
,te |
Switch CWD to Open Buffer's Directory |
,cd |
Editing
Go to First Non-blank Char |
0 |
Move Line of Text Down |
Alt-j |
Move Line of Text Up |
Alt-k |
Spell Checking
Toggle Spell Checking |
,ss |
Move to Next Misspelled Word |
,sn |
Move to Previous Misspelled Word |
,sp |
Add Word to Dictionary |
,sa |
Suggest Spellings for Word |
,s? |
Misc
Remove ^M |
,m |
Open Buffer for Notes |
,q |
Open Markdown Buffer for Notes |
,x |
Toggle Paste Mode |
,pp |
Open File Under Cursor |
gf |
|
|
bufExplorer Plugin
Open bufExplorer |
,o |
Normal Open |
\be |
Force Horizontal Split Open |
\bs |
Force Vertical Split Open |
\bv |
Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use <Enter> or <Left-Mouse-Click> to select the buffer you would like to open.
If you would like to have the selected buffer opened in a new tab, simply press either <Shift-Enter> or 't'.
Most Recently Used (MRU)
Open MRU |
,f |
Open File in Current Window |
<Enter> |
Open File in New Window |
o or <Shift-Enter> |
Open File in Read-only Mode |
v |
Open File in New Tab |
t |
Update File List |
u |
Close MRU |
q or <Esc> |
You can open multiple files from the MRU window by specifying a count before pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually (using linewise visual mode) select multiple filenames and invoke the commands to open the files. Each selected file will be opened in a separate window or tab.
CTRL-P (Full Path Fuzzy _ Finder)
Open CTRL-P / Find File |
Ctrl-f |
Find Buffer/MRU |
Ctrl-b |
Update Results |
<F5> |
Filename Only |
Ctrl-d |
RegExp Mode |
Ctrl-r |
Go Down |
Ctrl-j |
Go Up |
Ctrl-k |
Open in New Tab |
Ctrl-t |
Open in New Tab (Vertical Split) |
Ctrl-v |
Open in New Tab (Horizontal Split) |
Ctrl-x |
Select Next String in History |
Ctrl-n |
Select Previous String in History |
Ctrl-p |
Create New File (and parent directories) |
Ctrl-y |
Mark/Unmark Multiple Files |
Ctrl-z |
Open File |
Ctrl-o |
Run :help ctrlp-mappings or submit ? in CtrlP for more mapping help.
Submit two or more dots .. to go up the directory tree by one or multiple levels.
End the input string with a colon : followed by a command to execute it on the opening file(s): Use :25 to jump to line 25. Use :diffthis when opening multiple files to run :diffthis on the first 4 files.
Cope
Open Error List Window |
,cc |
Close Error List Window |
:ccl |
Go to Next Search Results |
,n |
Go to Previous Search Results |
,p |
Use :help cope to learn about cope
When searching in Ack.vim, display results in cope with ,cc
|
|
NERDTree (File Directory Tree)
Toggle NERDTree |
,nn |
NERDTree from Bookmark |
,nb |
NERDTree Find |
,nf |
SnipMate
Insert/Navigate Snippet |
<Tab> |
VIM Multiple Cursors
Add Cursor |
Ctrl-n |
Remove Current Cursor (Go to Prev) |
Ctrl-p |
Remove Current Cursor (Go to Next) |
Ctrl-x |
surround.vim
Change Surroundings |
cs<old><new> |
Remove Surroundings |
ds<old> |
Revert Surroundings |
cst<new> |
Wrap Text Object |
ysiw<new> |
Wrap Line |
yss<new> |
Wrap (In Visual mode) |
S<new> |
Vimroom (Distraction-free Editing)
Embrace the Zen |
,z |
Abandon the Zen |
,z! |
Ack (super fast grep for searching)
:Ack [options] {pattern} [{directories}]
Use :Ack! if you don't want to jump to first result automatically
Must enclose pattern in ' ' if it has whitespace.
Must escape # -> \\\#
? a quick summary of shortcuts, repeat to close
Vim-Commentary
Comment out a line (takes a count) |
gcc |
Comment out target of a motion |
gc |
Uncomment adjacent commented lines |
gcu |
Vim-Expand-Region
Expand Visual Selection |
+ |
Shrink Visual Selection |
- |
Git Fugitive
View x in Repository |
:Gedit x |
Diff files against repository |
:Gdiff |
git status (- to add/reset changes, p to add/reset --patch) |
:Gstatus |
git commit |
:Gcommit |
git blame |
:Gblame |
git mv |
:Gmove |
git grep |
:Ggrep |
git log |
:Glog |
git checkout -- filename (on buffer) |
:Gread |
git add/checkout |
:Gwrite |
Open file on Web (ex. github) |
:Gbrowse |
git <command> |
:Git <command> |
git <command> with open output in new file |
:Git! <command> |
Preface regular vim commands with G to do the git version.
Ex: :Gtabedit will open up the blob/tree/commit/tag in a new tab
|