We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e228b0e commit 0b1c06eCopy full SHA for 0b1c06e
option.vim
@@ -1,15 +1,18 @@
1
" Vim auto-load script
2
" Author: Peter Odding <peter@peterodding.com>
3
-" Last Change: June 26, 2011
+" Last Change: June 27, 2011
4
" URL: http://peterodding.com/code/vim/misc/
5
6
-function! xolox#misc#option#get(name, default)
7
- if exists('g:' . a:name)
8
- return eval('g:' . a:name)
9
- elseif exists('b:' . a:name)
+function! xolox#misc#option#get(name, ...)
+ if exists('b:' . a:name)
+ " Buffer local variable.
10
return eval('b:' . a:name)
11
- else
12
- return a:default
+ elseif exists('g:' . a:name)
+ " Global variable.
+ return eval('g:' . a:name)
13
+ elseif exists('a:1')
14
+ " Default value.
15
+ return a:1
16
endif
17
endfunction
18
0 commit comments