1
1
*luainspect.txt* Semantic highlighting for Lua in Vim
2
2
3
3
===============================================================================
4
- *luainspect-contents*
5
4
Contents ~
6
5
7
- 1. Introduction | luainspect-introduction |
8
- 2. Installation | luainspect-installation |
9
- 3. Usage | luainspect-usage |
6
+ 1. Introduction | luainspect-introduction |
7
+ 2. Installation | luainspect-installation |
8
+ 3. Usage | luainspect-usage |
10
9
1. The | :LuaInspect | command
11
10
2. The | :LuaInspectToggle | command
12
11
3. The | g:loaded_luainspect | option
13
12
4. The | g:lua_inspect_warnings | option
14
13
5. The | g:lua_inspect_events | option
15
14
6. The | g:lua_inspect_internal | option
16
- 4. Contact | luainspect-contact |
17
- 5. License | luainspect-license |
15
+ 4. Contact | luainspect-contact |
16
+ 5. License | luainspect-license |
17
+ 6. References | luainspect-references |
18
18
19
19
===============================================================================
20
- *luainspect-introduction*
20
+ *luainspect-introduction*
21
21
Introduction ~
22
22
23
23
The Vim plug-in 'luainspect.vim' uses the LuaInspect [1] tool to
@@ -26,38 +26,39 @@ It was inspired by lua2-mode [2] (for Emacs [3]) and the SciTE [4] plug-in
26
26
included with LuaInspect. In addition to the semantic highlighting the
27
27
following features are currently supported:
28
28
29
- - Press '<F2> ' with the text cursor on a variable and the plug-in will prompt
30
- you to rename the variable.
29
+ - Press '<F2> ' with the text cursor on a variable and the plug-in will prompt
30
+ you to rename the variable.
31
31
32
- - Press 'gd' (in normal mode) with the text cursor on a variable and you'll
33
- jump to its declaration / first occurrence.
32
+ - Press 'gd' (in normal mode) with the text cursor on a variable and you'll
33
+ jump to its declaration / first occurrence.
34
34
35
- - When you hover over a variable with the mouse cursor in graphical Vim,
36
- information about the variable is displayed in a tooltip.
35
+ - When you hover over a variable with the mouse cursor in graphical Vim,
36
+ information about the variable is displayed in a tooltip.
37
37
38
- - If the text cursor is on a variable while the highlighting is refreshed then
39
- all occurrences of the variable will be marked in the style of Vim's
40
- cursorline option (see | 'cursorline' | ).
38
+ - If the text cursor is on a variable while the highlighting is refreshed
39
+ then all occurrences of the variable will be marked in the style of Vim's
40
+ cursorline option (see | 'cursorline' | ).
41
41
42
- - When luainspect reports a wrong argument count for a function call the text
43
- will be highlighted with a green underline. When you hover over the
44
- highlighted text a tooltip shows the associated warning message.
42
+ - When luainspect reports a wrong argument count for a function call the text
43
+ will be highlighted with a green underline. When you hover over the
44
+ highlighted text a tooltip shows the associated warning message.
45
45
46
- - When LuaInspect reports warnings about unused variables, wrong argument
47
- counts, etc. they are shown in a location list window (see | location-list | ).
46
+ - When LuaInspect reports warnings about unused variables, wrong argument
47
+ counts, etc. they are shown in a location list window (see |location-
48
+ list|).
48
49
49
- - When a syntax error is found (during highlighting or using the rename
50
- functionality) the lines where the error is reported will be marked like a
51
- spelling error.
50
+ - When a syntax error is found (during highlighting or using the rename
51
+ functionality) the lines where the error is reported will be marked like a
52
+ spelling error.
52
53
53
- Screenshot of semantic highlighting, see reference [5]
54
+ Image: Screenshot of semantic highlighting ( see reference [5])
54
55
55
56
===============================================================================
56
- *luainspect-installation*
57
+ *luainspect-installation*
57
58
Installation ~
58
59
59
- Please note that the vim-lua-inspect plug-in requires my vim-misc plug-in
60
- which is separately distributed.
60
+ _Please note that the vim-lua-inspect plug-in requires my vim-misc plug-in
61
+ which is separately distributed._
61
62
62
63
Unzip the most recent ZIP archives of the vim-lua-inspect [6] and vim-misc [7]
63
64
plug-ins inside your Vim profile directory (usually this is '~/.vim' on UNIX
@@ -71,13 +72,13 @@ local clone of the git repository.
71
72
Now try it out: Edit a Lua file and within a few seconds semantic highlighting
72
73
should be enabled automatically!
73
74
74
- Note that on Windows a command prompt window pops up whenever LuaInspect is
75
- run as an external process. If this bothers you then you can install my
76
- shell.vim [12] plug-in which includes a DLL [13] that works around this issue.
77
- Once you've installed both plug-ins it should work out of the box!
75
+ Note that on Windows a command prompt window pops up whenever LuaInspect is run
76
+ as an external process. If this bothers you then you can install my shell.vim
77
+ [12] plug-in which includes a DLL [13] that works around this issue. Once
78
+ you've installed both plug-ins it should work out of the box!
78
79
79
80
===============================================================================
80
- *luainspect-usage*
81
+ *luainspect-usage*
81
82
Usage ~
82
83
83
84
When you open any Lua file the semantic highlighting should be enabled
@@ -92,29 +93,18 @@ highlighting using |g:lua_inspect_events|. When you execute this command the
92
93
plug-in runs the LuaInspect tool and then highlights all variables in the
93
94
current buffer using one of the following highlighting groups:
94
95
95
- - luaInspectGlobalDefined
96
-
97
- - luaInspectGlobalUndefined
98
-
99
- - luaInspectLocalUnused
100
-
101
- - luaInspectLocalMutated
102
-
103
- - luaInspectUpValue
104
-
105
- - luaInspectParam
106
-
107
- - luaInspectLocal
108
-
109
- - luaInspectFieldDefined
110
-
111
- - luaInspectFieldUndefined
112
-
113
- - luaInspectSelectedVariable
114
-
115
- - luaInspectWrongArgCount
116
-
117
- - luaInspectSyntaxError
96
+ - luaInspectGlobalDefined
97
+ - luaInspectGlobalUndefined
98
+ - luaInspectLocalUnused
99
+ - luaInspectLocalMutated
100
+ - luaInspectUpValue
101
+ - luaInspectParam
102
+ - luaInspectLocal
103
+ - luaInspectFieldDefined
104
+ - luaInspectFieldUndefined
105
+ - luaInspectSelectedVariable
106
+ - luaInspectWrongArgCount
107
+ - luaInspectSyntaxError
118
108
119
109
If you don't like one or more of the default styles the Vim documentation
120
110
describes how to change them (see | :hi-default | ). If you want to disable the
@@ -127,52 +117,52 @@ The *:LuaInspectToggle* command
127
117
128
118
By default the semantic highlighting and the warning messages in the location
129
119
list window are automatically applied to Lua buffers and updated every once in
130
- a while, but this can be disabled by setting | g:lua_inspect_events | to an
131
- empty string in your | vimrc | script. If the plug-in is not automatically enabled
132
- then it may be useful to enable/disable it using a key mapping. That's what
133
- the | :LuaInspectToggle | command is for. You still have to define your key
134
- mapping of choice in your | vimrc | script though. For example:
120
+ a while, but this can be disabled by setting | g:lua_inspect_events | to an empty
121
+ string in your | vimrc | script. If the plug-in is not automatically enabled then
122
+ it may be useful to enable/disable it using a key mapping. That's what the
123
+ | :LuaInspectToggle | command is for. You still have to define your key mapping
124
+ of choice in your | vimrc | script though. For example:
135
125
>
136
- " Don't enable the lua-inspect plug-in automatically in Lua buffers.
137
- let g:lua_inspect_events = ''
138
-
139
- " Enable/disable the lua-inspect plug-in manually using <F6>.
140
- imap <F6> <C-o>:LuaInspectToggle<CR>
141
- nmap <F6> :LuaInspectToggle<CR>
142
-
126
+ " Don't enable the lua-inspect plug-in automatically in Lua buffers.
127
+ let g:lua_inspect_events = ''
128
+
129
+ " Enable/disable the lua-inspect plug-in manually using <F6>.
130
+ imap <F6> <C-o>:LuaInspectToggle<CR>
131
+ nmap <F6> :LuaInspectToggle<CR>
132
+ <
143
133
-------------------------------------------------------------------------------
144
134
The *g:loaded_luainspect* option
145
135
146
136
This variable isn't really an option but if you want to avoid loading the
147
137
'luainspect.vim' plug-in you can set this variable to any value in your | vimrc |
148
138
script:
149
139
>
150
- :let g:loaded_luainspect = 1
151
-
140
+ :let g:loaded_luainspect = 1
141
+ <
152
142
-------------------------------------------------------------------------------
153
143
The *g:lua_inspect_warnings* option
154
144
155
- When LuaInspect reports warnings about unused variables, wrong argument
156
- counts, etc. they are automatically shown in a location list window (see
157
- | location- list| ). If you don't like this add the following to your | vimrc | script:
145
+ When LuaInspect reports warnings about unused variables, wrong argument counts,
146
+ etc. they are automatically shown in a location list window (see |location-
147
+ list| ). If you don't like this add the following to your | vimrc| script:
158
148
>
159
- :let g:lua_inspect_warnings = 0
160
-
149
+ :let g:lua_inspect_warnings = 0
150
+ <
161
151
-------------------------------------------------------------------------------
162
152
The *g:lua_inspect_events* option
163
153
164
- By default semantic highlighting is automatically enabled after a short
165
- timeout and when you save a buffer. If you want to disable automatic
166
- highlighting altogether add the following to your | vimrc | script:
154
+ By default semantic highlighting is automatically enabled after a short timeout
155
+ and when you save a buffer. If you want to disable automatic highlighting
156
+ altogether add the following to your | vimrc | script:
167
157
>
168
- :let g:lua_inspect_events = ''
169
-
158
+ :let g:lua_inspect_events = ''
159
+ <
170
160
You can also add events, for example if you also want to run | :LuaInspect | the
171
161
moment you edit a Lua file then try this:
172
162
>
173
- :let g:lua_inspect_events = 'CursorHold,CursorHoldI,BufReadPost,BufWritePost'
174
-
175
- Note that this only works when the plug-in is loaded (or reloaded) after
163
+ :let g:lua_inspect_events = 'CursorHold,CursorHoldI,BufReadPost,BufWritePost'
164
+ <
165
+ Note that this only works when the plug-in is loaded (or reloaded) _after_
176
166
setting the | g:lua_inspect_events | option.
177
167
178
168
-------------------------------------------------------------------------------
@@ -183,26 +173,26 @@ have to run LuaInspect as an external program (which can slow things down). If
183
173
you insist on running LuaInspect as an external program you can set this
184
174
variable to false (0) in your | vimrc | script:
185
175
>
186
- :let g:lua_inspect_internal = 0
187
-
176
+ :let g:lua_inspect_internal = 0
177
+ <
188
178
===============================================================================
189
- *luainspect-contact*
179
+ *luainspect-contact*
190
180
Contact ~
191
181
192
182
If you have questions, bug reports, suggestions, etc. the author can be
193
183
contacted at peter@peterodding.com. The latest version is available at
194
- http://peterodding.com/code/vim/lua-inspect/ and http://github.com/xolox/vim-lua-inspect .
195
- If you like this plug-in please vote for it on Vim Online [14] .
184
+ http://peterodding.com/code/vim/lua-inspect/ and http://github.com/xolox/vim -
185
+ lua-inspect. If you like this plug-in please vote for it on Vim Online [14] .
196
186
197
187
===============================================================================
198
- *luainspect-license*
188
+ *luainspect-license*
199
189
License ~
200
190
201
- This software is licensed under the MIT license [15] . Copyright 2013 Peter
202
- Odding <peter@peterodding.com>.
191
+ This software is licensed under the MIT license [15] . © 2013 Peter Odding
192
+ <peter@peterodding.com>.
203
193
204
194
===============================================================================
205
- *luainspect-references*
195
+ *luainspect-references*
206
196
References ~
207
197
208
198
[1] http://lua-users.org/wiki/LuaInspect
0 commit comments