Thursday, December 1, 2011

Re: suppress error?

On Dec 1, 12:01 am, "Christian Brabandt" <cbli...@256bit.org> wrote:
> On Thu, December 1, 2011 8:57 am, Bee wrote:
> > This function and its friend PrevDQ() work.
>
> > If I am diffing goes to next change, or if doing helpgrep will go to
> > the next.
>
> > When at the end of the helpgrep, it presents:
> > Error detected while processing function NextDQ:
> > line    4:
> > E553: No more items
> > Press ENTER or type command to continue
>
> > Can I suppress that message completely?
>
> >   function! NextDQ()
> >     if &diff
> >       normal! ]c
> >     else
> >       cn
> >       if v:version >= 700
> >         setlocal cursorline
> >       endif
> >     endif
> >   endfun
> >   nmap <F8> :call NextDQ()<cr>
>
> :h sil
>
> regards,
> Christian

Thank you Christian.
Not quite what I was looking for.
But this is:

function! CurLin()
if v:version >= 700 | setlocal cursorline
else | normal! zz
endif
endfun

function! PrevDQ() " Prev Diff or Quickfix
if &diff
normal! [c
else
try | cN
catch | clast
endtry | call CurLin()
endif
endfun
nmap <silent> <F7> :call PrevDQ()<cr>

function! NextDQ() " Next Diff or Quickfix
if &diff
normal! ]c
else
try | cn
catch | cfirst
endtry | call CurLin()
endif
endfun
nmap <silent> <F8> :call NextDQ()<cr>

-Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment