Add more plugins
git-svn-id: http://photonzero.com/dotfiles/trunk@85 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
parent
ee165a5f86
commit
01886340e4
105 changed files with 9388 additions and 0 deletions
60
.vim/bundle/vim-l9/autoload/l9/tempvariables.vim
Normal file
60
.vim/bundle/vim-l9/autoload/l9/tempvariables.vim
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
"=============================================================================
|
||||
" Copyright (C) 2010 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" TEMPORARY VARIABLES {{{1
|
||||
|
||||
"
|
||||
let s:origMap = {}
|
||||
|
||||
" set temporary variables
|
||||
function l9#tempvariables#set(group, name, value)
|
||||
if !exists('s:origMap[a:group]')
|
||||
let s:origMap[a:group] = {}
|
||||
endif
|
||||
if !exists('s:origMap[a:group][a:name]')
|
||||
let s:origMap[a:group][a:name] = eval(a:name)
|
||||
endif
|
||||
execute 'let ' . a:name . ' = a:value'
|
||||
endfunction
|
||||
|
||||
" set temporary variables
|
||||
function l9#tempvariables#setList(group, variables)
|
||||
for [name, value] in a:variables
|
||||
call l9#tempvariables#set(a:group, name, value)
|
||||
unlet value " to avoid E706
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" get temporary variables
|
||||
function l9#tempvariables#getList(group)
|
||||
if !exists('s:origMap[a:group]')
|
||||
return []
|
||||
endif
|
||||
return map(keys(s:origMap[a:group]), '[v:val, eval(v:val)]')
|
||||
endfunction
|
||||
|
||||
" restore original variables and clean up.
|
||||
function l9#tempvariables#end(group)
|
||||
if !exists('s:origMap[a:group]')
|
||||
return
|
||||
endif
|
||||
for [name, value] in items(s:origMap[a:group])
|
||||
execute 'let ' . name . ' = value'
|
||||
unlet value " to avoid E706
|
||||
endfor
|
||||
unlet s:origMap[a:group]
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" vim: set fdm=marker:
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue