Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Luan's Vim Cheat Sheet

Luan Santos edited this page Oct 18, 2017 · 15 revisions

General

Command Action
Save current buffer
<space> Clear highlighted search
\ Toggle NERDTree
Reveal current file in NERDTree
<F6> Toggle PASTE mode (set paste or set nopaste)
<F8> Toggle TagBar
,f or ⌃p Fuzzy find file
,b Fuzzy find buffer
,, Go to last file
:A or ,. Go to alternate file (test file/implementation)
:AV Open alternate file in vertical split
:AS Open alternate file in horizontal split
:AT Open alternate file in a new tab
yf Copy current filepath to clipboard
⌃] or g<Left-Click> Go to definition (need tags to be generated)
gd Go to definition (does not need tags to be generated)
⌃w ] Open definition in horizontal split (need tags to be generated)
g] List all definitions (need tags to be generated)
⌃t or :pop Pop tag stack (go up a level)
:tag "Push" tag stack (go down a level)
,S Fuzzy search all tags (slow)
,F Fuzzy search tags in current buffer
gcc (Un)comment current line
<Visual>gc (Un) comment selection
gc [operator] Operator to (un)comment blocks of text
,Y Copies the current file path to the clipboard
,C Copies the current file path + line number to the clipboard
,<space> Re-run last vipe command (needs vipe to be running)
,z Move to the buffer on the left
,x Move to the buffer on the right
:!ctags -R Generate ctags for current project

Git

Command Action
,gs or Gstatus Open git status window
,gb or Gblame Open git blame window
,gpl Git pull --rebase
,gps Git push origin head
,gj Next changed hunk in file
,gk Previous changed hunk in file

Within the git status window

Command Action
⌃n Next change
⌃p Previous change
- (Un)stage change
cc Commit - opens git message editor
ca Ammend - opens git message editor with previous commit
D Show :Gdiff of file under cursor
Open file under cursor

Golang

Command Action
,t Run tests using vipe (needs vipe to be running)
,T Run focused tests using vipe (needs vipe to be running)

Ruby

Command Action
,t Run tests using vipe (needs vipe to be running)
,T Run focused tests using vipe (needs vipe to be running)
Clone this wiki locally