From 515e951bfe36ccf814a3d37ed0d9dd6cf6f545f8 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 9 Dec 2012 22:09:57 -0500 Subject: [PATCH] make vimrc grep function more generic, projects can define symbols --- vimrc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/vimrc b/vimrc index 677e50f..b8ef366 100644 --- a/vimrc +++ b/vimrc @@ -134,19 +134,17 @@ function! LoadProject() endif endfunction -function! FindSymbolInProjectSources(...) +function! FindSymbolInSources(sources, ...) if a:0 > 0 let sym = a:1 else let sym = expand("") endif - if exists("b:project_sources") - exec 'vimgrep /\<' . sym . '\>/gj ' . b:project_sources + exec 'vimgrep /\<' . sym . '\>/gj ' . a:sources + let n_matches = len(getqflist()) + if n_matches == 0 + cclose + else + echomsg "Found " . n_matches . " matches" endif endfunction - -"============================================================================== -" Commands -"============================================================================== - -command! -nargs=? Cf call FindSymbolInProjectSources()