aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2011-06-18 04:35:27 +0200
committerPeter Odding <peter@peterodding.com>2011-06-18 04:35:27 +0200
commit38996d3c8d7d55617a840d3cb22ad650bc7b60e0 (patch)
tree3cdd7193c5b0cea7f739b876768106da454c5378
parent16e04cb66bef0d4e915caf7df667b753a031278e (diff)
downloadvim-easytags-38996d3c8d7d55617a840d3cb22ad650bc7b60e0.tar.gz
open.vim: Define version as variable, include version in messages
-rw-r--r--open.vim15
1 files changed, 7 insertions, 8 deletions
diff --git a/open.vim b/open.vim
index 60d75e7..30d2aa3 100644
--- a/open.vim
+++ b/open.vim
@@ -1,12 +1,11 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: May 25, 2011
+" Last Change: June 18, 2011
" URL: http://peterodding.com/code/vim/misc/
-if !exists('s:script')
- let s:script = expand('<sfile>:p:~')
- let s:enoimpl = "%s: %s() hasn't been implemented for your platform!"
- let s:enoimpl .= " If you have suggestions, please contact peter@peterodding.com."
+if !exists('s:version')
+ let s:version = '1.0'
+ let s:enoimpl = "open.vim %s: %s() hasn't been implemented for your platform! If you have suggestions, please contact peter@peterodding.com."
let s:handlers = ['gnome-open', 'kde-open', 'exo-open', 'xdg-open']
endif
@@ -26,7 +25,7 @@ function! xolox#misc#open#file(path, ...)
else
for handler in s:handlers + a:000
if executable(handler)
- call xolox#misc#msg#debug("%s: Using `%s' to open %s", s:script, handler, a:path)
+ call xolox#misc#msg#debug("open.vim %s: Using '%s' to open '%s'.", s:version, handler, a:path)
let cmd = shellescape(handler) . ' ' . shellescape(a:path) . ' 2>&1'
call s:handle_error(cmd, system(cmd))
return
@@ -59,12 +58,12 @@ endfunction
function! s:handle_error(cmd, output)
if v:shell_error
- let message = "%s: Failed to execute program! (command line: %s%s)"
+ let message = "open.vim %s: Failed to execute program! (command line: %s%s)"
let output = strtrans(xolox#misc#str#trim(a:output))
if output != ''
let output = ", output: " . string(output)
endif
- throw printf(message, s:script, a:cmd, output)
+ throw printf(message, s:version, a:cmd, output)
endif
endfunction