Skip to content

Instantly share code, notes, and snippets.

@keeperofthenecklace
Last active December 30, 2015 09:29
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/7809639 to your computer and use it in GitHub Desktop.
Save keeperofthenecklace/7809639 to your computer and use it in GitHub Desktop.
CTRL Ww moves you from window to window (
CTRL WT moves current window into a tab
t (While in nerdtree) opens the file in a tab.
gt Goes to next tab.
gT Goes to previous tab.
\n Toggles the NerdTree on or off.
Command T - find in project.
df [character] deletes to character, eg df_ will delete to the next underscore
VIEWS
---------
CTRL S = <%= %> erb tags
CTRL S - <% -%> erb tags
CTRL S # <%# %> erb tags
GO TO A CONTROLLER. NOW FIND THE MODEL
----------------------------------
:Rmodel user
:Rcontroller application
:Rhelper navigation
:Rview sessions/new
:Rfunctionaltest sessions
:Runittest user
:Rmodel
:Rcontroller
:Renvironment
:Rfixtures
:Rhelper
:Rjavascript
:Rlayout
:Rlib
:Rmailer
:Rmigration
:Rmodel
:Robserver
:Rtask
:Rview
:Rspec
:Rfind file-name will take you to the file directly.
:Rgenerate (options) same as rails generate in terminal.
:Rdestroy (options) same as rails destroy in terminal.
PANE
---------
: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
gf – go to related file depending on where your cursor is (see :R above)
CTRL Wgf same as above but in a new tab
CTRL Wf same as above but in new split window.
RAKE
-------
:Rake task-name runs the rake task
NERDTREE
--------
:NERDTreeFind will show you the location of the file you are in.
While in NERDTree, press m for menu – then you can add/delete/rename etc
Command-Shift-F find in project (though you need ‘Ack’ for this to work – on Mac, install with brew install ack) Thanks to Chris for this tip!
:sp splits your screen (can be used multiple times)
:vsp splits your screen as above – but vertically.
Be sure to check out the ‘Learning Vim’ link below – there, I post tips on how you can master the basics of Vim, easily and quickly.
vim
yy p (yanks and paste)
dd delete
http://vim.wikia.com/wiki/Search_and_replace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment