Skip to content

Instantly share code, notes, and snippets.

@jiangtao
Last active August 29, 2015 14:18
Show Gist options
  • Save jiangtao/d2c504ea60050bcb8a17 to your computer and use it in GitHub Desktop.
Save jiangtao/d2c504ea60050bcb8a17 to your computer and use it in GitHub Desktop.

Revisions

  1. Matt Ratleph revised this gist Jan 22, 2013. 1 changed file with 16 additions and 47 deletions.
    63 changes: 16 additions & 47 deletions vimdiff.md
    Original file line number Diff line number Diff line change
    @@ -1,56 +1,25 @@
    # vimdiff cheat sheet

    ##git mergetool.
    ##git mergetool

    In the middle file (future merged file), you can navigate between conflicts with ]c and [c
    In the middle file (future merged file), you can navigate between conflicts with `]c` and `[c`.

    Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names)
    Choose which version you want to keep with `:diffget //2` or `:diffget //3` (the `//2` and `//3` are unique identifiers for the target/master copy and the merge/branch copy file names).

    :diffupdate (to remove leftover spacing issues)
    :diffupdate (to remove leftover spacing issues)
    :only (once you’re done reviewing all conflicts, this shows only the middle/merged file)
    :wq (save and quit)
    git add .
    git commit -m “Merge resolved”

    :only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

    :wq (save and quit)

    git add .

    git commit -m “Merge resolved”

    if you were trying to do a git pull when you ran into merge conflicts, type git rebase –continue

    ##vimdiff key mappings.

    ```
    " vimdiff diffget mappings.
    map <Leader>1 :diffget LOCAL<CR>
    map <Leader>2 :diffget BASE<CR>
    map <Leader>3 :diffget REMOTE<CR>
    ```
    If you were trying to do a `git pull` when you ran into merge conflicts, type `git rebase –continue`.

    ##vimdiff commands

    ```
    Commands:
    ]c : - next difference
    [c : - previous difference
    Ctrl+w +w - switch windows
    do - diff obtain
    dp - diff put
    zo - open folded text
    zc - close folded text
    :diffupdate - re-scan the files for differences
    MOVING BETWEEN WINDOWS
    CTRL-W h move to the window on the left
    CTRL-W j move to the window below
    CTRL-W k move to the window above
    CTRL-W l move to the window on the right
    CTRL-W t move to the TOP window
    CTRL-W b move to the BOTTOM window
    Moving windows
    CTRL-W K move window to the upper
    CTRL-W H move window to the far left
    CTRL-W J move window to the bottom
    CTRL-W L move window to the far right
    ```
    ]c : - next difference
    [c : - previous difference
    do - diff obtain
    dp - diff put
    zo - open folded text
    zc - close folded text
    :diffupdate - re-scan the files for differences
  2. Matt Ratleph revised this gist Jan 22, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions vimdiff.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Vimdiff cheat sheet
    # vimdiff cheat sheet

    ##Git mergetool.
    ##git mergetool.

    In the middle file (future merged file), you can navigate between conflicts with ]c and [c

    @@ -27,7 +27,7 @@ map <Leader>2 :diffget BASE<CR>
    map <Leader>3 :diffget REMOTE<CR>
    ```

    ##vimdiff Commands
    ##vimdiff commands

    ```
    Commands:
  3. Matt Ratleph revised this gist Jan 22, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vimdiff.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Vimdiff cheet sheets.
    # Vimdiff cheat sheet

    ##Git mergetool.

  4. Matt Ratleph renamed this gist Jan 22, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. Matt Ratleph revised this gist Nov 19, 2012. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions vimdiff_cheet.md
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,21 @@

    ##Git mergetool.

    ```
    $ git config --global merge.tool=vimdiff
    ```
    In the middle file (future merged file), you can navigate between conflicts with ]c and [c

    Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names)

    :diffupdate (to remove leftover spacing issues)

    :only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

    :wq (save and quit)

    git add .

    git commit -m “Merge resolved”

    if you were trying to do a git pull when you ran into merge conflicts, type git rebase –continue

    ##vimdiff key mappings.

  6. @roothybrid7 roothybrid7 revised this gist Nov 3, 2012. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions vimdiff_cheet.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,22 @@
    # Vimdiff cheet sheets.

    ##Git mergetool.

    ```
    $ git config --global merge.tool=vimdiff
    ```

    ##vimdiff key mappings.

    ```
    " vimdiff diffget mappings.
    map <Leader>1 :diffget LOCAL<CR>
    map <Leader>2 :diffget BASE<CR>
    map <Leader>3 :diffget REMOTE<CR>
    ```

    ##vimdiff Commands

    ```
    Commands:
    ]c : - next difference
  7. @roothybrid7 roothybrid7 revised this gist Nov 3, 2012. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions vimdiff_cheet.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,12 @@
    # Vimdiff cheet sheets.

    ```
    " vimdiff diffget mappings.
    map <Leader>1 :diffget LOCAL<CR>
    map <Leader>2 :diffget BASE<CR>
    map <Leader>3 :diffget REMOTE<CR>
    ```

    ```
    Commands:
    ]c : - next difference
  8. @roothybrid7 roothybrid7 created this gist Nov 3, 2012.
    27 changes: 27 additions & 0 deletions vimdiff_cheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # Vimdiff cheet sheets.

    ```
    Commands:
    ]c : - next difference
    [c : - previous difference
    Ctrl+w +w - switch windows
    do - diff obtain
    dp - diff put
    zo - open folded text
    zc - close folded text
    :diffupdate - re-scan the files for differences
    MOVING BETWEEN WINDOWS
    CTRL-W h move to the window on the left
    CTRL-W j move to the window below
    CTRL-W k move to the window above
    CTRL-W l move to the window on the right
    CTRL-W t move to the TOP window
    CTRL-W b move to the BOTTOM window
    Moving windows
    CTRL-W K move window to the upper
    CTRL-W H move window to the far left
    CTRL-W J move window to the bottom
    CTRL-W L move window to the far right
    ```