From 075ffe9054dd71f8c2f26fe9cfa4fd5200e6af96 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Thu, 13 Nov 2014 22:52:57 +0100 Subject: Add g:easytags_opts option (issue #98) See also issue #98 on GitHub: https://github.com/xolox/vim-easytags/issues/98 --- autoload/xolox/easytags.vim | 26 +++++++++++++++++++++----- autoload/xolox/easytags/filetypes.vim | 9 +++++---- 2 files changed, 26 insertions(+), 9 deletions(-) (limited to 'autoload') 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 -" 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 -" 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 -- cgit v1.2.3