aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2014-11-13 22:52:57 +0100
committerPeter Odding <peter@peterodding.com>2014-11-13 22:52:57 +0100
commit075ffe9054dd71f8c2f26fe9cfa4fd5200e6af96 (patch)
treee4da170dea4aac838a9fb8397537046e713ecdb1
parent706c6650f3af2f44352f2d0dfc64be5727e1c097 (diff)
downloadvim-easytags-075ffe9054dd71f8c2f26fe9cfa4fd5200e6af96.tar.gz
Add g:easytags_opts option (issue #98)
See also issue #98 on GitHub: https://github.com/xolox/vim-easytags/issues/98
-rw-r--r--README.md4
-rw-r--r--autoload/xolox/easytags.vim26
-rw-r--r--autoload/xolox/easytags/filetypes.vim9
-rw-r--r--doc/easytags.txt44
4 files changed, 57 insertions, 26 deletions
diff --git a/README.md b/README.md
index 29ad0e5..ba1d6ea 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim
index b9b27cd..ea0fd22 100644
--- a/autoload/xolox/easytags.vim
+++ b/autoload/xolox/easytags.vim
@@ -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 = '\>'
@@ -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
@@ -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?
diff --git a/autoload/xolox/easytags/filetypes.vim b/autoload/xolox/easytags/filetypes.vim
index aef073a..4749a9d 100644
--- a/autoload/xolox/easytags/filetypes.vim
+++ b/autoload/xolox/easytags/filetypes.vim
@@ -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
@@ -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
diff --git a/doc/easytags.txt b/doc/easytags.txt
index d1789a2..6c1a5a6 100644
--- a/doc/easytags.txt
+++ b/doc/easytags.txt
@@ -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|
@@ -187,6 +188,15 @@ 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