Mercurial > vim-gutentags
comparison autoload/gutentags/cscope.vim @ 44:1a853b37eddf
Add some mostly-working Cscope module (for Windows).
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 20 Feb 2015 14:37:11 -0800 |
parents | |
children | 99b95da1bed7 |
comparison
equal
deleted
inserted
replaced
43:7000d598a2a7 | 44:1a853b37eddf |
---|---|
1 " Cscope module for Gutentags | |
2 | |
3 if !has('cscope') | |
4 throw "Can't enable the cscope module for Gutentags, this Vim has ". | |
5 \"no support for cscope files." | |
6 endif | |
7 | |
8 " Global Options {{{ | |
9 | |
10 if !exists('g:gutentags_cscope_executable') | |
11 let g:gutentags_cscope_executable = 'cscope' | |
12 endif | |
13 | |
14 if !exists('g:gutentags_scopefile') | |
15 let g:gutentags_scopefile = 'cscope.out' | |
16 endif | |
17 | |
18 if !exists('g:gutentags_auto_add_cscope') | |
19 let g:gutentags_auto_add_cscope = 1 | |
20 endif | |
21 | |
22 " }}} | |
23 | |
24 " Gutentags Module Interface {{{ | |
25 | |
26 let s:runner_exe = gutentags#get_plat_file('update_scopedb') | |
27 let s:added_dbs = [] | |
28 | |
29 function! gutentags#cscope#init(project_root) abort | |
30 let l:dbfile_path = gutentags#get_cachefile( | |
31 \a:project_root, g:gutentags_scopefile) | |
32 let b:gutentags_files['cscope'] = l:dbfile_path | |
33 | |
34 if g:gutentags_auto_add_cscope && filereadable(l:dbfile_path) | |
35 if index(s:added_dbs, l:dbfile_path) < 0 | |
36 call add(s:added_dbs, l:dbfile_path) | |
37 execute 'cs add ' . fnameescape(l:dbfile_path) | |
38 endif | |
39 endif | |
40 endfunction | |
41 | |
42 function! gutentags#cscope#generate(proj_dir, tags_file, write_mode) abort | |
43 let l:cmd = gutentags#get_execute_cmd() . s:runner_exe | |
44 let l:cmd .= ' -e ' . g:gutentags_cscope_executable | |
45 let l:cmd .= ' -p ' . a:proj_dir | |
46 let l:cmd .= ' -f ' . a:tags_file | |
47 let l:cmd .= ' ' | |
48 let l:cmd .= gutentags#get_execute_cmd_suffix() | |
49 | |
50 call gutentags#trace("Running: " . l:cmd) | |
51 call gutentags#trace("In: " . getcwd()) | |
52 if !g:gutentags_fake | |
53 if !g:gutentags_trace | |
54 silent execute l:cmd | |
55 else | |
56 execute l:cmd | |
57 endif | |
58 | |
59 let l:full_scopedb_file = fnamemodify(a:tags_file, ':p') | |
60 call gutentags#add_progress('cscope', l:full_scopedb_file) | |
61 else | |
62 call gutentags#trace("(fake... not actually running)") | |
63 endif | |
64 call gutentags#trace("") | |
65 endfunction | |
66 | |
67 " }}} | |
68 |