aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2011-06-27 02:45:14 +0200
committerPeter Odding <peter@peterodding.com>2011-06-27 02:45:14 +0200
commit0b1c06ef1d296590b23bbe4da46faeef6541a8ba (patch)
tree92553819cd6dcce48f3af69ad7557077c1ede24f
parente228b0e4e2cece3bbcbd3a752e7c718a455ab7c6 (diff)
downloadvim-easytags-0b1c06ef1d296590b23bbe4da46faeef6541a8ba.tar.gz
Bug fix and improvement for xolox#misc#option#get()
-rw-r--r--option.vim17
1 files changed, 10 insertions, 7 deletions
diff --git a/option.vim b/option.vim
index 8c6d63d..8727ea1 100644
--- a/option.vim
+++ b/option.vim
@@ -1,15 +1,18 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 26, 2011
+" Last Change: June 27, 2011
" URL: http://peterodding.com/code/vim/misc/
-function! xolox#misc#option#get(name, default)
- if exists('g:' . a:name)
- return eval('g:' . a:name)
- elseif exists('b:' . a:name)
+function! xolox#misc#option#get(name, ...)
+ if exists('b:' . a:name)
+ " Buffer local variable.
return eval('b:' . a:name)
- else
- return a:default
+ elseif exists('g:' . a:name)
+ " Global variable.
+ return eval('g:' . a:name)
+ elseif exists('a:1')
+ " Default value.
+ return a:1
endif
endfunction