diff options
author | Peter Odding <peter@peterodding.com> | 2013-04-28 15:08:19 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2013-04-28 15:08:19 +0200 |
commit | a7ed49ed589cfe5f84bfeda317d03a874002e1a9 (patch) | |
tree | ad03ea51d3b2d9154e630c19f3dc2d68f1ddfbd7 /option.vim | |
parent | a744d4c5f0c6086251aab66ec68cb9299869b1e9 (diff) | |
download | vim-easytags-a7ed49ed589cfe5f84bfeda317d03a874002e1a9.tar.gz |
Change the repository layout to that of a proper Vim plug-in
Diffstat (limited to 'option.vim')
-rw-r--r-- | option.vim | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/option.vim b/option.vim deleted file mode 100644 index efaf1bc..0000000 --- a/option.vim +++ /dev/null @@ -1,84 +0,0 @@ -" Vim auto-load script -" Author: Peter Odding <peter@peterodding.com> -" Last Change: August 31, 2011 -" URL: http://peterodding.com/code/vim/misc/ - -function! xolox#misc#option#get(name, ...) - if exists('b:' . a:name) - " Buffer local variable. - return eval('b:' . a:name) - elseif exists('g:' . a:name) - " Global variable. - return eval('g:' . a:name) - elseif exists('a:1') - " Default value. - return a:1 - endif -endfunction - -" Functions to parse multi-valued Vim options like &tags and &runtimepath. - -function! xolox#misc#option#split(value) - let values = split(a:value, '[^\\]\zs,') - return map(values, 's:unescape(v:val)') -endfunction - -function! s:unescape(s) - return substitute(a:s, '\\\([\\,]\)', '\1', 'g') -endfunction - -function! xolox#misc#option#join(values) - let values = copy(a:values) - call map(values, 's:escape(v:val)') - return join(values, ',') -endfunction - -function! s:escape(s) - return escape(a:s, ',\') -endfunction - -function! xolox#misc#option#split_tags(value) - let values = split(a:value, '[^\\]\zs,') - return map(values, 's:unescape_tags(v:val)') -endfunction - -function! s:unescape_tags(s) - return substitute(a:s, '\\\([\\, ]\)', '\1', 'g') -endfunction - -function! xolox#misc#option#join_tags(values) - let values = copy(a:values) - call map(values, 's:escape_tags(v:val)') - return join(values, ',') -endfunction - -function! s:escape_tags(s) - return escape(a:s, ', ') -endfunction - -function! xolox#misc#option#eval_tags(value, ...) - let pathnames = [] - let first_only = exists('a:1') && a:1 - for pattern in xolox#misc#option#split_tags(a:value) - " Make buffer relative pathnames absolute. - if pattern =~ '^\./' - let directory = xolox#misc#escape#substitute(expand('%:p:h')) - let pattern = substitute(pattern, '^.\ze/', directory, '') - endif - " Make working directory relative pathnames absolute. - if xolox#misc#path#is_relative(pattern) - let pattern = xolox#misc#path#merge(getcwd(), pattern) - endif - " Ignore the trailing `;' for recursive upwards searching because we - " always want the most specific pathname available. - let pattern = substitute(pattern, ';$', '', '') - " Expand the pattern. - call extend(pathnames, split(expand(pattern), "\n")) - if first_only && !empty(pathnames) - return pathnames[0] - endif - endfor - return firstonly ? '' : pathnames -endfunction - -" vim: ts=2 sw=2 et |