On 2008-10-23 10:46-0700, Aman Jain wrote:
>
>Hi
>
>I was wondering if there's a way to see the output of any command,
>straight inside vim, rather than first redirecting it into  a file and
>then opening that file.
>
>E.x. I need something like
>$  gvim < `diff -r dir1/ dir2/`
>This gives ambiguous redirect error message
>
>I just want to see the diffs between dir1 and dir2 straight inside
>gvim.
>
>Can any one provide a nice hack?

This sounds like what you want:

     diff -r dir1/ dir2/ | vim -

The filename "-" tells Vim to read from stdin until EOF. One of my favorite
hacks with this is to set Vim as my pager. I put the following settings in my
.bashrc and .vimrc. Note that unlike many other Vim PAGER settings, this one
works with man pages (avoids circular aliasing; allows following referenced man
pages; handles both platforms where the man is run in a subshell and where man
is executed directly without a subshell):

     export PAGER="/bin/sh -c \"unset PAGER;col -b -x | \
     vim -R -c 'set ft=man nomod nolist' \
     -c 'map q :q<CR>' \
     -c 'map <SPACE> <C-D>' \
     -c 'map b <C-U>' \
     -c 'nmap K :Man <C-R>=expand(\\\"<cword>\\\")<CR><CR>' \
     -\""

AND you must put this at the top of your .vimrc:

     " Unset PAGER environment variable. This works with the PAGER in
     " .profile or .bashrc. Avoids recursive Vim execs when using
     " Vim's Man command.
     let $PAGER=''

By the way, there is a DirDiff plugin for Vim that I found to be very
helpful. It's come to my rescue many times. See:

     http://www.vim.org/scripts/script.php?script_id=102

-- 
  Noah Spurrier | email:[EMAIL PROTECTED] | 
http://www.noah.org/wiki/engineering 
----------------------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to