Editing
Option-k, Option-d |
Insert _ |
Option-K, Option-D |
Insert - |
C-l |
Insert => |
C-k |
Jump over pair expansion (e.g. quotes) |
C-j |
Jump over pair expansion, insert new line |
<leader>Enter |
Insert new line |
<leader>ci |
Change inside any surrounding |
ci<motion> |
Change inside surrounding |
<leader>", ', ), [, {, `, etc |
Surround word |
Option-', ", (, etc |
Change inside surroundings |
<leader>cas |
Delete surrounding and go to insert mode |
<leader>fef |
Format entire file |
<leader>a= |
Tabularize on = |
<leader>a: |
Tabularize on : |
<leader>a, |
Tabularize on , |
gc<motion> |
Toggle comments |
gcc |
Toggle comments for current line |
sk, sj |
Expand/Join statements into one line |
daa |
Delete an argument |
cia |
Change inner argument |
,: |
Change hash syntax to Ruby 1.9 |
gcp |
Comment paragraph/block |
Window management
C-j, C-k, C-h, C-l |
Split switching |
vv |
Horizontal split |
ss |
Vertical split |
<leader>qs |
Clear last search |
<leader>qq |
Close Quickfix |
Navigation
<leader>T |
Toggle Tagbar |
C-] |
Go to tag |
C-T |
back from tag search |
gf |
Go to file |
<leader>cd |
Changedir of file in buffer |
<leader>md |
Create dir containing file in buffer |
<leader>rcd |
:lcd to rails repo |
<leader>e,es,ev,tb |
Helpers for edit command (current dir filled in) |
C-p |
Insert path of current file into a command |
<leader>b, C-b |
CtrlPBuffer |
<leader>jm |
CtrlP app/models |
<leader>jc |
CtrlP app/controllers |
<leader>jv |
CtrlP app/views |
<leader>js |
CtrlP spec |
CtrlP: Ctrl-Y |
Create file and parent dirs |
CtrlP: Ctrl-O |
Open in... |
CtrlP: Ctrl-T |
Open in tab |
CtrlP: Ctrl-V |
Open in vert split |
CtrlP: Ctrl-X |
Open in horizontal split |
CtrlP: Ctrl-D |
Toggle full-path or filename search |
CtrlP: Ctrl-R |
Toggle regexp mode |
<leader>ocf |
Open changed files (git) |
|
|
Motions
ar |
Ruby block |
ir |
Inner Ruby block |
ar, ir after selection command |
Expand Ruby block selection |
ae, ve |
Entire file |
a:, ci:, vi:, di: |
Ruby symbol |
a_ |
Underscore |
af |
Functions (JS, C) |
am |
A method |
im |
Inner method |
[m, ]M |
Start/end of next method def |
]m, [M |
Start/end of prev method def |
]], ][ |
Start/end of next module/class def |
[[, [] |
Start/end of prev module/class def |
aM |
Class |
iM |
Inner class |
oar |
Outer Ruby block |
Ruby dev
<leader>bb |
bundle install |
<leader>rs, <leader>rb |
rspec |
Rspec buffer: q |
Quit |
Rspec buffer: n |
Next failure message |
Rspec buffer: p |
Prev failure message |
Rspec buffer: f |
Go to finished at section |
<leader>m |
Rmodel |
<leader>s |
Related spec vsplit |
<leader>pp |
conque pry |
<leader>ss |
conque console |
:Rake |
Rake |
:Rextract |
Extract partial |
crl |
Pluralize/Singularize |
crt |
Tableize, Classify |
Integration
:ConqueTerm <shell> |
Open a shell in the current buffer |
<leader>! |
Horizontal split conqueterm zsh |
<leader>fc |
Find merge conflicts |
[n, ]n |
Move to prev/next conflict marker |
<leader>g |
:Git |
<leader>w |
:Gwrite |
<leader>gd |
Git diff |
<leader>gs |
Git status |
<leader>gc |
Git commit |
<leader>gbl |
Git blame (also works with selection) |
|
|
Searching
<leader>q/ |
vimgrep current word |
<leader>/ |
:Ag |
:Ag, :AgAdd, :LAg, :LGAdd |
Ag (The silver searcher) |
o |
Ag Quickfix: Open |
go |
Ag Quickfix: Preview file |
t |
Ag Quickfix: Open in tab |
v |
Ag Quickfix: Open in vert split |
q |
Ag Quickfix: Close |
%Subvert |
Abolish: x: :%Subvert/facilit{y,ies}/building{,s}/g (See docs) |
* |
Search for word under cursor |
<leader>* |
Vimgrep word under cursor |
gK |
Search for doc |
<leader>q/ |
Ag in quicksearch for last search |
K |
Ag word under cursor |
<leader>gd |
Grep for def <cursor word> |
<leader>gcp |
Grep current Rails partial |
Ruby and Rails abbrevs & snippets
logd/i/f/e/w |
logger.debug/error/fatal/info/warn |
AC:: |
ActionController:: |
AO:: |
ActiveModel:: |
AR:: |
ActiveRecord:: |
AS:: |
ActiveSupport |
Controller: pa |
params[ |
Controller: rst |
respond_to |
Controller: rr |
render |
Controller: rj |
render :json |
Controller: rt |
render :text |
Controller: hd |
headers |
Controller: fl |
flash |
Controller: re |
redirect_to |
Controller: rq |
request |
Controller: rs |
response |
Model: ho |
has_one |
Model: hm |
has_many |
beg |
begin/rescue/end |
req |
require |
def |
def |
defs |
def self. |
if |
if condition; end |
ife |
if condition; else; end |
elsif |
elsif condition |
r |
attr_reader |
w |
attr_writer |
rw |
attr_accessor |
Enum |
Enumerable |
Comp |
Comparable |
am |
alias_method |
dir |
Filename.dirname(__FILE__) |
ea |
each brace |
ead |
each block |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets