1 " Vim plug-in
 2 " Author: Peter Odding <peter@peterodding.com>
 3 " Last Change: August 21, 2010
 4 " URL: http://peterodding.com/code/vim/lua-inspect/
 5 " Version: 0.4.6
 6 " License: MIT
 7 
 8 " Support for automatic update using the GLVS plug-in.
 9 " GetLatestVimScripts: 3169 1 :AutoInstall: luainspect.zip
10 
11 " Don't source the plug-in when its already been loaded or &compatible is set.
12 if &cp || exists('g:loaded_luainspect')
13   finish
14 endif
15 
16 if !exists('g:lua_inspect_warnings')
17   " Change this to disable automatic warning messages.
18   let g:lua_inspect_warnings = 1
19 endif
20 
21 if !exists('g:lua_inspect_events')
22   " Change this to enable semantic highlighting on your preferred events.
23   let g:lua_inspect_events = 'CursorHold,CursorHoldI,BufWritePost'
24 endif
25 
26 if !exists('g:lua_inspect_path')
27   " Change this if you want to move the Lua modules somewhere else.
28   if has('win32') || has('win64')
29     let g:lua_inspect_path = '~\vimfiles\misc\luainspect'
30   else
31     let g:lua_inspect_path = '~/.vim/misc/luainspect'
32   endif
33 endif
34 
35 if !exists('g:lua_inspect_internal')
36   " Set this to false (0) to run LuaInspect as an external process instead of
37   " using the Lua interface for Vim. This makes it slower but might make it
38   " more accurate because the Lua interface for Vim didn't include io.* and
39   " os.* before the patch posted on 2010-07-28 which means LuaInspect would
40   " mark them as undefined globals. The patch I'm referring to is:
41   " http://groups.google.com/group/vim_dev/browse_frm/thread/9b77afa2fe4336c8
42   let g:lua_inspect_internal = has('lua')
43 endif
44 
45 " This command updates highlighting when automatic highlighting is disabled.
46 command! -bar -bang LuaInspect call luainspect#highlight_cmd(<q-bang> == '!')
47 
48 " Automatically enable the plug-in in Lua buffers.
49 augroup PluginLuaInspect
50   autocmd! FileType lua call luainspect#auto_enable()
51 augroup END
52 
53 " The &balloonexpr option requires a global function.
54 function! LuaInspectToolTip()
55   let result = luainspect#make_request('tooltip')
56   if exists('b:luainspect_syntax_error')
57     return b:luainspect_syntax_error
58   else
59     return type(result) == type('') ? result : ''
60   endif
61 endfunction
62 
63 " Make sure the plug-in is only loaded once.
64 let g:loaded_luainspect = 1
65 
66 " vim: ts=2 sw=2 et