add ignore_paths argument to QNameFileInit()

This commit is contained in:
Josh Holtrop 2014-08-08 12:06:51 -04:00
parent 2209a9b67b
commit c5725d98b0
2 changed files with 11 additions and 3 deletions

View File

@ -30,7 +30,7 @@ let g:qnamefile_regexp = 0
" Find all files from path of the given extension ignoring hidden files
" a:path Where to start searching from
" a:extensions A space separated list of extensions to filter on (e.g. "java cpp h")
function! QNameFileInit(path, extensions, include_hidden)
function! QNameFileInit(path, extensions, include_hidden, ignore_paths)
let path = a:path
if path != ""
let path = ""
@ -51,8 +51,16 @@ function! QNameFileInit(path, extensions, include_hidden)
if !a:include_hidden
let hidden = '-not -regex ".*/\..*"'
endif
let ignore_paths = [".git", ".svn"]
if a:ignore_paths != ""
let ignore_paths = ignore_paths + split(a:ignore_paths, ",")
end
let ignore = ""
for ignore_path in ignore_paths
let ignore = ignore . " -name " . ignore_path . " -prune -o"
endfor
"let ofnames = sort(split(system('find ' . a:path . ' -type f ' . hidden . ' ' . ext . ' -print'), "\n"))
let ofnames = sort(split(system('find ' . path . ' -name .git -prune -o -name .svn -prune -o -not -type f -o -print'), "\n"))
let ofnames = sort(split(system('find ' . path . ignore . " -not -type f -o -print"), "\n"))
let g:cmd_arr = map(ofnames, "fnamemodify(v:val, ':.')")
call QNamePickerStart(g:cmd_arr, {
\ "complete_func": function("QNameFileCompletion"),

2
vimrc
View File

@ -81,7 +81,7 @@ nnoremap <Leader>s m`:%s/\v\s+$//<CR>``
nnoremap <Leader>w :tab :tag <C-R><C-W><CR>
" re-indent the following line how vim would automatically do it
nnoremap <Leader>j Ji<CR><Esc>
nmap <Leader>f :call QNameFileInit(".", "", 1)<CR>:~
nmap <Leader>f :call QNameFileInit(".", "", 1, "Build")<CR>:~
nnoremap <C-N> :cnext<CR>
nnoremap <C-P> :cprev<CR>