On May 9, 3:43 pm, sinbad<[email protected]>    wrote:
i am using cscope quickfix. from the quickfix
results i want to browse thru the entries whose
filename or file path matches a specific pattern
how can i achieve this.

Do you want to eliminate non-matching entries from the list, or just not
switch to them?

just not switching to them will work for me too. i'm aware that there
are functions like getqflist() to
manipulate on the quickfix results. but i'm not too sure if i can
update that list. i thought there might
be some easier solutions that folks might aware of.

There was a recent thread where somebody wanted to jump between just
errors, or warnings, or info messages in qf, but the OP seems to have
gone AWOL. However, in that thread, I was thinking something along these
lines would work:

command! -nargs=1 QFNextRegex call QFNextRegex(<f-args>)
command! QFNextError call QFNextRegex('error:')
function! QFNextRegex(regex)
   " Gather info about the window state
   let l:winnr = winnr()
   let l:winrest = winrestcmd()
   let l:lastwin = winnr('$')
   " Use the error window to find the current error number
   copen
   let l:errnum = line('.') - 1
   " Restore the window state
   if l:lastwin != winnr('$')
      cclose
   endif
   exec l:winnr . "wincmd w"
   exe l:winrest
   " Get the quickfix list
   let l:qf = getqflist()
   " Find and go to the next matching item in the list
   let l:len = len(l:qf)
   let l:errnum += 1
   while l:errnum < l:len
      if l:qf[l:errnum]['text'] =~ a:regex
         exe "cc " . (l:errnum + 1)
         return
      endif
      let l:errnum += 1
   endwhile
   " Give error if not found (hardcoded to English error message)
   echoerr "E553: No more items"
endfunction

:QFNextError
:QFNextRegex \<mykeyword\>

I leave it as an exercise to produce the 'previous' version and/or
modify it to truly check the error type rather than just matching the
text and/or add commands for patterns useful to you. :-)

Ben.



--
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

Reply via email to