Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let path of tags customizable #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/srcexpl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ g:SrcExpl_updateTagsCmd *g:SrcExpl_updateTagsCmd*

Default: "ctags --sort=foldcase -R ."

g:SrcExpl_tagsPath *g:SrcExpl_tagsPath*
This is the path which Source Explorer will attempt to load tags. It
can be either relative path or absolute path.

Default: "tags"


------------------------------------------------------------------------------
KEY MAPPINGS *srcexpl-key-mappings*

Expand Down
17 changes: 12 additions & 5 deletions plugin/srcexpl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ if !exists('g:SrcExpl_updateTagsCmd')
let g:SrcExpl_updateTagsCmd = 'ctags --sort=foldcase -R .'
endif

" User interface to specify the tags file location
" relative path or absolute path, 'tags' as default
if !exists('g:SrcExpl_tagsPath')
let g:SrcExpl_tagsPath = "tags"
endif


" User interface to update tags file artificially
if !exists('g:SrcExpl_updateTagsKey')
let g:SrcExpl_updateTagsKey = ''
Expand Down Expand Up @@ -367,7 +374,7 @@ function! g:SrcExpl_UpdateTags()
" Call the external 'ctags' utility program
exe "!" . g:SrcExpl_updateTagsCmd
" Rejudge the tags file if existed
if !filereadable("tags")
if !filereadable(g:SrcExpl_tagsPath)
" Tell them what happened
call <SID>SrcExpl_ReportErr("Execute 'ctags' utility program failed")
return -1
Expand All @@ -384,7 +391,7 @@ function! g:SrcExpl_UpdateTags()
" Found one successfully
else
" Is the tags file in the current directory ?
if tagfiles()[0] ==# "tags"
if tagfiles()[0] ==# g:SrcExpl_tagsPath
" Prompt the current work directory
echohl Question
echo "SrcExpl: Updating 'tags' file in (". expand('%:p:h') . ")"
Expand Down Expand Up @@ -1077,7 +1084,7 @@ function! <SID>SrcExpl_ListMultiDefs(list, len)
endif

" Is the tags file in the current directory ?
if tagfiles()[0] ==# "tags"
if tagfiles()[0] ==# g:SrcExpl_tagsPath
" We'll get the operating system environment
" in order to judge the slash type
if s:SrcExpl_isWinOS == 1
Expand Down Expand Up @@ -1164,7 +1171,7 @@ function! <SID>SrcExpl_ViewOneDef(fpath, excmd)

" The tags file is in the current directory and it
" should be generated by 'ctags --sort=foldcase -R .'
if tagfiles()[0] ==# "tags" && a:fpath[0] == '.'
if tagfiles()[0] ==# g:SrcExpl_tagsPath && a:fpath[0] == '.'
call <SID>SrcExpl_WinEdit(expand('%:p:h') . '/' . a:fpath)
" Up to other directories
else
Expand Down Expand Up @@ -1493,7 +1500,7 @@ function! <SID>SrcExpl_Init()
" Auto change current work directory
exe "set autochdir"
" Let Vim find the possible tags file
exe "set tags=tags;"
let &tags = g:SrcExpl_tagsPath
" Set the actual update time according to user's requirement
" 100 milliseconds by default
exe "set updatetime=" . string(g:SrcExpl_refreshTime)
Expand Down