Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 1.0: Initial upload

  • Loading branch information...
commit 5ce6e12c1cbd83bebd06b550ad2ab9b928db96b6 0 parents
@Soares Soares authored committed
Showing with 100 additions and 0 deletions.
  1. +7 −0 README
  2. +9 −0 README.md
  3. +35 −0 doc/tabdiff.vim
  4. +49 −0 plugin/tabdiff.vim
7 README
@@ -0,0 +1,7 @@
+This is a mirror of http://www.vim.org/scripts/script.php?script_id=4247
+
+Calling :TabDiff will open each pair of buffers in a vertically split tab and in diff mode. Now you can
+
+vim -c "silent :TabDiff" a A b B c C
+
+To diff a bunch of files at once in different tabs.
9 README.md
@@ -0,0 +1,9 @@
+# Vim TabDiff
+## A different way to vimdiff
+
+Gives you the tabdiff command, which will open all your pairs of buffers in
+opposing vertical splits in different tabs. Now you can
+
+ vim -c 'silent :TabDiff' A a B b C c
+
+And nicely diff all those files at once.
35 doc/tabdiff.vim
@@ -0,0 +1,35 @@
+*tabdiff.txt* Diff in Tabs
+
+Author: Nate Soares <http://so8r.es/>
+License: GPLv2 (http://www.gnu.org/licenses/gpl-2.0.html)
+
+INTRODUCTION *tabdiff*
+
+Diff many files in multiple tabs.
+
+COMMANDS *tabdiff-commands*
+
+ *tabdiff-:TabDiff*
+:TabDiff
+ Creates a new tab page for each consecutive pair of buffers
+ (split vertically, with the first on the left and the second
+ on the right) and sets all of the windows to diff mode. The
+ original tab page is closed.
+
+ Intended usage is to start vim with alternating 'old' and
+ 'new' files and then invoke this function immediately. It
+ expects there to be only one tab and an even number of
+ buffers, as in: >
+
+ vim -c 'silent :TabDiff' \
+ /tmp/original/apples apples \
+ /tmp/original/oranges oranges
+<
+
+ABOUT *tabdiff-about*
+
+Grab the latest version or report a bug on GitHub:
+
+http://github.com/Soares/butane.vim
+
+ vim:tw=78:ts=8:noet:ft=help:norl:
49 plugin/tabdiff.vim
@@ -0,0 +1,49 @@
+" tabdiff.vim A differetn way to diff.
+" Author: Laurence Gonsalves <laurence@xenomachia.com>
+" Maintainer: Nathaniel Soares <http://so8r.es/>
+" Version: 1.0
+" License: GPLv2 <http://www.gnu.org/licenses/gpl-2.0.html>
+
+if exists("g:loaded_tabdiff") || &cp || v:version < 700
+ finish
+endif
+let g:loaded_tabdiff = 1
+
+
+" Creates a new tab page for each consecutive pair of buffers (split
+" vertically, with first on left and second on right) and sets all of the
+" new windows to diff mode. The original tab page will also be closed.
+"
+" Intended usage is to start vim with alternating "old" and "new" files,
+" and then invoke this function. It expects there to be only one tab
+" open and 2*n buffers.
+"
+" Example:
+" gvim -c 'silent call TabDiff()' old-foo foo old-bar bar
+"
+" This will result in two tabs: old-foo+foo diff, and old-bar+bar diff.
+function! tabdiff#TabDiff()
+ let s:tab_multi_diff = 0
+ argdo call s:AddBufferToTab()
+ tabclose
+endfun
+command! TabDiff call tabdiff#TabDiff()
+
+
+" Helper function used by TabDiff(). Adds current buffer to new tab
+" or last tab as appropriate, and sets new window's "diff" option.
+function! s:AddBufferToTab()
+ let buf = bufnr("%")
+ if s:tab_multi_diff
+ tablast
+ vsplit
+ wincmd w
+ else
+ tab split
+ tabmove
+ endif
+ let s:tab_multi_diff = ! s:tab_multi_diff
+ exe 'b ' . buf
+ diffthis
+ tabfirst
+endfun
Please sign in to comment.
Something went wrong with that request. Please try again.