Commits

abudden committed 2b94223

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

Comments (0)

Files changed (1)

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,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.