X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;ds=sidebyside;f=.vim%2Fautoload%2Fcharacterize.vim;h=1c053748cefe39649bbb05ca15178e5b0a646c0e;hb=2be76ed436fada8dffc368a0544575eb69098431;hp=68b419ce80d86861e9d67d4900527d8375ffdc46;hpb=35806d7bf72724acdea0c3d7269f5ffd38eb0479;p=profile.git diff --git a/.vim/autoload/characterize.vim b/.vim/autoload/characterize.vim index 68b419c..1c05374 100644 --- a/.vim/autoload/characterize.vim +++ b/.vim/autoload/characterize.vim @@ -1,6 +1,8 @@ " autoload/characterize.vim " Maintainer: Tim Pope +unlet! s:digraphs + if exists("g:autoloaded_characterize") || &cp finish endif @@ -9,24 +11,26 @@ let g:autoloaded_characterize = 1 scriptencoding utf-8 function! characterize#digraphs(...) abort - redir => out - silent digraphs - redir END - redraw - let digraphs = {} - for line in split(out, '\n') - for entry in split(line, " \\d\\+\\zs\\s\\+") - let nr = matchstr(entry, '\d\+$') - if nr ==# '10' && len(digraphs) <= 1 - let nr = 0 - endif - if !has_key(digraphs, nr) - let digraphs[nr] = [] - endif - let digraphs[nr] += [matchstr(entry, '^..')] + if !exists('s:digraphs') + redir => out + silent digraphs + redir END + redraw + let s:digraphs = {} + for line in split(out, '\n') + for entry in split(line, " \\d\\+\\zs\\s*") + let nr = matchstr(entry, '\d\+$') + if nr ==# '10' && len(s:digraphs) <= 1 + let nr = 0 + endif + if !has_key(s:digraphs, nr) + let s:digraphs[nr] = [] + endif + let s:digraphs[nr] += [matchstr(entry, '^..')] + endfor endfor - endfor - return a:0 ? get(digraphs, a:1, []) : digraphs + endif + return a:0 ? get(s:digraphs, a:1, []) : s:digraphs endfunction function! characterize#html_entity(nr) abort