<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: Tag vim</title>
    <link>http://blog.objectmentor.com/articles/tag/vim</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>VIM as a Diff/Merge Tool</title>
      <description>&lt;p&gt;Do you need a really quick, clean, powerful diff/merge tool that you can use in windows, mac, and various Unixen?  As a happy and pround &lt;a href="http://vim.org"&gt;vim&lt;/a&gt; user, I have been enjoying &lt;a href="http://www.vim.org/htmldoc/diff.html"&gt;vimdiff&lt;/a&gt; for a number of years.&lt;/p&gt;


&lt;pre&gt;
        &amp;gt; gvim -d file1 file2
        &amp;gt; vimdiff file1 file2
&lt;/pre&gt;

	&lt;p&gt;(G)vimdiff is wonderful. You can move changes between two versions of a file with
great ease (if you know vim) and amazing speed. It can handle files of any size and does a fine job of syncing up both versions.&lt;/p&gt;


	&lt;p&gt;Vim can do just about anything. I have learned that no matter how much I use and study Vim I still am just scratching the surface of what the editor can do.  I find little tricks and configuration options, new keystrokes, and fun little bits of minutae.  I think it&amp;#8217;s all new.  With my memory, sometimes I just &lt;strong&gt;think&lt;/strong&gt; something is new, and have to go check my &lt;a href="http://tottinge.blogsome.com/use-vim-like-a-pro/"&gt;past notes&lt;/a&gt; to see if I already knew it.&lt;/p&gt;


Today I (re)learned about diffopt, which makes gvimdiff more wonderful. 
&lt;pre&gt;
    :set diffopt=filler
&lt;/pre&gt;
By default, diffopt is set to &amp;#8220;filler&amp;#8221;.  Filler doesn&amp;#8217;t do much, it
just adds vertical spaces to keep the text of the left and right
pane aligned.  It&amp;#8217;s a good setting, and I don&amp;#8217;t much like working
without it.  But there are other settings which are overlooked, 
even by experts.
&lt;pre&gt;
    : set diffopt+=iwhite
&lt;/pre&gt;
My second favorite is &amp;#8216;iwhite&amp;#8217;, which stands for &amp;#8220;ignore whitespace&amp;#8221;.
It makes gvimdiff ignore leading, trailing, and embedded spaces so
that simple acts like retabbing or deleting vertical spaces won&amp;#8217;t 
obscure actual changes.   It really helps you to merge changes in 
situations where you&amp;#8217;ve adopted code that was built to entirely different
standards. 
&lt;pre&gt;
    :set diffopt+=icase
&lt;/pre&gt;
iCase ignores capitalization, which is not as useful as the other options, since programmers are normally interested in case, but it may be handy when someone has corrected and reformatted &lt;span class="caps"&gt;SQL&lt;/span&gt;.  I don&amp;#8217;t expect to use it much.
&lt;pre&gt;
    :set diffopt+=horizontal
&lt;/pre&gt;
The last interesting bit is the choice between vertical splits (the normal case) and horizontal splits (for very long lines on cinema-aspect screens).  I hope to never  need this option again, but I have needed to deal with absurdly long lines.

	&lt;p&gt;If you can use &lt;span class="caps"&gt;VIM&lt;/span&gt; at all, you will find vim&amp;#8217;s diffmode to be a very powerful and  useful tool.  If you can&amp;#8217;t use vim already, then maybe vimdiff will be the reason you will learn vim.&lt;/p&gt;</description>
      <pubDate>Wed, 30 Apr 2008 21:24:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:87ede884-c19a-4ab9-9a04-9b074bb32c86</guid>
      <author>Tim Ottinger</author>
      <link>http://blog.objectmentor.com/articles/2008/04/30/vim-as-a-diff-merge-tool</link>
      <category>Tim's Tepid Torrent</category>
      <category>vim</category>
      <category>diff</category>
      <category>vimdiff</category>
      <category>diffopt</category>
    </item>
  </channel>
</rss>
