comparison autoload/gutentags.vim @ 180:8bac4b955c84

Merge pull request #117 from GitHub.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 23 Mar 2017 16:00:24 -0700
parents 721cba3cd20d 411f3fa915f5
children 2489b4b54d5c
comparison
equal deleted inserted replaced
176:3d7f2bf017fd 180:8bac4b955c84
1 " gutentags.vim - Automatic ctags management for Vim 1 " gutentags.vim - Automatic ctags management for Vim
2 2
3 " Utilities {{{ 3 " Utilities {{{
4
5 function! gutentags#pwd()
6 if has('nvim')
7 return haslocaldir() ? getcwd(0, 0) : haslocaldir(-1, 0) ? getcwd(-1, 0) : getcwd()
8 else
9 return haslocaldir() ? getcwd(0, 0) : getcwd()
10 endif
11 endfunction
12 4
13 function! gutentags#chdir(path) 5 function! gutentags#chdir(path)
14 if has('nvim') 6 if has('nvim')
15 let chdir = haslocaldir() ? 'lcd' : haslocaldir(-1, 0) ? 'tcd' : 'cd' 7 let chdir = haslocaldir() ? 'lcd' : haslocaldir(-1, 0) ? 'tcd' : 'cd'
16 else 8 else
400 endif 392 endif
401 393
402 " Switch to the project root to make the command line smaller, and make 394 " Switch to the project root to make the command line smaller, and make
403 " it possible to get the relative path of the filename to parse if we're 395 " it possible to get the relative path of the filename to parse if we're
404 " doing an incremental update. 396 " doing an incremental update.
405 let l:prev_cwd = gutentags#pwd() 397 let l:prev_cwd = getcwd()
406 call gutentags#chdir(fnameescape(l:proj_dir)) 398 call gutentags#chdir(fnameescape(l:proj_dir))
407 try 399 try
408 call call("gutentags#".a:module."#generate", 400 call call("gutentags#".a:module."#generate",
409 \[l:proj_dir, l:tags_file, a:write_mode]) 401 \[l:proj_dir, l:tags_file, a:write_mode])
410 catch /^gutentags\:/ 402 catch /^gutentags\:/