Skip to content

Commit b92c629

Browse files
committed
Define version as variable, include version in messages
1 parent 35be685 commit b92c629

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

autoload/xolox/luainspect.vim

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script.
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: June 18, 2011
3+
" Last Change: August 27, 2011
44
" URL: http://peterodding.com/code/vim/lua-inspect/
55

6-
let s:script = expand('<sfile>:p:~')
6+
let g:xolox#luainspect#version = '0.4.11'
77

88
function! xolox#luainspect#auto_enable() " {{{1
99
if !&diff && !exists('b:luainspect_disabled')
@@ -73,41 +73,41 @@ function! xolox#luainspect#make_request(action) " {{{1
7373
let error_cmd = 'syntax match luaInspectSyntaxError /\%%>%il\%%<%il.*/ containedin=ALLBUT,lua*Comment*'
7474
execute printf(error_cmd, linenum - 1, (linenum2 ? linenum2 : line('$')) + 1)
7575
endif
76-
call xolox#misc#timer#stop("%s: Found a syntax error in %s in %s.", s:script, friendlyname, starttime)
76+
call xolox#misc#timer#stop("luainspect.vim %s: Found a syntax error in %s in %s.", g:xolox#luainspect#version, friendlyname, starttime)
7777
" But always let the user know that a syntax error exists.
78-
call xolox#misc#msg#warn("Syntax error around line %i in %s: %s", linenum, friendlyname, b:luainspect_syntax_error)
78+
call xolox#misc#msg#warn("luainspect.vim %s: Syntax error around line %i in %s: %s", g:xolox#luainspect#version, linenum, friendlyname, b:luainspect_syntax_error)
7979
return
8080
endif
8181
unlet! b:luainspect_syntax_error
8282
if response == 'highlight'
8383
call s:define_default_styles()
8484
call s:clear_previous_matches()
8585
call s:highlight_variables()
86-
call xolox#misc#timer#stop("%s: Highlighted variables in %s in %s.", s:script, friendlyname, starttime)
86+
call xolox#misc#timer#stop("luainspect.vim %s: Highlighted variables in %s in %s.", g:xolox#luainspect#version, friendlyname, starttime)
8787
elseif response == 'goto'
8888
if len(b:luainspect_output) < 3
89-
call xolox#misc#msg#warn("No variable under cursor!")
89+
call xolox#misc#msg#warn("luainspect.vim %s: No variable under cursor!", g:xolox#luainspect#version)
9090
else
9191
let linenum = b:luainspect_output[1] + 0
9292
let colnum = b:luainspect_output[2] + 1
9393
call setpos('.', [0, linenum, colnum, 0])
94-
call xolox#misc#timer#stop("%s: Jumped to definition in %s in %s.", s:script, friendlyname, starttime)
94+
call xolox#misc#timer#stop("luainspect.vim %s: Jumped to definition in %s in %s.", g:xolox#luainspect#version, friendlyname, starttime)
9595
if &verbose == 0
9696
" Clear previous "No variable under cursor!" message to avoid confusion.
97-
call xolox#misc#msg#info("")
97+
redraw | echo ""
9898
endif
9999
endif
100100
elseif response == 'tooltip'
101101
if len(b:luainspect_output) > 1
102-
call xolox#misc#timer#stop("%s: Rendered tool tip for %s in %s.", s:script, friendlyname, starttime)
102+
call xolox#misc#timer#stop("luainspect.vim %s: Rendered tool tip for %s in %s.", g:xolox#luainspect#version, friendlyname, starttime)
103103
return join(b:luainspect_output[1:-1], "\n")
104104
endif
105105
elseif response == 'rename'
106106
if len(b:luainspect_output) > 1
107-
call xolox#misc#timer#stop("%s: Prepared for rename in %s in %s.", s:script, friendlyname, starttime)
107+
call xolox#misc#timer#stop("luainspect.vim %s: Prepared for rename in %s in %s.", g:xolox#luainspect#version, friendlyname, starttime)
108108
call s:rename_variable()
109109
else
110-
call xolox#misc#msg#warn("No variable under cursor!")
110+
call xolox#misc#msg#warn("luainspect.vim %s: No variable under cursor!", g:xolox#luainspect#version)
111111
endif
112112
endif
113113
endif
@@ -139,8 +139,8 @@ function! s:parse_text(input, search_path) " {{{1
139139
" Ignore missing shell.vim plug-in.
140140
let b:luainspect_output = split(system(command, a:input), "\n")
141141
if v:shell_error
142-
let msg = "Failed to execute LuaInspect as external process! %s"
143-
throw printf(msg, strtrans(join(b:luainspect_output, "\n")))
142+
let msg = "luainspect.vim %s: Failed to execute LuaInspect as external process! %s"
143+
throw printf(msg, g:xolox#luainspect#version, strtrans(join(b:luainspect_output, "\n")))
144144
endif
145145
endtry
146146
else
@@ -258,8 +258,8 @@ function! s:rename_variable() " {{{1
258258
redraw
259259
" Prompt for new name.
260260
let oldname = expand('<cword>')
261-
let prompt = "Please enter the new name for %s: "
262-
let newname = input(printf(prompt, oldname), oldname)
261+
let prompt = "luainspect.vim %s: Please enter the new name for %s: "
262+
let newname = input(printf(prompt, g:xolox#luainspect#version, oldname), oldname)
263263
" Clear highlighting of occurrences.
264264
call map(highlights, 'matchdelete(v:val)')
265265
" Perform rename?
@@ -278,16 +278,16 @@ function! s:rename_variable() " {{{1
278278
call setline(linenum, prefix . newname . suffix)
279279
let num_renamed += 1
280280
endfor
281-
let msg = "Renamed %i occurrences of %s to %s"
282-
call xolox#misc#msg#info(msg, num_renamed, oldname, newname)
281+
let msg = "luainspect.vim %s: Renamed %i occurrences of %s to %s"
282+
call xolox#misc#msg#info(msg, g:xolox#luainspect#version, num_renamed, oldname, newname)
283283
endif
284284
endfunction
285285

286286
function! s:check_output(line, pattern) " {{{1
287287
if match(a:line, a:pattern) >= 0
288288
return 1
289289
else
290-
call xolox#misc#msg#warn("Invalid output from luainspect4vim.lua: '%s'", strtrans(a:line))
290+
call xolox#misc#msg#warn("luainspect.vim %s: Invalid output from luainspect4vim.lua: '%s'", g:xolox#luainspect#version, strtrans(a:line))
291291
return 0
292292
endif
293293
endfunction

plugin/luainspect.vim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
" Vim plug-in
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: June 18, 2011
3+
" Last Change: August 27, 2011
44
" URL: http://peterodding.com/code/vim/lua-inspect/
5-
" Version: 0.4.10
65

76
" Support for automatic update using the GLVS plug-in.
87
" GetLatestVimScripts: 3169 1 :AutoInstall: luainspect.zip

0 commit comments

Comments
 (0)