sponsor Vim development Vim logo Vim Book Ad

luainspect.vim : Semantic highlighting for Lua in Vim

 script karma  Rating 59/22, Downloaded by 11803  Comments, bugs, improvements  Vim wiki

created by
Peter Odding
 
script type
syntax
 
description
This Vim plug-in uses the LuaInspect tool to (automatically) perform semantic highlighting of variables in Lua source code. It was inspired by lua2-mode (for Emacs) and the SciTE plug-in included with LuaInspect. For more information about the plug-in please refer to its homepage or the project page on GitHub:

http://peterodding.com/code/vim/lua-inspect/
http://github.com/xolox/vim-lua-inspect

If you have questions, bug reports, suggestions, etc. the author can be contacted at [email protected]. If you like this plug-in please vote for it below!
 
install details
Please note that the vim-lua-inspect plug-in requires my vim-misc plug-in which is separately distributed (see vimscript #4597).

Unzip the most recent ZIP archives of the vim-lua-inspect and vim-misc plug-ins inside your Vim profile directory (usually this is ~/.vim on UNIX and %USERPROFILE%\vimfiles on Windows), restart Vim and execute the command :helptags ~/.vim/doc (use :helptags ~\vimfiles\doc instead on Windows).

If you prefer you can also use Pathogen, Vundle or a similar tool to install & update the vim-lua-inspect and vim-misc plug-ins using a local clone of the git repository.

Now try it out: Edit a Lua file and within a few seconds semantic highlighting should be enabled automatically!

Note that on Windows a command prompt window pops up whenever LuaInspect is run as an external process. If this bothers you then you can install my shell.vim plug-in (see vimscript #3123) which includes a DLL that works around this issue. Once you’ve installed both plug-ins it should work out of the box!
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
luainspect.zip 0.5.2 2014-06-17 7.0 Peter Odding • Tackle pull request #4 - Allow alternative mappings:
   http://github.com/xolox/vim-lua-inspect/commit/0e59882
luainspect.zip 0.5.1 2013-08-19 7.0 Peter Odding • Mention LuaInspect and Metalua licenses in README:
   http://github.com/xolox/vim-lua-inspect/commit/c79c8d9
> • Make sure vim-misc is installed, politely complain if it isn't:
  
http://github.com/xolox/vim-lua-inspect/commit/d7fb876
luainspect.zip 0.5 2013-07-18 7.0 Peter Odding • Support for Lua 5.2 (updated to latest version of LuaInspect):
   http://github.com/xolox/vim-lua-inspect/commit/0bf9775
luainspect.zip 0.4.27 2013-05-27 7.0 Peter Odding • Make "go to definition" compatible* with Lua 5.2:
   http://github.com/xolox/vim-lua-inspect/commit/77f9da1
luainspect.zip 0.4.26 2013-05-25 7.0 Peter Odding • Document vim-misc as external dependency (needs to be installed separately from now on):
   http://github.com/xolox/vim-lua-inspect/commit/ebf637d
luainspect.zip 0.4.24 2013-05-20 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/942f58a
luainspect.zip 0.4.23 2013-05-19 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/dab5a33
luainspect.zip 0.4.22 2013-05-13 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/8e23d8e
  
; http://github.com/xolox/vim-lua-inspect/commit/9c88b0e
luainspect.zip 0.4.21 2013-05-12 7.0 Peter Odding • Bug fix & improvements for running LuaInspect as external process:
   http://github.com/xolox/vim-lua-inspect/commit/a95cd00
luainspect.zip 0.4.20 2013-05-12 7.0 Peter Odding • Bug fix: Remove hidden Unicode character causing E129:
   http://github.com/xolox/vim-lua-inspect/commit/1c183f4
luainspect.zip 0.4.19 2013-05-02 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/2192365
luainspect.zip 0.4.18 2013-04-28 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/e0815fe
luainspect.zip 0.4.17 2013-04-20 7.0 Peter Odding • Make compatibility with miscellaneous scripts explicit:
   http://github.com/xolox/vim-lua-inspect/commit/c66d2b7
luainspect.zip 0.4.16 2011-11-24 7.0 Peter Odding • xolox#misc#os#exec() uses xolox#shell#execute() when available, falls back to system():
   http://github.com/xolox/vim-lua-inspect/commit/9b4c774
  
; http://github.com/xolox/vim-lua-inspect/commit/d488dd2
  
; http://github.com/xolox/vim-lua-inspect/commit/2161dc7
luainspect.zip 0.4.15 2011-11-21 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/1529fff
luainspect.zip 0.4.14 2011-11-15 7.0 Peter Odding • New :LuaInspectToggle command:
   http://github.com/xolox/vim-lua-inspect/commit/1ed6e7a
luainspect.zip 0.4.13 2011-09-25 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/c8c3405
luainspect.zip 0.4.12 2011-09-04 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-lua-inspect/commit/fd90005
luainspect.zip 0.4.11 2011-08-28 7.0 Peter Odding • Define version as variable, include version in messages:
   http://github.com/xolox/vim-lua-inspect/commit/b92c629
luainspect.zip 0.4.10 2011-05-25 7.0 Peter Odding • Added example to showcase semantic highlighting:
   http://github.com/xolox/vim-lua-inspect/commit/0249104

• Make g:lua_inspect_path default compatible with Pathogen:
   http://github.com/xolox/vim-lua-inspect/commit/26e6f35

• Bug fix: Only enable tooltips when supported: (thanks Micheal for the bug report!)
   http://github.com/xolox/vim-lua-inspect/commit/987eda1
luainspect.zip 0.4.7 2010-10-09 7.0 Peter Odding • Improve syntax error messages for unnamed buffers:
   http://github.com/xolox/vim-lua-inspect/commit/3cbe412883edda9ce4cc

• Make parse_text() more robust against missing buffer variables:
   http://github.com/xolox/vim-lua-inspect/commit/bc013227961f7dc24818

• Bug fix: Focus doesn't return to original window:
   http://github.com/xolox/vim-lua-inspect/commit/806dcb21f9f7be1de715
luainspect.zip 0.4.5 2010-08-19 7.0 Peter Odding • Always clear previously overlayed highlighting:
   http://github.com/xolox/vim-lua-inspect/commit/62942b011979937fba84ea4795f7a5c593323f31

• Bug fix for `E776: No location list':
   http://github.com/xolox/vim-lua-inspect/commit/47b25952b638bb02f69c7fb479cbb2d57c806a94

• Make argument count warnings highlight only function names:
   http://github.com/xolox/vim-lua-inspect/commit/22b75bcf657d4f55e48cce3801613ee3e3086af1

Lots of miscellaneous changes (see http://github.com/xolox/vim-lua-inspect/commits/) to make the plug-in compatible with the newest release of LuaInspect, which itself includes bug fixes that fix bugs in this plug-in (e.g. when you add some empty lines to the start of a Lua buffer the highlighting would break, this turned out to be a bug in the Metalua lexer).
luainspect.zip 0.4.3 2010-08-16 7.0 Peter Odding • Bug fix: Strip newlines from warnings:
   http://github.com/xolox/vim-lua-inspect/commit/59ba90c6c496dfe929cb83b896fe4e594d06354a

• Ignore LuaInspect status messages on stderr (only applies when not using if-lua):
   http://github.com/xolox/vim-lua-inspect/commit/fd3920c5fd7faba9881a2b89525b5caa7753baa8

• Enable renaming variables that only differ in case:
   http://github.com/xolox/vim-lua-inspect/commit/14b1ff64e29b6333d492a9fc8dfddb0427ee449e
luainspect.zip 0.4 2010-08-15 7.0 Peter Odding Some new features and lots of bug fixes:

• Support dark colorschemes following scite.lua:
   http://github.com/xolox/vim-lua-inspect/commit/c6a8ecf5067329540d70a313336d28cd33dbf4f9

• Bug fix: Show error highlighting only in Lua buffers:
   http://github.com/xolox/vim-lua-inspect/commit/2d671c489bdf42dfe68b289588c09e0a18c7ce0b

• Bug fix: Overlay argument count highlighting:
   http://github.com/xolox/vim-lua-inspect/commit/7f9cbd60cbbc949ddb5c809eac2ba3a88dad44a6

• Split plug-in into command definitions / autoload functions:
   http://github.com/xolox/vim-lua-inspect/commit/527e1b76a06c04baf2b9b597f1fbd5e0ef02fca4

• if-lua now includes io.*; remove workaround
   http://github.com/xolox/vim-lua-inspect/commit/5f3bdbafcc5258487e94cf55dae9cde5374d97d1

• Time plug-in execution for all actions:
   http://github.com/xolox/vim-lua-inspect/commit/2a33bcb6876ef1bd0705ea8738ee0e5c735fff42

• Use real buffer names instead of ‘noname.lua’:
   http://github.com/xolox/vim-lua-inspect/commit/2e93bdd4f3de8a39fc22a6f2d29021a5873d057b

• Improved highlighting for argument count warnings:
   http://github.com/xolox/vim-lua-inspect/commit/17bb37cefb7e562cacc0d076c6189aaf92026aca

• Use LuaInspect's get_value_details() function:
   http://github.com/xolox/vim-lua-inspect/commit/cca74e2556c351e91e150bcf33b69f537b4a2644

• Show warnings by LuaInspect in location list:
   http://github.com/xolox/vim-lua-inspect/commit/f0eeca23130a1bbff1293e7203dcde8f7340d06a

• The packages for version 0.3.3 and 0.3.6 below should have been self contained but I failed to include the LuaInspect sources. This has been fixed now. Sorry about that!
luainspect.zip 0.3.6 2010-08-12 7.0 Peter Odding • Warn user + show tooltips for syntax errors:
   http://github.com/xolox/vim-lua-inspect/commit/b0b58008127bcecae658922707370f0df915847c

• Better highlighting of selected variables:
   http://github.com/xolox/vim-lua-inspect/commit/026fdd42bca366b95a271c3b8c9fa78cbc17c0f9

• Highlight wrong function argument count:
   http://github.com/xolox/vim-lua-inspect/commit/72a058e773a97781eaa731567faf1f2268576563
luainspect.zip 0.3.3 2010-08-11 7.0 Peter Odding • <F2> mapping to rename all occurrences of variable:
   http://github.com/xolox/vim-lua-inspect/commit/0c52221a952874807e50d668b0c89511378bdb10

• 'gd' mapping to jump to variable declaration:
   http://github.com/xolox/vim-lua-inspect/commit/bb99531941ca10ffd9b77a2a9dcd83a354a022cf

• Tooltips to show variable details like state/type/signature/value:
   http://github.com/xolox/vim-lua-inspect/commit/dc640de6799ba3da5f70073828da91ffaf0b596a
luainspect.zip 0.2.4 2010-08-10 7.0 Peter Odding • Highlight syntax errors as spelling errors:
   http://github.com/xolox/vim-lua-inspect/commit/f5b367d8dd7d9d6da1fb359ab19b0e44c49161f7

• Support automatic updates using GLVS plug-in:
   http://github.com/xolox/vim-lua-inspect/commit/4c2c0bfd45e86dbfdbedf66c20425a3b4e9426a6
luainspect.zip 0.2.2 2010-08-10 7.0 Peter Odding • Now works on Windows and disables easytags.vim:
   http://github.com/xolox/vim-lua-inspect/commit/ce2b578242ccf3d4eef658accc7e4711f34fbbbc

• Converted the plug-in to a self contained package: Unzip and you're off!
   http://github.com/xolox/vim-lua-inspect/commit/43307cbb3a99b3a6075640151626f50846ced474

• Don't show command prompts on Windows (integration with my shell.vim plug-in):
   http://github.com/xolox/vim-lua-inspect/commit/2689c2d1896d47c6aa3fa2d919d06d353cf0c17f
luainspect.zip 0.2.1 2010-08-07 7.0 Peter Odding • Highlight occurrences of variable under text cursor:
   http://github.com/xolox/vim-lua-inspect/commit/6a0430cff4f4806a89732037437562ef3c36d0a0

• Don't parse the text when it hasn't been changed:
   http://github.com/xolox/vim-lua-inspect/commit/a9205704796749a0556ce6e7a7959654b3983caa

• Use new LuaInspect API (without incremental parsing for now):
   http://github.com/xolox/vim-lua-inspect/commit/a14b977c69b6682054e80b9bcceb1c0f797fcd21

• Use if-lua by default (because of if-lua-corelibs.diff):
   http://github.com/xolox/vim-lua-inspect/commit/7bec1f49c6f12bbdde1f6d5a3470a9f66a8e34e2

• Support disabling plug-in for specific buffers:
   http://github.com/xolox/vim-lua-inspect/commit/3e5967143918c6bc383fae0442f10210c81be0f8
luainspect.zip 0.1.4 2010-07-28 7.0 Peter Odding • Don't perform semantic highlighting in 'diff' mode:
   http://github.com/xolox/vim-lua-inspect/commit/47a223e11b469d871f8968c7f5bb7543d0f54e2c

• Add word boundaries to Vim search patterns:
   http://github.com/xolox/vim-lua-inspect/commit/59637bd8e2843b51780866f10899f759aa07c416

• (Performance) improvements suggested by Luis Carvalho:
   http://github.com/xolox/vim-lua-inspect/commit/7de26617d1f659a3e173f8be5ed0305fee6a83a9

• `ErrorMsg' has better highlighting between colorschemes than `Error':
   http://github.com/xolox/vim-lua-inspect/commit/63dc4bb0f8094b45c7abe416d1ccbc28426d54cc

• Simplified wrapper as suggested by David Manura:
   http://github.com/xolox/vim-lua-inspect/commit/ed34601710a09222ef3351082c40cc249eae9821
luainspect.zip 0.1.3 2010-07-27 7.0 Peter Odding • Enable users to define styles which the plug-in won't override:
   http://github.com/xolox/vim-lua-inspect/commit/67777a75f4b9f4896d5818b57611d34c82a0187c

• Enable highlighting on user defined events:
   http://github.com/xolox/vim-lua-inspect/commit/d07a1ff10cbd78d5e16c28d234b5e37bc0de88ad
luainspect.zip 0.1.2 2010-07-27 7.0 Peter Odding README improvements, miscellaneous other changes: http://github.com/xolox/vim-lua-inspect/commit/ec4e1c31facda80b316a5062fe71a4fe40e07f84
luainspect.zip 0.1 2010-07-27 7.0 Peter Odding Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github