diff options
Diffstat (limited to 'autoload/digraph_search.vim')
-rw-r--r-- | autoload/digraph_search.vim | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/autoload/digraph_search.vim b/autoload/digraph_search.vim index 172b17c..46b10a3 100644 --- a/autoload/digraph_search.vim +++ b/autoload/digraph_search.vim @@ -2,27 +2,27 @@ function! digraph_search#Search() abort " Get the search string - let l:search = input('Digraph search: ') - if !strlen(l:search) + let search = input('Digraph search: ') + if !strlen(search) return endif " Look for the uppercased search in the table - let l:results = [] - for l:digraph in digraph_search#Digraphs() - if stridx(l:digraph['name'], toupper(l:search)) != -1 - call add(l:results, l:digraph) + let results = [] + for digraph in digraph_search#Digraphs() + if stridx(digraph['name'], toupper(search)) != -1 + call add(results, digraph) endif endfor " Print results, or if there weren't any, say so redraw - echo 'Digraphs matching '.toupper(l:search).':' - if len(l:results) - for l:result in l:results - echo l:result['char'] - \.' '.l:result['keys'] - \.' '.l:result['name'] + echo 'Digraphs matching '.toupper(search).':' + if len(results) + for result in results + echo result['char'] + \.' '.result['keys'] + \.' '.result['name'] endfor else echo 'None!' @@ -36,19 +36,19 @@ function! digraph_search#Digraphs() abort " We haven't been called yet; get the digraph list if !exists('s:digraphs') let s:digraphs = [] - let l:table = 0 - for l:line in readfile($VIMRUNTIME.'/doc/digraph.txt') + let table = 0 + for line in readfile($VIMRUNTIME.'/doc/digraph.txt') " Flag whether we're in one of the digraph tables; look for the heading - let l:table = l:table && strlen(l:line) - \ || l:line =~# '\C\*digraph-table\%(-mbyte\)\=\*$' + let table = table && strlen(line) + \ || line =~# '\C\*digraph-table\%(-mbyte\)\=\*$' " Skip to next line if not in a table - if !l:table + if !table continue endif " Check whether this row matches a parseable digraph row - let l:match = matchlist(l:line, + let match = matchlist(line, \ '^\(\S\)\+\s\+' \ . '\(\S\S\)\s\+' \ . '\%(0x\)\=\x\+\s\+' @@ -56,15 +56,15 @@ function! digraph_search#Digraphs() abort \ . '\(.\+\)' \ ) " Skip to next line if not a table row match - if !len(l:match) + if !len(match) continue endif " Add to the digraphs list; key is digraph, value is full name call add(s:digraphs, { - \ 'char': l:match[1], - \ 'keys': l:match[2], - \ 'name': l:match[3], + \ 'char': match[1], + \ 'keys': match[2], + \ 'name': match[3], \ }) endfor endif |