On Tuesday, May 24, 2011 20:05:02 Javier Rojas wrote: > On Tue, May 24, 2011 at 08:28:00PM -0400, Roy Fulbright wrote: > > I know this dates me, but back in the day I used to exclude > > all lines in the ISPF editor using X9999 and then use > > 'find' to display (unexclude) lines that matched the find > > criteria. I have been trying to do the same thing with Vim > > by folding all lines and searching, but my search unfolds > > all lines. Is there a way to search folded lines and have > > only matching lines unfolded?
> you can get sort-of what you want using a plugin, and the > quickfix window. > See, for example, the Bgrep plugin > http://www.vim.org/scripts/script.php?script_id=2545 > or this other script: > http://git.devnull.li/vim-jerojasro.git/blob_plain/HEAD:/local > -settings/plugin/BufGrep.vim > They will take a search pattern and create a list with the > matches (of the current buffer or buffers). You can see the > list using the :cwindow command. > See :help :vimgrep , and :help quickfix.txt or, more simply try the trick i snaggled off this list recently: nnoremap <silent> <Leader>o :setlocal foldexpr=(getline(v:lnum)=~@/)?0:(getline(v:lnum-1)=~@/)\\|\\| (getline(v:lnum+1)=~@/)?1:2 foldmethod=expr foldlevel=0 foldcolumn=2<CR> nnoremap <silent> <Leader>oo :call UnsetFolds()<CR> function! UnsetFolds() setlocal foldexpr=0 setlocal foldcolumn=0 endfunction which, for <Leader>o folds everything except what's in @/ (your last search item), and <Leader>oo unfolds everything -- i am finding this eminently useful -- it reminds me of the cms kedit 'all' command <rant> kedit blows (blew?) the doors off ISPF </rant> sc -- 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
