Showing posts with label diff. Show all posts
Showing posts with label diff. Show all posts

Wednesday, November 6, 2013

Vim Gitgutter

Vim Gitgutter Vim Gitgutter shows a diff in the sign (left-hand) column of your editing window. This is a really cool way to see what portions of a file have changed without resorting to git diff.















Edit:
Droggl asked how to disable vim-gutter when viewing log files because of slowness. I've come up with the following solution which seems like it should work.

Assuming your log files end in *.log, add the following to your ~/.vimrc.
autocmd BufNewFile,BufReadPost *.log setlocal filetype=log
filetype plugin on
Then make an entry like so in ~/.vim/ftplugin/log.vim
:GitGutterDisable
Hope that helps!

Monday, September 14, 2009

Diffing From Inside Vim

To compare two files without resorting to launching vidiff from the command-line, you can do the following.

1) open one of the two files in a standard buffer
2) type in :vert diffsplit filename

Put the name of the file you'll be comparing in place of filename. Prefixing the command with vert gives you a vertical split. If you'd prefer a horizontal split, simply omit the vert.

Thursday, March 13, 2008

Reading STDIN

This is pretty basic, but it's also really useful. Vim can read standard input via a pipe at the end of any common command chain. I use Vim in conjunction with diff all the time to analyze the difference between two or more source files.

diff -u Scheduler.old.java Scheduler.java | vim -

Compare the difference of two source trees before submitting your patch:

diff -Naur oldtree newtree | vim -