mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-12 09:35:40 +08:00
feat(gtags): add ctags_bin
option
This commit is contained in:
parent
08089d68e0
commit
07f8b5bba5
@ -30,6 +30,7 @@ scriptencoding utf-8
|
|||||||
" adding entries. same as |g:gtags_open_list|
|
" adding entries. same as |g:gtags_open_list|
|
||||||
" 3. `gtagslabel`: the backend of gtags command, you can use `ctags` or
|
" 3. `gtagslabel`: the backend of gtags command, you can use `ctags` or
|
||||||
" `pygments`. It is empty string by default.
|
" `pygments`. It is empty string by default.
|
||||||
|
" 4. `ctags_bin`: set the command or path of ctags, default is 'ctags'
|
||||||
|
|
||||||
if exists('s:gtagslabel')
|
if exists('s:gtagslabel')
|
||||||
finish
|
finish
|
||||||
@ -87,6 +88,9 @@ function! SpaceVim#layers#gtags#set_variable(var) abort
|
|||||||
let g:gtags_open_list = get(a:var,
|
let g:gtags_open_list = get(a:var,
|
||||||
\ 'open_quickfix',
|
\ 'open_quickfix',
|
||||||
\ g:gtags_open_list)
|
\ g:gtags_open_list)
|
||||||
|
let g:gtags_ctags_bin = get(a:var,
|
||||||
|
\ 'ctags_bin',
|
||||||
|
\ 'ctags')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#gtags#health() abort
|
function! SpaceVim#layers#gtags#health() abort
|
||||||
@ -97,7 +101,7 @@ endfunction
|
|||||||
|
|
||||||
function! SpaceVim#layers#gtags#get_options() abort
|
function! SpaceVim#layers#gtags#get_options() abort
|
||||||
|
|
||||||
return ['gtagslabel']
|
return ['gtagslabel', 'ctags_bin']
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -8,14 +8,19 @@
|
|||||||
|
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
|
|
||||||
let s:LOGGER =SpaceVim#logger#derive('ctags')
|
if exists('g:loaded_ctags')
|
||||||
|
|
||||||
if !executable('ctags')
|
|
||||||
call s:LOGGER.warn('ctags is not executable, you need to install ctags')
|
|
||||||
finish
|
finish
|
||||||
endif
|
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
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -45,7 +50,7 @@ endfunction
|
|||||||
|
|
||||||
function! ctags#update(...) abort
|
function! ctags#update(...) abort
|
||||||
if !s:version_checked
|
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_stdout': funcref('s:version_std_out'),
|
||||||
\ 'on_exit': funcref('s:version_exit'),
|
\ 'on_exit': funcref('s:version_exit'),
|
||||||
\ })
|
\ })
|
||||||
@ -55,7 +60,7 @@ function! ctags#update(...) abort
|
|||||||
call s:LOGGER.info('update ctags database for ' . project_root)
|
call s:LOGGER.info('update ctags database for ' . project_root)
|
||||||
let dir = s:FILE.unify_path(g:tags_cache_dir)
|
let dir = s:FILE.unify_path(g:tags_cache_dir)
|
||||||
\ . s:FILE.path_to_fname(project_root)
|
\ . s:FILE.path_to_fname(project_root)
|
||||||
let cmd = ['ctags']
|
let cmd = [g:gtags_ctags_bin]
|
||||||
if s:is_u_ctags
|
if s:is_u_ctags
|
||||||
let cmd += ['-G']
|
let cmd += ['-G']
|
||||||
endif
|
endif
|
||||||
|
@ -16,7 +16,6 @@ if !exists('g:gtags_silent')
|
|||||||
let g:gtags_silent = 1
|
let g:gtags_silent = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
""
|
""
|
||||||
" General form of Gtags command is as follows:
|
" General form of Gtags command is as follows:
|
||||||
" >
|
" >
|
||||||
|
@ -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|
|
adding entries. same as |g:gtags_open_list|
|
||||||
3. `gtagslabel`: the backend of gtags command, you can use `ctags` or
|
3. `gtagslabel`: the backend of gtags command, you can use `ctags` or
|
||||||
`pygments`. It is empty string by default.
|
`pygments`. It is empty string by default.
|
||||||
|
4. `ctags_bin`: set the command or path of ctags, default is 'ctags'
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
INCSEARCH *SpaceVim-layers-incsearch*
|
INCSEARCH *SpaceVim-layers-incsearch*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user