> when using cscope with quickfix, if a file has multile matches, each> match 
> will show in the quickfix and each match has filename in the> beginning.>> 
> Could the result be grouped by files, so basically if multiple matches> are 
> in one file I want the filename show up just once.
I think function below should do the trick (you need to execute in the
quickfix window):

function! FoldFiles()
    normal zE
    let lnum = 1
    let currFname = ''
    let foldStart = 1
    let foldEnd = 0
    while lnum <= line('$')
        let line = getline(lnum)
        let fnamePos = stridx(line, '|')
        if fnamePos > -1
            let fname = strpart(line, 0, fnamePos)
            if fname == currFname
                let foldEnd = lnum
            else " new file name
                if foldEnd > 0
                    exec foldStart.','.foldEnd.'fold'
                endif
                let currFname = fname
                let foldStart = lnum
                let foldEnd = lnum
            endif
        endif
        let lnum += 1
    endwhile
    if foldStart > 0 && foldEnd > 0
        exec foldStart.','.foldEnd.'fold'
    endif
endfunction

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