You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you're looking for the simplest way to get the plug-in up and running, download [the latest ZIP archive](http://peterodding.com/code/vim/downloads/lua-inspect.zip) from [Vim Online](http://www.vim.org/scripts/script.php?script_id=3169), unzip that in `~/.vim/` (on UNIX) or `%USERPROFILE%\vimfiles` (on Windows) and you're good to go.
1
+
*Please note that the vim-lua-inspect plug-in requires my vim-misc plug-in which is separately distributed.*
2
2
3
-
If you're using git and/or [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332), [Vundle](https://github.com/gmarik/vundle) or a similar plug-in manager and want to keep the plug-in up to date using git, you can use the GitHub repository directly, it should just work.
3
+
Unzip the most recent ZIP archives of the [vim-lua-inspect][download-lua-inspect] and [vim-misc][download-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).
4
+
5
+
If you prefer you can also use [Pathogen][pathogen], [Vundle][vundle] or a similar tool to install & update the [vim-lua-inspect][github-lua-inspect] and [vim-misc][github-misc] plug-ins using a local clone of the git repository.
Copy file name to clipboardExpand all lines: README.md
+36-12Lines changed: 36 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,34 @@
1
1
# Semantic highlighting for Lua in Vim
2
2
3
-
The Vim plug-in `luainspect.vim` uses the [LuaInspect](http://lua-users.org/wiki/LuaInspect) tool to (automatically) perform semantic highlighting of variables in Lua source code. It was inspired by [lua2-mode](http://www.enyo.de/fw/software/lua-emacs/lua2-mode.html) (for [Emacs](http://www.gnu.org/software/emacs/)) and the [SciTE](http://www.scintilla.org/SciTE.html) plug-in included with LuaInspect. In addition to the semantic highlighting the following features are currently supported:
3
+
The Vim plug-in `luainspect.vim` uses the [LuaInspect][lua-inspect] tool to (automatically) perform semantic highlighting of variables in Lua source code. It was inspired by [lua2-mode][lua2-mode] (for [Emacs][emacs]) and the [SciTE][scite] plug-in included with LuaInspect. In addition to the semantic highlighting the following features are currently supported:
4
4
5
5
* Press `<F2>` with the text cursor on a variable and the plug-in will prompt you to rename the variable.
6
6
7
7
* Press `gd` (in normal mode) with the text cursor on a variable and you'll jump to its declaration / first occurrence.
8
8
9
9
* When you hover over a variable with the mouse cursor in graphical Vim, information about the variable is displayed in a tooltip.
10
10
11
-
* If the text cursor is on a variable while the highlighting is refreshed then all occurrences of the variable will be marked in the style of [Vim's cursorline option](http://vimdoc.sourceforge.net/htmldoc/options.html#%27cursorline%27).
11
+
* If the text cursor is on a variable while the highlighting is refreshed then all occurrences of the variable will be marked in the style of [Vim's cursorline option][cursorline].
12
12
13
13
* When luainspect reports a wrong argument count for a function call the text will be highlighted with a green underline. When you hover over the highlighted text a tooltip shows the associated warning message.
14
14
15
-
* When LuaInspect reports warnings about unused variables, wrong argument counts, etc. they are shown in a [location list window](http://vimdoc.sourceforge.net/htmldoc/quickfix.html#location-list).
15
+
* When LuaInspect reports warnings about unused variables, wrong argument counts, etc. they are shown in a [location list window][location-list].
16
16
17
17
* When a syntax error is found (during highlighting or using the rename functionality) the lines where the error is reported will be marked like a spelling error.
18
18
19
19

20
20
21
21
## Installation
22
22
23
-
Unzip the most recent [ZIP archive](http://peterodding.com/code/vim/downloads/lua-inspect.zip) file 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). Now try it out: Edit a Lua file and within a few seconds semantic highlighting should be enabled automatically!
23
+
*Please note that the vim-lua-inspect plug-in requires my vim-misc plug-in which is separately distributed.*
24
24
25
-
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](http://peterodding.com/code/vim/shell/) plug-in which includes a [DLL](http://en.wikipedia.org/wiki/Dynamic-link_library) that works around this issue. Once you've installed both plug-ins it should work out of the box!
25
+
Unzip the most recent ZIP archives of the [vim-lua-inspect][download-lua-inspect] and [vim-misc][download-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).
26
+
27
+
If you prefer you can also use [Pathogen][pathogen], [Vundle][vundle] or a similar tool to install & update the [vim-lua-inspect][github-lua-inspect] and [vim-misc][github-misc] plug-ins using a local clone of the git repository.
28
+
29
+
Now try it out: Edit a Lua file and within a few seconds semantic highlighting should be enabled automatically!
30
+
31
+
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][vim-shell] plug-in which includes a [DLL][dll] that works around this issue. Once you've installed both plug-ins it should work out of the box!
26
32
27
33
## Usage
28
34
@@ -45,7 +51,7 @@ You don't need to use this command unless you've disabled automatic highlighting
If you don't like one or more of the default styles the Vim documentation [describes how to change them](http://vimdoc.sourceforge.net/htmldoc/syntax.html#:hi-default). If you want to disable the semantic highlighting in a specific Vim buffer execute `:LuaInspect!` in that buffer. When you want to re-enable the highlighting execute `:LuaInspect` again, but now without the [bang](http://vimdoc.sourceforge.net/htmldoc/map.html#:command-bang).
54
+
If you don't like one or more of the default styles the Vim documentation [describes how to change them][hi-default]. If you want to disable the semantic highlighting in a specific Vim buffer execute `:LuaInspect!` in that buffer. When you want to re-enable the highlighting execute `:LuaInspect` again, but now without the [bang (!)][bang].
49
55
50
56
### The `:LuaInspectToggle` command
51
57
@@ -60,19 +66,19 @@ By default the semantic highlighting and the warning messages in the location li
60
66
61
67
### The `g:loaded_luainspect` option
62
68
63
-
This variable isn't really an option but if you want to avoid loading the `luainspect.vim` plug-in you can set this variable to any value in your [vimrc script](http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc):
69
+
This variable isn't really an option but if you want to avoid loading the `luainspect.vim` plug-in you can set this variable to any value in your [vimrc script][vimrc]:
64
70
65
71
:let g:loaded_luainspect = 1
66
72
67
73
### The `g:lua_inspect_warnings` option
68
74
69
-
When LuaInspect reports warnings about unused variables, wrong argument counts, etc. they are automatically shown in a [location list window](http://vimdoc.sourceforge.net/htmldoc/quickfix.html#location-list). If you don't like this add the following to your [vimrc script](http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc):
75
+
When LuaInspect reports warnings about unused variables, wrong argument counts, etc. they are automatically shown in a [location list window][location-list]. If you don't like this add the following to your [vimrc script][vimrc]:
70
76
71
77
:let g:lua_inspect_warnings = 0
72
78
73
79
### The `g:lua_inspect_events` option
74
80
75
-
By default semantic highlighting is automatically enabled after a short timeout and when you save a buffer. If you want to disable automatic highlighting altogether add the following to your [vimrc script](http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc):
81
+
By default semantic highlighting is automatically enabled after a short timeout and when you save a buffer. If you want to disable automatic highlighting altogether add the following to your [vimrc script][vimrc]:
76
82
77
83
:let g:lua_inspect_events = ''
78
84
@@ -84,18 +90,36 @@ Note that this only works when the plug-in is loaded (or reloaded) *after* setti
84
90
85
91
### The `g:lua_inspect_internal` option
86
92
87
-
The plug-in uses the Lua interface for Vim when available so that it doesn't have to run LuaInspect as an external program (which can slow things down). If you insist on running LuaInspect as an external program you can set this variable to false (0) in your [vimrc script](http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc):
93
+
The plug-in uses the Lua interface for Vim when available so that it doesn't have to run LuaInspect as an external program (which can slow things down). If you insist on running LuaInspect as an external program you can set this variable to false (0) in your [vimrc script][vimrc]:
88
94
89
95
:let g:lua_inspect_internal = 0
90
96
91
97
## Contact
92
98
93
-
If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/lua-inspect/> and <http://github.com/xolox/vim-lua-inspect>. If you like this plug-in please vote for it on [Vim Online](http://www.vim.org/scripts/script.php?script_id=3169).
99
+
If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/lua-inspect/> and <http://github.com/xolox/vim-lua-inspect>. If you like this plug-in please vote for it on [Vim Online][vim-online].
94
100
95
101
## License
96
102
97
-
This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).
103
+
This software is licensed under the [MIT license][mit].
0 commit comments