11" Vim script
22" Author: Peter Odding <peter@peterodding.com>
3- " Last Change: June 14 , 2011
3+ " Last Change: June 18 , 2011
44" URL: http://peterodding.com/code/vim/easytags/
55
6- let s: script = ' easytags.vim'
7-
86" Public interface through (automatic) commands. {{{1
97
108function ! xolox#easytags#register (global ) " {{{2
@@ -59,7 +57,7 @@ function! xolox#easytags#autoload() " {{{2
5957 let b: easytags_last_highlighted = localtime ()
6058 endif
6159 catch
62- call xolox#misc#msg#warn (" %s: %s (at %s)" , s: script , v: exception , v: throwpoint )
60+ call xolox#misc#msg#warn (" easytags.vim %s: %s (at %s)" , g: easytags_version , v: exception , v: throwpoint )
6361 endtry
6462endfunction
6563
@@ -76,14 +74,14 @@ function! xolox#easytags#update(silent, filter_tags, filenames) " {{{2
7674 if ! firstrun
7775 let num_filtered = s: filter_merge_tags (a: filter_tags , tagsfile, output)
7876 if cfile != ' '
79- let msg = " %s: Updated tags for %s in %s."
80- call xolox#misc#timer#stop (msg, s: script , expand (' %:p:~' ), starttime)
77+ let msg = " easytags.vim %s: Updated tags for %s in %s."
78+ call xolox#misc#timer#stop (msg, g: easytags_version , expand (' %:p:~' ), starttime)
8179 elseif ! empty (a: filenames )
82- let msg = " %s: Updated tags in %s."
83- call xolox#misc#timer#stop (msg, s: script , starttime)
80+ let msg = " easytags.vim %s: Updated tags in %s."
81+ call xolox#misc#timer#stop (msg, g: easytags_version , starttime)
8482 else
85- let msg = " %s: Filtered %i invalid tags in %s."
86- call xolox#misc#timer#stop (msg, s: script , num_filtered, starttime)
83+ let msg = " easytags.vim %s: Filtered %i invalid tags in %s."
84+ call xolox#misc#timer#stop (msg, g: easytags_version , num_filtered, starttime)
8785 endif
8886 endif
8987 " When :UpdateTags was executed manually we'll refresh the dynamic
@@ -93,7 +91,7 @@ function! xolox#easytags#update(silent, filter_tags, filenames) " {{{2
9391 endif
9492 return 1
9593 catch
96- call xolox#misc#msg#warn (" %s: %s (at %s)" , s: script , v: exception , v: throwpoint )
94+ call xolox#misc#msg#warn (" easytags.vim %s: %s (at %s)" , g: easytags_version , v: exception , v: throwpoint )
9795 endtry
9896endfunction
9997
@@ -169,7 +167,7 @@ endfunction
169167function ! s: run_ctags (starttime, cfile , tagsfile, firstrun, cmdline) " {{{3
170168 let lines = []
171169 if a: cmdline != ' '
172- call xolox#misc#msg#debug (" %s: Executing %s" , s: script , a: cmdline )
170+ call xolox#misc#msg#debug (" easytags.vim %s: Executing %s. " , g: easytags_version , a: cmdline )
173171 try
174172 let lines = xolox#shell#execute (a: cmdline , 1 )
175173 catch /^Vim\%((\a\+)\)\=:E117/
@@ -183,9 +181,9 @@ function! s:run_ctags(starttime, cfile, tagsfile, firstrun, cmdline) " {{{3
183181 endtry
184182 if a: firstrun
185183 if a: cfile != ' '
186- call xolox#misc#timer#stop (" %s: Created tags for %s in %s." , s: script , expand (' %:p:~' ), a: starttime )
184+ call xolox#misc#timer#stop (" easytags.vim %s: Created tags for %s in %s." , g: easytags_version , expand (' %:p:~' ), a: starttime )
187185 else
188- call xolox#misc#timer#stop (" %s: Created tags in %s." , s: script , a: starttime )
186+ call xolox#misc#timer#stop (" easytags.vim %s: Created tags in %s." , g: easytags_version , a: starttime )
189187 endif
190188 endif
191189 endif
@@ -280,8 +278,8 @@ function! xolox#easytags#highlight() " {{{2
280278 try
281279 execute command
282280 catch /^Vim\%((\a\+)\)\=:E339/
283- let msg = " easytags.vim: Failed to highlight %i %s tags because pattern is too big! (%i KB)"
284- call xolox#misc#msg#warn (printf ( msg, len (matches), tagkind.hlgroup, len (pattern) / 1024 ) )
281+ let msg = " easytags.vim %s : Failed to highlight %i %s tags because pattern is too big! (%i KB)"
282+ call xolox#misc#msg#warn (msg, g: easytags_version , len (matches), tagkind.hlgroup, len (pattern) / 1024 )
285283 endtry
286284 endif
287285 endif
@@ -291,12 +289,12 @@ function! xolox#easytags#highlight() " {{{2
291289 if bufname == ' '
292290 let bufname = ' unnamed buffer #' . bufnr (' %' )
293291 endif
294- let msg = " %s: Highlighted tags in %s in %s%s."
295- call xolox#misc#timer#stop (msg, s: script , bufname , starttime, used_python ? " (using Python)" : " " )
292+ let msg = " easytags.vim %s: Highlighted tags in %s in %s%s."
293+ call xolox#misc#timer#stop (msg, g: easytags_version , bufname , starttime, used_python ? " (using Python)" : " " )
296294 return 1
297295 endif
298296 catch
299- call xolox#misc#msg#warn (" %s: %s (at %s)" , s: script , v: exception , v: throwpoint )
297+ call xolox#misc#msg#warn (" easytags.vim %s: %s (at %s)" , g: easytags_version , v: exception , v: throwpoint )
300298 endtry
301299endfunction
302300
@@ -312,8 +310,8 @@ function! xolox#easytags#by_filetype(undo) " {{{2
312310 let [headers, entries] = xolox#easytags#read_tagsfile (global_tagsfile)
313311 call s: save_by_filetype (headers, entries)
314312 call rename (global_tagsfile, disabled_tagsfile)
315- let msg = " Finished copying tags from %s to %s! Note that your old tags file has been renamed to %s instead of deleting it, should you want to restore it."
316- call xolox#misc#msg#info (msg, g: easytags_file , g: easytags_by_filetype , disabled_tagsfile)
313+ let msg = " easytags.vim %s: Finished copying tags from %s to %s! Note that your old tags file has been renamed to %s instead of deleting it, should you want to restore it."
314+ call xolox#misc#msg#info (msg, g: easytags_version , g: easytags_file , g: easytags_by_filetype , disabled_tagsfile)
317315 else
318316 let headers = []
319317 let all_entries = []
@@ -322,10 +320,10 @@ function! xolox#easytags#by_filetype(undo) " {{{2
322320 call extend (all_entries, entries)
323321 endfor
324322 call xolox#easytags#write_tagsfile (global_tagsfile, headers, all_entries)
325- call xolox#misc#msg#info (" Finished copying tags from %s to %s!" , g: easytags_by_filetype , g: easytags_file )
323+ call xolox#misc#msg#info (" easytags.vim %s: Finished copying tags from %s to %s!" , g: easytags_version , g: easytags_by_filetype , g: easytags_file )
326324 endif
327325 catch
328- call xolox#misc#msg#warn (" %s: %s (at %s)" , s: script , v: exception , v: throwpoint )
326+ call xolox#misc#msg#warn (" easytags.vim %s: %s (at %s)" , g: easytags_version , v: exception , v: throwpoint )
329327 endtry
330328endfunction
331329
@@ -369,8 +367,8 @@ function! xolox#easytags#supported_filetypes() " {{{2
369367 endif
370368 endtry
371369 let s: supported_filetypes = map (copy (listing), ' s:check_filetype(listing, v:val)' )
372- let msg = " %s: Retrieved %i supported languages in %s."
373- call xolox#misc#timer#stop (msg, s: script , len (s: supported_filetypes ), starttime)
370+ let msg = " easytags.vim %s: Retrieved %i supported languages in %s."
371+ call xolox#misc#timer#stop (msg, g: easytags_version , len (s: supported_filetypes ), starttime)
374372 endif
375373 return s: supported_filetypes
376374endfunction
@@ -473,7 +471,7 @@ function! s:cache_tagged_files() " {{{3
473471 call s: cache_tagged_files_in (fname, ftime, entries)
474472 endif
475473 endfor
476- call xolox#misc#timer#stop (" %s: Initialized cache of tagged files in %s" , s: script , starttime)
474+ call xolox#misc#timer#stop (" easytags.vim %s: Initialized cache of tagged files in %s. " , g: easytags_version , starttime)
477475 endif
478476endfunction
479477
0 commit comments