adding new stuff
This commit is contained in:
parent
f84d7183aa
commit
9ef8a96f9a
1580 changed files with 0 additions and 0 deletions
40
plugins/bundle/vim-powerline/autoload/Pl/Mod.vim
Normal file
40
plugins/bundle/vim-powerline/autoload/Pl/Mod.vim
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
let s:segment_mods = []
|
||||
|
||||
function! Pl#Mod#AddSegmentMod(action, properties) " {{{
|
||||
call add(s:segment_mods, [a:action, a:properties])
|
||||
endfunction " }}}
|
||||
function! Pl#Mod#ApplySegmentMods(theme) " {{{
|
||||
let theme = deepcopy(a:theme)
|
||||
|
||||
for mod in s:segment_mods
|
||||
let [action, properties] = mod
|
||||
|
||||
" We have to loop through the segments instead of using index() because some
|
||||
" segments are lists!
|
||||
let target_seg_idx = -1
|
||||
|
||||
for i in range(0, len(theme) - 1)
|
||||
unlet! segment
|
||||
let segment = theme[i]
|
||||
|
||||
if type(segment) == type(properties.target_segment) && segment == properties.target_segment
|
||||
let target_seg_idx = i
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if action == 'insert_segment'
|
||||
" Insert segment
|
||||
if target_seg_idx != -1
|
||||
call insert(theme, properties.new_segment, (properties.where == 'before' ? target_seg_idx : target_seg_idx + 1))
|
||||
endif
|
||||
elseif action == 'remove_segment'
|
||||
" Remove segment
|
||||
if target_seg_idx != -1
|
||||
call remove(theme, target_seg_idx)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return theme
|
||||
endfunction " }}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue