Saturday, January 30, 2010

Re: filter output to scratch buffer

sab, 30 Jan 2010, bill lam skribis:
> ven, 29 Jan 2010, Bob Hiestand skribis:
> > On Thu, Jan 28, 2010 at 9:50 PM, bill lam <cbill.lam@gmail.com> wrote:
> > > I map F5 to search dictionary with
> > >
> > > nmap <F5> :!dict <cword> <CR>
> > >
> > > The output is quite long and also it may contain some info that I
> > > would like to copy.  Is it possible to redirect the output to a new
> > > scratch buffer?
> >
> > You could do something like the following:
> >
> > :nmap <F5> :let dictScratch=system('dict ' .
> > expand('<cword>'))<CR>:new<CR>:0put =dictScratch<CR>:set
> > buftype=nofile<CR>
>
> Thank you Bob, it works nicely.

That position at the bottom of buffer, I added an extra 0<CR> to bring
the cursor to the first line.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

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

No comments:

Post a Comment