Commits

abudden committed 2b94223

Minor optimisation of GetOption to remove the search for options in the list (fixes #61).

  • Participants
  • Parent commits 405a93b

Comments (0)

Files changed (1)

File autoload/TagHighlight/Option.vim

 	endif
 
 	let g:TagHighlightPrivate['PluginOptions'] = []
+	let g:TagHighlightPrivate['FullOptionList'] = []
 	let options = TagHighlight#LoadDataFile#LoadDataFile('options.txt')
 
 	for option_dest in keys(options)
 			let option = deepcopy(options[option_dest])
 			let option['Destination'] = option_dest
 			let g:TagHighlightPrivate['PluginOptions'] += [option]
+			let g:TagHighlightPrivate['FullOptionList'] += [option['VimOptionMap']]
 		endif
 	endfor
+
 endfunction
 
 function! TagHighlight#Option#GetOption(name)
 	call TagHighlight#Option#LoadOptions()
 
 	" Check this option exists
-	let found = 0
-	for option in g:TagHighlightPrivate['PluginOptions']
-		if option['VimOptionMap'] == a:name
-			let found = 1
-			break
-		endif
-	endfor
-	if ! found
+	let opt_index = index(g:TagHighlightPrivate['FullOptionList'], a:name)
+	if opt_index < 0
 		throw "Unrecognised option:" .a:name
 	endif
+	let option = g:TagHighlightPrivate['PluginOptions'][opt_index]
 
 	" Option priority (highest first):
 	" * buffer dictionary,