/0.md
Last active
August 29, 2015 14:02
Revisions
-
David Tuite revised this gist
Nov 5, 2014 . 2 changed files with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ # .vimrc Tips and Tricks This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,4 +18,8 @@ Run this macro with the cursor on the colon to get: my_method(hello: 'something') ``` You can do this to all hashes in a file at once with the following mapping: ```vim nnoremap <leader>s :%s/:\([a-z_]*\)\s=>/\1:/g<cr> ``` -
David Tuite revised this gist
May 30, 2014 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,6 @@ Run this macro with the cursor on the colon to get: ```ruby my_method(hello: 'something') ``` Note: [You can do this to all hashes in a file at once](https://gist.github.com/dtuite/e0b47456231754ca0b48). -
David Tuite revised this gist
May 30, 2014 . 2 changed files with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ Example: expect { something.run }.to raise_error ``` Run this macro with the cursor inside the braces and it will expand to: ```ruby expect do This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ ### Symbol Conversion ```VimL El3xi:^[bhx ``` Turn a rocket style symbol hash into Ruby 1.9 syntax. Example: ```ruby my_method(:hello => 'something') ``` Run this macro with the cursor on the colon to get: ```ruby my_method(hello: 'something') ``` -
David Tuite created this gist
May 30, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ ### Block Expansion ```VimL T{i<80>kbdo^M^[/}^Ms^Mend^[k ``` Turn a `{}` single line block into a `do..end` block. Example: ```ruby expect { something.run }.to raise_error ``` With the macro stored in the `d` register, place your cursor inside the curly braces and press `@d`. The braces will expand to: ```ruby expect do something.run end.to raise_error ```