# HG changeset patch # User Ludovic Chabant # Date 1444429719 25200 # Node ID 0424970d81f8e4a58755ab83433cd051f939dd13 # Parent 96bfe5c37f3785f68c7ea8637add4cb6edecd936 Add a `g:gutentags_resolve_symlinks` option to resolve symlinks at setup time. diff -r 96bfe5c37f37 -r 0424970d81f8 autoload/gutentags.vim --- a/autoload/gutentags.vim Wed Aug 26 22:21:19 2015 -0700 +++ b/autoload/gutentags.vim Fri Oct 09 15:28:39 2015 -0700 @@ -110,7 +110,11 @@ " Try and find what tags file we should manage. call gutentags#trace("Scanning buffer '" . bufname('%') . "' for gutentags setup...") try - let b:gutentags_root = gutentags#get_project_root(expand('%:p:h', 1)) + let l:buf_dir = expand('%:p:h', 1) + if g:gutentags_resolve_symlinks + let l:buf_dir = fnamemodify(resolve(expand('%:p', 1)), ':p:h') + endif + let b:gutentags_root = gutentags#get_project_root(l:buf_dir) if filereadable(b:gutentags_root . '/.notags') call gutentags#trace("'notags' file found... no gutentags support.") return diff -r 96bfe5c37f37 -r 0424970d81f8 doc/gutentags.txt --- a/doc/gutentags.txt Wed Aug 26 22:21:19 2015 -0700 +++ b/doc/gutentags.txt Fri Oct 09 15:28:39 2015 -0700 @@ -329,6 +329,17 @@ project. This is handy to keep tags files from polluting many directories all across your computer. + *gutentags_resolve_symlinks* +g:gutentags_resolve_symlinks + When set to 1, Gutentags will resolve any symlinks in + the current buffer's path in order to find the project + it belongs to. This is what you want if you're editing + a symlink located outside of the project, and it + points to a file inside the project. However, this is + maybe not what you want if the symlink itself is + part of the project. + Defaults to 0. + *gutentags_define_advanced_commands* g:gutentags_define_advanced_commands Defines some advanced commands like diff -r 96bfe5c37f37 -r 0424970d81f8 plugin/gutentags.vim --- a/plugin/gutentags.vim Wed Aug 26 22:21:19 2015 -0700 +++ b/plugin/gutentags.vim Fri Oct 09 15:28:39 2015 -0700 @@ -54,6 +54,10 @@ let g:gutentags_exclude = [] endif +if !exists('g:gutentags_resolve_symlinks') + let g:gutentags_resolve_symlinks = 0 +endif + if !exists('g:gutentags_generate_on_new') let g:gutentags_generate_on_new = 1 endif