make vimrc grep function more generic, projects can define symbols
This commit is contained in:
parent
33ce59d817
commit
515e951bfe
16
vimrc
16
vimrc
@ -134,19 +134,17 @@ function! LoadProject()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FindSymbolInProjectSources(...)
|
function! FindSymbolInSources(sources, ...)
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
let sym = a:1
|
let sym = a:1
|
||||||
else
|
else
|
||||||
let sym = expand("<cword>")
|
let sym = expand("<cword>")
|
||||||
endif
|
endif
|
||||||
if exists("b:project_sources")
|
exec 'vimgrep /\<' . sym . '\>/gj ' . a:sources
|
||||||
exec 'vimgrep /\<' . sym . '\>/gj ' . b:project_sources
|
let n_matches = len(getqflist())
|
||||||
|
if n_matches == 0
|
||||||
|
cclose
|
||||||
|
else
|
||||||
|
echomsg "Found " . n_matches . " matches"
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"==============================================================================
|
|
||||||
" Commands
|
|
||||||
"==============================================================================
|
|
||||||
|
|
||||||
command! -nargs=? Cf call FindSymbolInProjectSources(<f-args>)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user