diff options
author | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:11:56 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:11:56 +0200 |
commit | 9931e0888b2419326ae10ebbfae532261c5c125f (patch) | |
tree | 7504be5daccbb7b7d1ea396754de47b11ed790e5 /vim/bundle/tlib_vim/autoload/tlib/var.vim | |
parent | e573b3020c032400eed60b649a2cbf55266e6bb0 (diff) | |
download | myconfigs-9931e0888b2419326ae10ebbfae532261c5c125f.tar.gz myconfigs-9931e0888b2419326ae10ebbfae532261c5c125f.tar.bz2 myconfigs-9931e0888b2419326ae10ebbfae532261c5c125f.zip |
Fix submodules
Diffstat (limited to 'vim/bundle/tlib_vim/autoload/tlib/var.vim')
m--------- | vim/bundle/tlib_vim | 0 | ||||
-rwxr-xr-x | vim/bundle/tlib_vim/autoload/tlib/var.vim | 83 |
2 files changed, 0 insertions, 83 deletions
diff --git a/vim/bundle/tlib_vim b/vim/bundle/tlib_vim new file mode 160000 +Subproject 5636472e5dba1a4104376ce6bd93cc2546e0248 diff --git a/vim/bundle/tlib_vim/autoload/tlib/var.vim b/vim/bundle/tlib_vim/autoload/tlib/var.vim deleted file mode 100755 index dcd9264..0000000 --- a/vim/bundle/tlib_vim/autoload/tlib/var.vim +++ /dev/null @@ -1,83 +0,0 @@ -" @Author: Tom Link (micathom AT gmail com?subject=[vim]) -" @Website: http://www.vim.org/account/profile.php?user_id=4037 -" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 30 - - -" Define a variable called NAME if yet undefined. -" You can also use the :TLLet command. -" -" EXAMPLES: > -" exec tlib#var#Let('g:foo', 1) -" TLet g:foo = 1 -function! tlib#var#Let(name, val) "{{{3 - return printf('if !exists(%s) | let %s = %s | endif', string(a:name), a:name, string(a:val)) - " return printf('if !exists(%s) | let %s = %s | endif', string(a:name), a:name, a:val) -endf - - -" :def: function! tlib#var#EGet(var, namespace, ?default='') -" Retrieve a variable by searching several namespaces. -" -" EXAMPLES: > -" let g:foo = 1 -" let b:foo = 2 -" let w:foo = 3 -" echo eval(tlib#var#EGet('foo', 'vg')) => 1 -" echo eval(tlib#var#EGet('foo', 'bg')) => 2 -" echo eval(tlib#var#EGet('foo', 'wbg')) => 3 -function! tlib#var#EGet(var, namespace, ...) "{{{3 - let pre = [] - let post = [] - for namespace in split(a:namespace, '\zs') - let var = namespace .':'. a:var - call add(pre, printf('exists("%s") ? %s : (', var, var)) - call add(post, ')') - endfor - let default = a:0 >= 1 ? a:1 : '' - return join(pre) . string(default) . join(post) -endf - - -" :def: function! tlib#var#Get(var, namespace, ?default='') -" Retrieve a variable by searching several namespaces. -" -" EXAMPLES: > -" let g:foo = 1 -" let b:foo = 2 -" let w:foo = 3 -" echo tlib#var#Get('foo', 'bg') => 1 -" echo tlib#var#Get('foo', 'bg') => 2 -" echo tlib#var#Get('foo', 'wbg') => 3 -function! tlib#var#Get(var, namespace, ...) "{{{3 - let var_ = substitute(a:var, '#', '_', 'g') - for namespace in split(a:namespace, '\zs') - let vname = namespace == 'g' ? a:var : var_ - let var = namespace .':'. vname - if exists(var) - return {var} - endif - endfor - return a:0 >= 1 ? a:1 : '' -endf - - -" :def: function! tlib#var#List(rx, ?prefix='') -" Get a list of variables matching rx. -" EXAMPLE: -" echo tlib#var#List('tlib_', 'g:') -function! tlib#var#List(rx, ...) "{{{3 - TVarArg ['prefix', 'g:'] - if v:version >= 704 - exec 'let varlist = keys('. prefix .')' - else - redir => vars - silent! exec 'let '. prefix - redir END - let varlist = split(vars, '\n') - call map(varlist, 'matchstr(v:val, ''^\S\+'')') - endif - call filter(varlist, 'v:val =~ a:rx') - return varlist -endf - |