Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Define version as variable, include version in messages

  • Loading branch information...
commit e454233ca5289444deaf2f6525af76b995fd9717 1 parent 27b9aa3
Peter Odding authored
Showing with 31 additions and 35 deletions.
  1. +24 −26 autoload/xolox/easytags.vim
  2. +7 −9 plugin/easytags.vim
50 autoload/xolox/easytags.vim
View
@@ -1,10 +1,8 @@
" Vim script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 14, 2011
+" Last Change: June 18, 2011
" URL: http://peterodding.com/code/vim/easytags/
-let s:script = 'easytags.vim'
-
" Public interface through (automatic) commands. {{{1
function! xolox#easytags#register(global) " {{{2
@@ -59,7 +57,7 @@ function! xolox#easytags#autoload() " {{{2
let b:easytags_last_highlighted = localtime()
endif
catch
- call xolox#misc#msg#warn("%s: %s (at %s)", s:script, v:exception, v:throwpoint)
+ call xolox#misc#msg#warn("easytags.vim %s: %s (at %s)", g:easytags_version, v:exception, v:throwpoint)
endtry
endfunction
@@ -76,14 +74,14 @@ function! xolox#easytags#update(silent, filter_tags, filenames) " {{{2
if !firstrun
let num_filtered = s:filter_merge_tags(a:filter_tags, tagsfile, output)
if cfile != ''
- let msg = "%s: Updated tags for %s in %s."
- call xolox#misc#timer#stop(msg, s:script, expand('%:p:~'), starttime)
+ let msg = "easytags.vim %s: Updated tags for %s in %s."
+ call xolox#misc#timer#stop(msg, g:easytags_version, expand('%:p:~'), starttime)
elseif !empty(a:filenames)
- let msg = "%s: Updated tags in %s."
- call xolox#misc#timer#stop(msg, s:script, starttime)
+ let msg = "easytags.vim %s: Updated tags in %s."
+ call xolox#misc#timer#stop(msg, g:easytags_version, starttime)
else
- let msg = "%s: Filtered %i invalid tags in %s."
- call xolox#misc#timer#stop(msg, s:script, num_filtered, starttime)
+ let msg = "easytags.vim %s: Filtered %i invalid tags in %s."
+ call xolox#misc#timer#stop(msg, g:easytags_version, num_filtered, starttime)
endif
endif
" When :UpdateTags was executed manually we'll refresh the dynamic
@@ -93,7 +91,7 @@ function! xolox#easytags#update(silent, filter_tags, filenames) " {{{2
endif
return 1
catch
- call xolox#misc#msg#warn("%s: %s (at %s)", s:script, v:exception, v:throwpoint)
+ call xolox#misc#msg#warn("easytags.vim %s: %s (at %s)", g:easytags_version, v:exception, v:throwpoint)
endtry
endfunction
@@ -169,7 +167,7 @@ endfunction
function! s:run_ctags(starttime, cfile, tagsfile, firstrun, cmdline) " {{{3
let lines = []
if a:cmdline != ''
- call xolox#misc#msg#debug("%s: Executing %s", s:script, a:cmdline)
+ call xolox#misc#msg#debug("easytags.vim %s: Executing %s.", g:easytags_version, a:cmdline)
try
let lines = xolox#shell#execute(a:cmdline, 1)
catch /^Vim\%((\a\+)\)\=:E117/
@@ -183,9 +181,9 @@ function! s:run_ctags(starttime, cfile, tagsfile, firstrun, cmdline) " {{{3
endtry
if a:firstrun
if a:cfile != ''
- call xolox#misc#timer#stop("%s: Created tags for %s in %s.", s:script, expand('%:p:~'), a:starttime)
+ call xolox#misc#timer#stop("easytags.vim %s: Created tags for %s in %s.", g:easytags_version, expand('%:p:~'), a:starttime)
else
- call xolox#misc#timer#stop("%s: Created tags in %s.", s:script, a:starttime)
+ call xolox#misc#timer#stop("easytags.vim %s: Created tags in %s.", g:easytags_version, a:starttime)
endif
endif
endif
@@ -280,8 +278,8 @@ function! xolox#easytags#highlight() " {{{2
try
execute command
catch /^Vim\%((\a\+)\)\=:E339/
- let msg = "easytags.vim: Failed to highlight %i %s tags because pattern is too big! (%i KB)"
- call xolox#misc#msg#warn(printf(msg, len(matches), tagkind.hlgroup, len(pattern) / 1024))
+ let msg = "easytags.vim %s: Failed to highlight %i %s tags because pattern is too big! (%i KB)"
+ call xolox#misc#msg#warn(msg, g:easytags_version, len(matches), tagkind.hlgroup, len(pattern) / 1024)
endtry
endif
endif
@@ -291,12 +289,12 @@ function! xolox#easytags#highlight() " {{{2
if bufname == ''
let bufname = 'unnamed buffer #' . bufnr('%')
endif
- let msg = "%s: Highlighted tags in %s in %s%s."
- call xolox#misc#timer#stop(msg, s:script, bufname, starttime, used_python ? " (using Python)" : "")
+ let msg = "easytags.vim %s: Highlighted tags in %s in %s%s."
+ call xolox#misc#timer#stop(msg, g:easytags_version, bufname, starttime, used_python ? " (using Python)" : "")
return 1
endif
catch
- call xolox#misc#msg#warn("%s: %s (at %s)", s:script, v:exception, v:throwpoint)
+ call xolox#misc#msg#warn("easytags.vim %s: %s (at %s)", g:easytags_version, v:exception, v:throwpoint)
endtry
endfunction
@@ -312,8 +310,8 @@ function! xolox#easytags#by_filetype(undo) " {{{2
let [headers, entries] = xolox#easytags#read_tagsfile(global_tagsfile)
call s:save_by_filetype(headers, entries)
call rename(global_tagsfile, disabled_tagsfile)
- 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."
- call xolox#misc#msg#info(msg, g:easytags_file, g:easytags_by_filetype, disabled_tagsfile)
+ 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."
+ call xolox#misc#msg#info(msg, g:easytags_version, g:easytags_file, g:easytags_by_filetype, disabled_tagsfile)
else
let headers = []
let all_entries = []
@@ -322,10 +320,10 @@ function! xolox#easytags#by_filetype(undo) " {{{2
call extend(all_entries, entries)
endfor
call xolox#easytags#write_tagsfile(global_tagsfile, headers, all_entries)
- call xolox#misc#msg#info("Finished copying tags from %s to %s!", g:easytags_by_filetype, g:easytags_file)
+ 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)
endif
catch
- call xolox#misc#msg#warn("%s: %s (at %s)", s:script, v:exception, v:throwpoint)
+ call xolox#misc#msg#warn("easytags.vim %s: %s (at %s)", g:easytags_version, v:exception, v:throwpoint)
endtry
endfunction
@@ -369,8 +367,8 @@ function! xolox#easytags#supported_filetypes() " {{{2
endif
endtry
let s:supported_filetypes = map(copy(listing), 's:check_filetype(listing, v:val)')
- let msg = "%s: Retrieved %i supported languages in %s."
- call xolox#misc#timer#stop(msg, s:script, len(s:supported_filetypes), starttime)
+ let msg = "easytags.vim %s: Retrieved %i supported languages in %s."
+ call xolox#misc#timer#stop(msg, g:easytags_version, len(s:supported_filetypes), starttime)
endif
return s:supported_filetypes
endfunction
@@ -473,7 +471,7 @@ function! s:cache_tagged_files() " {{{3
call s:cache_tagged_files_in(fname, ftime, entries)
endif
endfor
- call xolox#misc#timer#stop("%s: Initialized cache of tagged files in %s", s:script, starttime)
+ call xolox#misc#timer#stop("easytags.vim %s: Initialized cache of tagged files in %s.", g:easytags_version, starttime)
endif
endfunction
16 plugin/easytags.vim
View
@@ -1,20 +1,18 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 17, 2011
+" Last Change: June 18, 2011
" URL: http://peterodding.com/code/vim/easytags/
" Requires: Exuberant Ctags (http://ctags.sf.net)
-" License: MIT
-" Version: 2.4.2
" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3114 1 :AutoInstall: easytags.zip
-" Don't source the plug-in when its already been loaded or &compatible is set.
+" Don't source the plug-in when it's already been loaded or &compatible is set.
if &cp || exists('g:loaded_easytags')
finish
endif
-let s:script = expand('<sfile>:p:~')
+let g:easytags_version = '2.4.3'
" Configuration defaults and initialization. {{{1
@@ -126,7 +124,7 @@ if !s:InitEasyTags(55)
finish
endif
if !exists('g:easytags_ctags_version') || empty(g:easytags_ctags_version)
- let s:msg = "%s: Plug-in not loaded because Exuberant Ctags isn't installed!"
+ let s:msg = "easytags.vim %s: Plug-in not loaded because Exuberant Ctags isn't installed!"
if executable('apt-get')
let s:msg .= " On Ubuntu & Debian you can install Exuberant Ctags by"
let s:msg .= " installing the package named `exuberant-ctags':"
@@ -134,11 +132,11 @@ if !s:InitEasyTags(55)
else
let s:msg .= " Please download & install Exuberant Ctags from http://ctags.sf.net"
endif
- echomsg printf(s:msg, s:script)
+ echomsg printf(s:msg, g:easytags_version)
else
- let s:msg = "%s: Plug-in not loaded because Exuberant Ctags 5.5"
+ let s:msg = "easytags.vim %s: Plug-in not loaded because Exuberant Ctags 5.5"
let s:msg .= " or newer is required while you have version %s installed!"
- echomsg printf(s:msg, s:script, g:easytags_ctags_version)
+ echomsg printf(s:msg, g:easytags_version, g:easytags_ctags_version)
endif
unlet s:msg
finish
Please sign in to comment.
Something went wrong with that request. Please try again.