Commits

abudden committed cc8cee5

Added customisation of wildcards for each individual search file type. Changed name of explicit current and file directory option. Don't run read hooks if not reading types for this file.

Comments (0)

Files changed (3)

autoload/TagHighlight/Find.vim

 " Option structure:
 "
 " [gb]:TagHighlightSettings:
-"	DefaultDirModePriority:[Explicit,UpFromCurrent,UpFromFile,CurrentExplicit,FileExplicit]
+"	DefaultDirModePriority:[Explicit,UpFromCurrent,UpFromFile,CurrentDirectory,FileDirectory]
 "	TagFileDirModePriority:["Default"] or as above
 "	TypesFileDirModePriority:As tag file
 "	ConfigFileDirModePriority:As tag file
-"	DirModeSearchWildcard:'' (look for tags file) or something specific (*.uvopt)?
+"	DefaultDirModeSearchWildcard:'' (look for tags file) or something specific (*.uvopt)?
 "
 " Explicit Locations:
 "
 function! TagHighlight#Find#LocateFile(which, suffix)
 	" a:which is 'TAGS', 'TYPES', 'CONFIG'
 	let default_priority = TagHighlight#Option#GetOption('DefaultDirModePriority')
+	let default_search_wildcards = TagHighlight#Option#GetOption('DefaultDirModeSearchWildcards')
 
 	let file = '<afile>'
 	if len(expand(file)) == 0
 		let filename = TagHighlight#Option#GetOption('TagFileName')
 		let search_priority = TagHighlight#Option#GetOption('TagFileDirModePriority')
 		let explicit_location = TagHighlight#Option#GetOption('TagFileDirectory')
+		let search_wildcards = TagHighlight#Option#GetOption('TagFileSearchWildcards')
 	elseif a:which == 'TYPES'
 		let filename = TagHighlight#Option#GetOption('TypesFilePrefix') . '_' .
 					\ a:suffix . "." .
 					\ TagHighlight#Option#GetOption('TypesFileExtension')
 		let search_priority = TagHighlight#Option#GetOption('TypesFileDirModePriority')
 		let explicit_location = TagHighlight#Option#GetOption('TypesFileDirectory')
+		let search_wildcards = TagHighlight#Option#GetOption('TypesFileSearchWildcards')
 	elseif a:which == 'CONFIG'
 		" Suffix is ignored here
 		let filename = TagHighlight#Option#GetOption('ProjectConfigFileName')
 		let search_priority = TagHighlight#Option#GetOption('ProjectConfigFileDirModePriority')
 		let explicit_location = TagHighlight#Option#GetOption('ProjectConfigFileDirectory')
+		let search_wildcards = TagHighlight#Option#GetOption('ProjectConfigFileSearchWildcards')
 	else
 		throw "Unrecognised file"
 	endif
 
-	let search_wildcards = TagHighlight#Option#GetOption('DirModeSearchWildcards')
+	if search_wildcards[0] == 'Default'
+		let search_wildcards = default_search_wildcards
+	endif
 
 	if search_priority[0] == 'Default'
 		let search_priority = default_priority
 			if has_key(result, 'Directory')
 				let result['Filename'] = filename
 			endif
-		elseif search_mode == 'CurrentExplicit'
+		elseif search_mode == 'CurrentDirectory'
 			let result['Directory'] = fnamemodify(file,':p:h')
 			let result['Filename'] = filename
-		elseif search_mode == 'FileExplicit'
+		elseif search_mode == 'FileDirectory'
 			let result['Directory'] = fnamemodify(file,':p:h')
 			let result['Filename'] = filename
 		endif

autoload/TagHighlight/ReadTypes.vim

 
 	let fullname = expand(file . ':p')
 
-	" Call Pre Read hooks (if any)
-	let preread_hooks = TagHighlight#Option#GetOption('PreReadHooks')
-	for preread_hook in preread_hooks
-		exe 'call' preread_hook . '(fullname, a:suffix)'
-	endfor
-
 	let skiplist = TagHighlight#Option#GetOption('ParsingSkipList')
 	if len(skiplist) > 0
 		let basename = expand(file . ':p:t')
 			return
 		endif
 	endif
+	"
+	" Call Pre Read hooks (if any)
+	let preread_hooks = TagHighlight#Option#GetOption('PreReadHooks')
+	for preread_hook in preread_hooks
+		exe 'call' preread_hook . '(fullname, a:suffix)'
+	endfor
 
 	call TagHighlight#Debug#Print("Searching for types file", 'Status')
 

plugin/TagHighlight/data/options.txt

 def_dir_mode_priority:
 	VimOptionMap:DefaultDirModePriority
 	Type:list
-	Default:Explicit,UpFromCurrent,UpFromFile,CurrentExplicit,FileExplicit
+	Default:Explicit,UpFromFile,CurrentDirectory
 	Help:List of methods (in order) to use when searching for tags/types etc
 
 config_file_name:
 	Default:None
 	Help:Explicitly specified location for project config file (corresponding to Explicit search mode)
 
-dir_mode_search_wildcards:
-	VimOptionMap:DirModeSearchWildcards
+default_dir_mode_search_wildcards:
+	VimOptionMap:DefaultDirModeSearchWildcards
 	Type:list
 	Default:OPT(TagFileName),OPT(ProjectConfigFileName)
 	Help:When searching directories, wildcards to match against (if any matches, we'll use this directory)
 
+config_dir_mode_search_wildcards:
+	VimOptionMap:ProjectConfigFileSearchWildcards
+	Type:list
+	Default:Default
+	Help:When searching directories for project config files, wildcards to match against (if any matches, we'll use this directory)
+
+tag_dir_mode_search_wildcards:
+	VimOptionMap:TagFileSearchWildcards
+	Type:list
+	Default:Default
+	Help:When searching directories for tag files, wildcards to match against (if any matches, we'll use this directory)
+
+types_dir_mode_search_wildcards:
+	VimOptionMap:TypesFileDirModeSearchWildcards
+	Type:list
+	Default:Default
+	Help:When searching directories for types files, wildcards to match against (if any matches, we'll use this directory)
+
 ctags_executable:
 	VimOptionMap:CtagsExecutable
 	Type:string