aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-09 15:32:55 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-09 15:32:55 +1200
commit8b957b771d319192a7789dfa93159afee385e4d4 (patch)
tree69800774b89bc9405ce568f31a5d281348c4acb8
parentSwitch to two-spacing (diff)
downloadvim-digraph-search-8b957b771d319192a7789dfa93159afee385e4d4.tar.gz
vim-digraph-search-8b957b771d319192a7789dfa93159afee385e4d4.zip
Remove unneeded variable scoping
-rw-r--r--autoload/digraph_search.vim44
-rw-r--r--plugin/digraph_search.vim4
2 files changed, 24 insertions, 24 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
diff --git a/plugin/digraph_search.vim b/plugin/digraph_search.vim
index 1d58d42..1923eb2 100644
--- a/plugin/digraph_search.vim
+++ b/plugin/digraph_search.vim
@@ -5,13 +5,13 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_digraph_search') || &compatible
+if exists('loaded_digraph_search') || &compatible
finish
endif
if !has('digraphs') || v:version < 700
finish
endif
-let g:loaded_digraph_search = 1
+let loaded_digraph_search = 1
" Set up mapping
inoremap <silent> <unique>