add ignore_paths argument to QNameFileInit()
This commit is contained in:
parent
2209a9b67b
commit
c5725d98b0
@ -30,7 +30,7 @@ let g:qnamefile_regexp = 0
|
|||||||
" Find all files from path of the given extension ignoring hidden files
|
" Find all files from path of the given extension ignoring hidden files
|
||||||
" a:path Where to start searching from
|
" a:path Where to start searching from
|
||||||
" a:extensions A space separated list of extensions to filter on (e.g. "java cpp h")
|
" 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
|
let path = a:path
|
||||||
if path != ""
|
if path != ""
|
||||||
let path = ""
|
let path = ""
|
||||||
@ -51,8 +51,16 @@ function! QNameFileInit(path, extensions, include_hidden)
|
|||||||
if !a:include_hidden
|
if !a:include_hidden
|
||||||
let hidden = '-not -regex ".*/\..*"'
|
let hidden = '-not -regex ".*/\..*"'
|
||||||
endif
|
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 ' . 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, ':.')")
|
let g:cmd_arr = map(ofnames, "fnamemodify(v:val, ':.')")
|
||||||
call QNamePickerStart(g:cmd_arr, {
|
call QNamePickerStart(g:cmd_arr, {
|
||||||
\ "complete_func": function("QNameFileCompletion"),
|
\ "complete_func": function("QNameFileCompletion"),
|
||||||
|
2
vimrc
2
vimrc
@ -81,7 +81,7 @@ nnoremap <Leader>s m`:%s/\v\s+$//<CR>``
|
|||||||
nnoremap <Leader>w :tab :tag <C-R><C-W><CR>
|
nnoremap <Leader>w :tab :tag <C-R><C-W><CR>
|
||||||
" re-indent the following line how vim would automatically do it
|
" re-indent the following line how vim would automatically do it
|
||||||
nnoremap <Leader>j Ji<CR><Esc>
|
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-N> :cnext<CR>
|
||||||
nnoremap <C-P> :cprev<CR>
|
nnoremap <C-P> :cprev<CR>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user