On 17 December 2011 10:38, Sergey Khorev <[email protected]> wrote: >> 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
awesome! I still have two questions, how could I get rid of the automount(file system is network mounted) full path? I only want the path after src. also How could I execute this automatically when I use cscope and quickfix? Thanks much! Jim here is how it currently looks in cscope quickfix: 1 +-- 1 lines: /.automount/dfs7/root/vol/vol1/src/... 5 +-- 1 lines: /.automount/dfs7/root/vol/vol1/src/... 6 +-- 1 lines: /.automount/dfs7/root/vol/vol1/src/... 7 +-- 1 lines: /.automount/dfs7/root/vol/vol1/src/... -- 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
