1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:10:06 +08:00

feat(gtags): add ctags_bin option

This commit is contained in:
wsdjeg 2022-04-05 15:25:20 +08:00
parent 08089d68e0
commit 07f8b5bba5
4 changed files with 18 additions and 9 deletions

View File

@ -30,6 +30,7 @@ scriptencoding utf-8
" adding entries. same as |g:gtags_open_list|
" 3. `gtagslabel`: the backend of gtags command, you can use `ctags` or
" `pygments`. It is empty string by default.
" 4. `ctags_bin`: set the command or path of ctags, default is 'ctags'
if exists('s:gtagslabel')
finish
@ -87,6 +88,9 @@ function! SpaceVim#layers#gtags#set_variable(var) abort
let g:gtags_open_list = get(a:var,
\ 'open_quickfix',
\ g:gtags_open_list)
let g:gtags_ctags_bin = get(a:var,
\ 'ctags_bin',
\ 'ctags')
endfunction
function! SpaceVim#layers#gtags#health() abort
@ -97,7 +101,7 @@ endfunction
function! SpaceVim#layers#gtags#get_options() abort
return ['gtagslabel']
return ['gtagslabel', 'ctags_bin']
endfunction

View File

@ -8,14 +8,19 @@
scriptencoding utf-8
let s:LOGGER =SpaceVim#logger#derive('ctags')
if !executable('ctags')
call s:LOGGER.warn('ctags is not executable, you need to install ctags')
if exists('g:loaded_ctags')
finish
endif
if exists('g:loaded_ctags')
let s:LOGGER =SpaceVim#logger#derive('ctags')
if !exists('g:gtags_ctags_bin')
let g:gtags_ctags_bin = 'ctags'
endif
if !executable(g:gtags_ctags_bin)
call s:LOGGER.warn(g:gtags_ctags_bin . ' is not executable, you need to install ctags')
finish
endif
@ -45,7 +50,7 @@ endfunction
function! ctags#update(...) abort
if !s:version_checked
call s:JOB.start(['ctags', '--version'], {
call s:JOB.start([g:gtags_ctags_bin, '--version'], {
\ 'on_stdout': funcref('s:version_std_out'),
\ 'on_exit': funcref('s:version_exit'),
\ })
@ -55,7 +60,7 @@ function! ctags#update(...) abort
call s:LOGGER.info('update ctags database for ' . project_root)
let dir = s:FILE.unify_path(g:tags_cache_dir)
\ . s:FILE.path_to_fname(project_root)
let cmd = ['ctags']
let cmd = [g:gtags_ctags_bin]
if s:is_u_ctags
let cmd += ['-G']
endif

View File

@ -16,7 +16,6 @@ if !exists('g:gtags_silent')
let g:gtags_silent = 1
endif
""
" General form of Gtags command is as follows:
" >

View File

@ -2057,6 +2057,7 @@ The layer option can be used when loading the `gtags` layer, for example:
adding entries. same as |g:gtags_open_list|
3. `gtagslabel`: the backend of gtags command, you can use `ctags` or
`pygments`. It is empty string by default.
4. `ctags_bin`: set the command or path of ctags, default is 'ctags'
==============================================================================
INCSEARCH *SpaceVim-layers-incsearch*