Skip to content

Instantly share code, notes, and snippets.

@keeperofthenecklace
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keeperofthenecklace/af1f16f20947612577d3 to your computer and use it in GitHub Desktop.
Save keeperofthenecklace/af1f16f20947612577d3 to your computer and use it in GitHub Desktop.
VIM HELPFUL
DASH
------
:Dash[!]
:Dash printf
:Dash setTimeout javascript
:Dash!
:Dash! func #Will search for 'func' in all docsets.
:DashKeywords
:DashKeywords backbone underscore javascript
:DashSettings #List of profiles triggered by keyword search
vim-rails
---------
Eg2. In Controller
def index #Place cursor here. Then hit escape. :R take you to the view
#some code
end
----------------
Eg 3. In View
Anywhere. Hit escape. Then :R return you to the action in the controller .
eg. show.html.erb returns to def show; end
eg: 4
-------
:Rcontroller and :Rmodel toggles back and forth
Some BAsics
--------------
Command T
:Rmodel model-name
:Rcontroller controller-name
:Renvironment environment-name
:Rfixtures
:Rhelper
:Rjavascript
:Rlayout
:Rlib
:Rmailer
:Rmigration
:Rmodel
:Robserver
:Rtask
:Rview
:Rspec
:Rscript # puts you in the rails console
:Rfind file-name
:Rgenerate (options)
:A goes to the alternate file (eg the associated test file)
:AS same as above, but in split
:AV same as above, but in vertical split
:R #goes to the related file, so if the cursor is on the ‘show’ method of a controller – it will take you to the show view.
:RS #same as above, but in split
:RV #same as above, but in vertical split
:Rake task-name
:sp #splits your screen (can be used multiple times)
:vsp splits your screen as above – but vertically.
RUBY REFACTOR
---------------
:RAddParameter - Add Parameter
:RInlineTemp - Inline Temp
:RConvertPostConditional - Convert Post Conditional
:RExtractConstant - Extract Constant (visual selection)
:RExtractLet - Extract to Let (Rspec)
:RExtractLocalVariable - Extract Local Variable (visual selection)
:RRenameLocalVariable - Rename Local Variable (visual selection/variable under the cursor, *REQUIRES matchit.vim*)
:RRenameInstanceVariable - Rename Instance Variable (visual selection, *REQUIRES matchit.vim*)
:RExtractMethod - Extract Method (visual selection, *REQUIRES matchit.vim*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment