Reputation: 1380
Folding feature with syntax method is pretty well, and it can used to make a kind of "function list". But if I want to find a function name with '/', vim will locate the cursor on the folded line to indicate that candidate is in folded contents. Can I avoid this behavior?
Upvotes: 0
Views: 36
Reputation: 172600
If you want the fold to open to show the obscured match, you have to restore the default behavior via
:set foldopen+=search
If you want to jump over (effectively ignoring) matches inside folds, that can be done with a mapping variant of the n
ext search match command which checks for a closed fold and then re-invokes itself:
:nnoremap ,n n:if foldclosed('.') != -1<Bar>execute 'normal ,n'<Bar>endif<CR>
:nnoremap ,N N:if foldclosed('.') != -1<Bar>execute 'normal ,N'<Bar>endif<CR>
Upvotes: 1