From 38996d3c8d7d55617a840d3cb22ad650bc7b60e0 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Sat, 18 Jun 2011 04:35:27 +0200 Subject: open.vim: Define version as variable, include version in messages --- open.vim | 15 +++++++-------- 1 file 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 -" 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(':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 -- cgit v1.2.3