Mercurial > vim-gutentags
comparison autoload/gutentags.vim @ 179:411f3fa915f5
Back to getcwd()
this makes changes only when changing dir, not when reading current working directory.
author | Henry Kupty <hkupty@gmail.com> |
---|---|
date | Mon, 13 Mar 2017 12:07:21 -0300 |
parents | c2e0dac0be42 |
children | 8bac4b955c84 |
comparison
equal
deleted
inserted
replaced
178:c2e0dac0be42 | 179:411f3fa915f5 |
---|---|
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 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\:/ |