Skip to content

Commit

Permalink
Add g:easytags_opts option (issue #98)
Browse files Browse the repository at this point in the history
See also issue #98 on GitHub:
  #98
  • Loading branch information
xolox committed Nov 13, 2014
1 parent 706c665 commit 075ffe9
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 26 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ The plug-in will try to determine the location where Exuberant Ctags is installe

If you rely entirely on language-specific configuration and don't have a general ctags program, set this to the empty string.

### The `g:easytags_opts` option

If you need to pass custom command line option(s) to the program specified by `g:easytags_cmd` you can set this option to a list of strings to be passed to Exuberant Ctags. Make sure to only use options that are valid in any context, for example the concatenation of `g:easytags_cmd`, `g:easytags_opts` and `--list-languages` should work as expected.

### The `g:easytags_async` option

By default vim-easytags runs Exuberant Ctags and updates your tags file in the foreground, blocking Vim in the process. As your tags files get larger this becomes more annoying. It has been the number one complaint about vim-easytags since I published the first release online.
Expand Down
26 changes: 21 additions & 5 deletions autoload/xolox/easytags.vim
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
" Vim script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: November 3, 2014
" Last Change: November 13, 2014
" URL: http://peterodding.com/code/vim/easytags/

let g:xolox#easytags#version = '3.8.3'
let g:xolox#easytags#version = '3.9'
let g:xolox#easytags#default_pattern_prefix = '\C\<'
let g:xolox#easytags#default_pattern_suffix = '\>'

Expand Down Expand Up @@ -239,15 +239,17 @@ function! s:prep_cmdline(cfile, tagsfile, arguments) " {{{3
let custom_languages = xolox#misc#option#get('easytags_languages', {})
let language = get(custom_languages, vim_file_type, {})
if empty(language)
let program = xolox#misc#option#get('easytags_cmd')
let cmdline = [program, '--fields=+l', '--c-kinds=+p', '--c++-kinds=+p']
let cmdline = [xolox#easytags#ctags_command()]
call add(cmdline, '--fields=+l')
call add(cmdline, '--c-kinds=+p')
call add(cmdline, '--c++-kinds=+p')
call add(cmdline, '--sort=no')
call add(cmdline, '-f-')
if xolox#misc#option#get('easytags_include_members', 0)
call add(cmdline, '--extra=+q')
endif
else
let program = get(language, 'cmd', xolox#misc#option#get('easytags_cmd'))
let program = get(language, 'cmd', xolox#easytags#ctags_command())
if empty(program)
call xolox#misc#msg#warn("easytags.vim %s: No 'cmd' defined for language '%s', and also no global default!", g:xolox#easytags#version, vim_file_type)
return
Expand Down Expand Up @@ -431,6 +433,20 @@ let s:invalid_keywords = {

" Public supporting functions (might be useful to others). {{{1

function! xolox#easytags#ctags_command() " {{{2
let program = xolox#misc#option#get('easytags_cmd')
if !empty(program)
let options = xolox#misc#option#get('easytags_opts')
if !empty(options)
let command_line = [program]
call extend(command_line, map(copy(options), 'xolox#misc#escape#shell(v:val)'))
let program = join(command_line)
endif
return program
endif
return ''
endfunction

function! xolox#easytags#get_tagsfile() " {{{2
let tagsfile = ''
" Look for a suitable project specific tags file?
Expand Down
9 changes: 5 additions & 4 deletions autoload/xolox/easytags/filetypes.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
" Vim script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: October 21, 2014
" Last Change: November 13, 2014
" URL: http://peterodding.com/code/vim/easytags/

" This submodule of the vim-easytags plug-in translates between back and forth
Expand Down Expand Up @@ -87,10 +87,11 @@ function! s:discover_supported_filetypes() " {{{1
" Initialize predefined groups & mappings and discover supported file types.
if !s:discovered_filetypes
" Discover the file types supported by Exuberant Ctags?
if !empty(g:easytags_cmd)
let command_line = xolox#easytags#ctags_command()
if !empty(command_line)
let starttime = xolox#misc#timer#start()
let command = g:easytags_cmd . ' --list-languages'
for line in xolox#misc#os#exec({'command': command})['stdout']
let command_line .= ' --list-languages'
for line in xolox#misc#os#exec({'command': command_line})['stdout']
if line =~ '\[disabled\]$'
" Ignore languages that have been explicitly disabled using `--languages=-Vim'.
continue
Expand Down
44 changes: 27 additions & 17 deletions doc/easytags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@ Contents ~
2. The |:HighlightTags| command
4. Options |easytags-options|
1. The |g:easytags_cmd| option
2. The |g:easytags_async| option
3. The |g:easytags_syntax_keyword| option
4. The |g:easytags_languages| option
5. The |g:easytags_file| option
6. The |g:easytags_dynamic_files| option
7. The |g:easytags_by_filetype| option
8. The |g:easytags_events| option
9. The |g:easytags_always_enabled| option
10. The |g:easytags_on_cursorhold| option
11. The |g:easytags_updatetime_min| option
12. The |g:easytags_auto_update| option
13. The |g:easytags_auto_highlight| option
14. The |g:easytags_autorecurse| option
15. The |g:easytags_include_members| option
16. The |g:easytags_resolve_links| option
17. The |g:easytags_suppress_ctags_warning| option
18. The |g:easytags_suppress_report| option
2. The |g:easytags_opts| option
3. The |g:easytags_async| option
4. The |g:easytags_syntax_keyword| option
5. The |g:easytags_languages| option
6. The |g:easytags_file| option
7. The |g:easytags_dynamic_files| option
8. The |g:easytags_by_filetype| option
9. The |g:easytags_events| option
10. The |g:easytags_always_enabled| option
11. The |g:easytags_on_cursorhold| option
12. The |g:easytags_updatetime_min| option
13. The |g:easytags_auto_update| option
14. The |g:easytags_auto_highlight| option
15. The |g:easytags_autorecurse| option
16. The |g:easytags_include_members| option
17. The |g:easytags_resolve_links| option
18. The |g:easytags_suppress_ctags_warning| option
19. The |g:easytags_suppress_report| option
5. Customizing the easytags plug-in |customizing-easytags-plug-in|
1. Passing custom command line arguments to Exuberant Ctags |easytags-passing-custom-command-line-arguments-to-exuberant-ctags|
2. Update & highlight tags immediately after save |easytags-update-highlight-tags-immediately-after-save|
Expand Down Expand Up @@ -186,6 +187,15 @@ you've installed Exuberant Ctags, e.g.:
If you rely entirely on language-specific configuration and don't have a
general ctags program, set this to the empty string.

-------------------------------------------------------------------------------
The *g:easytags_opts* option

If you need to pass custom command line option(s) to the program specified by
|g:easytags_cmd| you can set this option to a list of strings to be passed to
Exuberant Ctags. Make sure to only use options that are valid in any context,
for example the concatenation of |g:easytags_cmd|, |g:easytags_opts| and
'--list-languages' should work as expected.

-------------------------------------------------------------------------------
The *g:easytags_async* option

Expand Down

0 comments on commit 075ffe9

Please sign in to comment.