comparison autoload/gutentags.vim @ 244:d3f9a92399d1

Separate the default project marker finder into a function. This lets people who write custom marker finders fallback to the default behaviour if needed.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 13 Mar 2019 21:56:19 -0700
parents 050d0549ecf3
children 97723c1818e0
comparison
equal deleted inserted replaced
243:050d0549ecf3 244:d3f9a92399d1
182 " file path. 182 " file path.
183 function! gutentags#get_project_root(path) abort 183 function! gutentags#get_project_root(path) abort
184 if g:gutentags_project_root_finder != '' 184 if g:gutentags_project_root_finder != ''
185 return call(g:gutentags_project_root_finder, [a:path]) 185 return call(g:gutentags_project_root_finder, [a:path])
186 endif 186 endif
187 187 return gutentags#default_get_project_root(a:path)
188 endfunction
189
190 " Default implementation for finding project markers... useful when a custom
191 " finder (`g:gutentags_project_root_finder`) wants to fallback to the default
192 " behaviour.
193 function! gutentags#default_get_project_root(path) abort
188 let l:path = gutentags#stripslash(a:path) 194 let l:path = gutentags#stripslash(a:path)
189 let l:previous_path = "" 195 let l:previous_path = ""
190 let l:markers = g:gutentags_project_root[:] 196 let l:markers = g:gutentags_project_root[:]
191 if g:gutentags_add_ctrlp_root_markers && exists('g:ctrlp_root_markers') 197 if g:gutentags_add_ctrlp_root_markers && exists('g:ctrlp_root_markers')
192 for crm in g:ctrlp_root_markers 198 for crm in g:ctrlp_root_markers