[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
make gtags.vim work for any dir
From: |
Andrey Butirsky |
Subject: |
make gtags.vim work for any dir |
Date: |
Tue, 22 Jan 2019 17:55:54 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Thunderbird/65.0 |
Hello,
Vim is capable to handle tags even if your current directory is not
within the project, because it can deal with the path of
the current file:
http://vimdoc.sourceforge.net/htmldoc/tagsrch.html#tags-option
I tried to achieve similar capability for GNU GLOBAL.
Here is what I've got:
--- /usr/share/gtags/gtags.vim 2018-07-19 08:25:46.000000000 +0300
+++ /home/bam/.vim/plugin/gtags.vim 2019-01-22 06:13:10.221680075 +0300
@@ -212,7 +212,7 @@
"
let s:global_command = $GTAGSGLOBAL
if s:global_command == ''
- let s:global_command = "global"
+ let s:global_command = "'cd ' . expand('%:h:S') . ' && global -a'"
endif
" Open the Gtags output window. Set this variable to zero, to not open
" the Gtags output window by default. You can open it manually by using
@@ -400,7 +400,7 @@
if l:isfile == 1
let l:cmd = s:global_command . ' ' . l:option . ' ' .
g:Gtags_Shell_Quote_Char . a:pattern . g:Gtags_Shell_Quote_Char
else
- let l:cmd = s:global_command . ' ' . l:option . 'e ' .
g:Gtags_Shell_Quote_Char . a:pattern . g:Gtags_Shell_Quote_Char
+ exe 'let l:cmd =' s:global_command ". ' ' . l:option . 'e ' .
g:Gtags_Shell_Quote_Char . a:pattern . g:Gtags_Shell_Quote_Char"
endif
let l:result = system(l:cmd)
Would love to hear your suggestions/comments!
- make gtags.vim work for any dir,
Andrey Butirsky <=
- Re: make gtags.vim work for any dir, Shigio YAMAGUCHI, 2019/01/23
- Re: make gtags.vim work for any dir, Andrey Butirsky, 2019/01/23
- Re: make gtags.vim work for any dir, Shigio YAMAGUCHI, 2019/01/23
- Re: make gtags.vim work for any dir, Andrey Butirsky, 2019/01/23
- Re: make gtags.vim work for any dir, Shigio YAMAGUCHI, 2019/01/23
- Re: make gtags.vim work for any dir, Andrey Butirsky, 2019/01/24
- Re: make gtags.vim work for any dir, Andrey Butirsky, 2019/01/24
- Re: make gtags.vim work for any dir, Andrey Butirsky, 2019/01/24
- Re: make gtags.vim work for any dir, Andrey Butirsky, 2019/01/24
- Re: make gtags.vim work for any dir, Andrey Butirsky, 2019/01/24