Skip to content

Instantly share code, notes, and snippets.

@dtuite
Last active August 29, 2015 14:02

Revisions

  1. David Tuite revised this gist Nov 5, 2014. 2 changed files with 6 additions and 1 deletion.
    1 change: 1 addition & 0 deletions 0.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    # .vimrc Tips and Tricks
    6 changes: 5 additions & 1 deletion symbol_conversion.md
    Original 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')
    ```

    Note: [You can do this to all hashes in a file at once](https://gist.github.com/dtuite/e0b47456231754ca0b48).
    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>
    ```
  2. David Tuite revised this gist May 30, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion symbol_conversion.md
    Original 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).
  3. David Tuite revised this gist May 30, 2014. 2 changed files with 20 additions and 1 deletion.
    2 changes: 1 addition & 1 deletion macros.md → expansion.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ Example:
    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:
    Run this macro with the cursor inside the braces and it will expand to:

    ```ruby
    expect do
    19 changes: 19 additions & 0 deletions symbol_conversion.md
    Original 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')
    ```
  4. David Tuite created this gist May 30, 2014.
    21 changes: 21 additions & 0 deletions macros.md
    Original 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
    ```