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

make gtags_cscope module available for nvim-0.9.0 #351

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
28 changes: 19 additions & 9 deletions autoload/gutentags/gtags_cscope.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
" gtags_cscope module for Gutentags

let s:cscope_native = 1

if !has('cscope')
throw "Can't enable the gtags-cscope module for Gutentags, "
\"this Vim has no support for cscope files."
if !has('nvim-0.9.0')
throw "Can't enable the gtags-cscope module for Gutentags, "
\"this Vim has no support for cscope files."
else
let s:cscope_native = 0
endif
endif

" Global Options {{{
Expand Down Expand Up @@ -36,12 +42,14 @@ let s:added_db_files = {}

function! s:add_db(db_file) abort
if filereadable(a:db_file)
call gutentags#trace(
\"Adding cscope DB file: " . a:db_file)
set nocscopeverbose
execute 'cs add ' . fnameescape(a:db_file)
set cscopeverbose
let s:added_db_files[a:db_file] = 1
call gutentags#trace(
\"Adding cscope DB file: " . a:db_file)
if s:cscope_native
set nocscopeverbose
execute 'cs add ' . fnameescape(a:db_file)
set cscopeverbose
endif
let s:added_db_files[a:db_file] = 1
else
call gutentags#trace(
\"Not adding cscope DB file because it doesn't " .
Expand All @@ -62,7 +70,9 @@ function! gutentags#gtags_cscope#init(project_root) abort

let b:gutentags_files['gtags_cscope'] = l:db_file

execute 'set cscopeprg=' . fnameescape(g:gutentags_gtags_cscope_executable)
if s:cscope_native
execute 'set cscopeprg=' . fnameescape(g:gutentags_gtags_cscope_executable)
endif

" The combination of gtags-cscope, vim's cscope and global files is
" a bit flaky. Environment variables are safer than vim passing
Expand Down