From 9931e0888b2419326ae10ebbfae532261c5c125f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 30 Jun 2016 16:11:56 +0200 Subject: Fix submodules --- vim/bundle/tlib_vim | 1 + vim/bundle/tlib_vim/autoload/tlib/string.vim | 172 --------------------------- 2 files changed, 1 insertion(+), 172 deletions(-) create mode 160000 vim/bundle/tlib_vim delete mode 100755 vim/bundle/tlib_vim/autoload/tlib/string.vim (limited to 'vim/bundle/tlib_vim/autoload/tlib/string.vim') diff --git a/vim/bundle/tlib_vim b/vim/bundle/tlib_vim new file mode 160000 index 0000000..5636472 --- /dev/null +++ b/vim/bundle/tlib_vim @@ -0,0 +1 @@ +Subproject commit 5636472e5dba1a4104376ce6bd93cc2546e02483 diff --git a/vim/bundle/tlib_vim/autoload/tlib/string.vim b/vim/bundle/tlib_vim/autoload/tlib/string.vim deleted file mode 100755 index 26b1f32..0000000 --- a/vim/bundle/tlib_vim/autoload/tlib/string.vim +++ /dev/null @@ -1,172 +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: 126 - - -" :def: function! tlib#string#RemoveBackslashes(text, ?chars=' ') -" Remove backslashes from text (but only in front of the characters in -" chars). -function! tlib#string#RemoveBackslashes(text, ...) "{{{3 - exec tlib#arg#Get(1, 'chars', ' ') - " TLogVAR chars - let rv = substitute(a:text, '\\\(['. chars .']\)', '\1', 'g') - return rv -endf - - -" :display: tlib#string#Chomp(string, ?max=0) -function! tlib#string#Chomp(string, ...) "{{{3 - let quant = a:0 >= 1 ? '\{,'. a:1 .'}' : '\+' - return substitute(a:string, '[[:cntrl:][:space:]]'. quant .'$', '', '') -endf - - -" Format a template string. Placeholders have the format "%{NAME}". A -" "%" can be inserted as "%%". -" -" Examples: -" echo tlib#string#Format("foo %{bar} foo", {'bar': 123}) -" => foo 123 foo -function! tlib#string#Format(template, dict) "{{{3 - let parts = split(a:template, '\ze%\({.\{-}}\|.\)') - let out = [] - for part in parts - let ml = matchlist(part, '^%\({\(.\{-}\)}\|\(.\)\)\(.*\)$') - if empty(ml) - let rest = part - else - let var = empty(ml[2]) ? ml[3] : ml[2] - let rest = ml[4] - if has_key(a:dict, var) - call add(out, a:dict[var]) - elseif var == '%%' - call add(out, '%') - else - call add(out, ml[1]) - endif - endif - call add(out, rest) - endfor - return join(out, '') -endf - - -" This function deviates from |printf()| in certain ways. -" Additional items: -" %{rx} ... insert escaped regexp -" %{fuzzyrx} ... insert typo-tolerant regexp -function! tlib#string#Printf1(format, string) "{{{3 - let s = split(a:format, '%.\zs') - " TLogVAR s - return join(map(s, 's:PrintFormat(v:val, a:string)'), '') -endf - -function! s:PrintFormat(format, string) "{{{3 - let cut = match(a:format, '%\({.\{-}}\|.\)$') - if cut == -1 - return a:format - else - let head = cut > 0 ? a:format[0 : cut - 1] : '' - let tail = a:format[cut : -1] - " TLogVAR head, tail - if tail == '%{fuzzyrx}' - let frx = [] - for i in range(len(a:string)) - if i > 0 - let pb = i - 1 - else - let pb = 0 - endif - let slice = tlib#rx#Escape(a:string[pb : i + 1]) - call add(frx, '['. slice .']') - call add(frx, '.\?') - endfor - let tail = join(frx, '') - elseif tail == '%{rx}' - let tail = tlib#rx#Escape(a:string) - elseif tail == '%%' - let tail = '%' - elseif tail == '%s' - let tail = a:string - endif - " TLogVAR tail - return head . tail - endif -endf -" function! tlib#string#Printf1(format, string) "{{{3 -" let n = len(split(a:format, '%\@ 0 -" let pb = i - 1 -" else -" let pb = 0 -" endif -" let slice = tlib#rx#Escape(a:string[pb : i + 1]) -" call add(frx, '['. slice .']') -" call add(frx, '.\?') -" endfor -" let f = s:RewriteFormatString(f, '%{fuzzyrx}', join(frx, '')) -" endif -" if f =~ '%\@= 1 ? a:1 : ',\s*' - let parts = split(a:text, '\\\@