Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e59882

Browse files
committed
Tackle pull request #4: Allow alternative mappings
1 parent d7fb876 commit 0e59882

File tree

4 files changed

+80
-16
lines changed

4 files changed

+80
-16
lines changed

‎README.md‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Note that on Windows a command prompt window pops up whenever LuaInspect is run
3434

3535
When you open any Lua file the semantic highlighting should be enabled automatically within a few seconds, so you don't have to configure anything if you're happy with the defaults.
3636

37+
## Commands
38+
3739
### The `:LuaInspect` command
3840

3941
You don't need to use this command unless you've disabled automatic highlighting using `g:lua_inspect_events`. When you execute this command the plug-in runs the LuaInspect tool and then highlights all variables in the current buffer using one of the following highlighting groups:
@@ -64,12 +66,27 @@ By default the semantic highlighting and the warning messages in the location li
6466
imap <F6> <C-o>:LuaInspectToggle<CR>
6567
nmap <F6> :LuaInspectToggle<CR>
6668

69+
### The `:LuaInspectRename` command
70+
71+
This command renames the variable under the cursor. It's used to define the `<F2>` mapping and can be used if you don't like the default mappings and want to define your own.
72+
73+
### The `:LuaInspectGoTo` command
74+
75+
This command jumps to the definition of the variable under the cursor. It's used to define the `gd` mapping and can be used if you don't like the default mappings and want to define your own.
76+
77+
## Options
78+
6779
### The `g:loaded_luainspect` option
6880

6981
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]:
7082

7183
:let g:loaded_luainspect = 1
7284

85+
86+
### The `g:lua_inspect_mappings` option
87+
88+
If this is set to true (1, the default value) then the `<F2>` and `gd` mappings are defined in Lua buffers (as buffer local mappings). You can set it to false (0) to disable the default mappings (so you can define your own).
89+
7390
### The `g:lua_inspect_warnings` option
7491

7592
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]:
@@ -100,8 +117,8 @@ If you have questions, bug reports, suggestions, etc. the author can be contacte
100117

101118
## License
102119

103-
This software is licensed under the [MIT license] [mit].
104-
© 2013 Peter Odding &lt;<peter@peterodding.com>&gt;.
120+
This software is licensed under the [MIT license] [mit].
121+
© 2014 Peter Odding &lt;<peter@peterodding.com>&gt;.
105122

106123
The source code repository and distributions contain bundled copies of
107124
LuaInspect and Metalua, please refer to their licenses (also included).

‎autoload/xolox/luainspect.vim‎

Lines changed: 7 additions & 5 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: August 19, 2013
3+
" Last Change: June 17, 2014
44
" URL: http://peterodding.com/code/vim/lua-inspect/
55

6-
let g:xolox#luainspect#version = '0.5.1'
6+
let g:xolox#luainspect#version = '0.5.2'
77

88
function! xolox#luainspect#toggle_cmd() " {{{1
99
if !(exists('b:luainspect_disabled') && b:luainspect_disabled)
@@ -20,9 +20,11 @@ function! xolox#luainspect#auto_enable() " {{{1
2020
" Disable easytags.vim because it doesn't play nice with luainspect.vim!
2121
let b:easytags_nohl = 1
2222
" Define buffer local mappings for rename / goto definition features.
23-
inoremap <buffer> <silent> <F2> <C-o>:call xolox#luainspect#make_request('rename')<CR>
24-
nnoremap <buffer> <silent> <F2> :call xolox#luainspect#make_request('rename')<CR>
25-
nnoremap <buffer> <silent> gd :call xolox#luainspect#make_request('go_to')<CR>
23+
if g:lua_inspect_mappings
24+
inoremap <buffer> <silent> <F2> <C-o>:LuaInspectRename<CR>
25+
nnoremap <buffer> <silent> <F2> :LuaInspectRename<CR>
26+
nnoremap <buffer> <silent> gd :LuaInspectGoTo<CR>
27+
endif
2628
" Enable balloon evaluation / dynamic tool tips.
2729
if has('balloon_eval')
2830
setlocal ballooneval balloonexpr=LuaInspectToolTip()

‎doc/luainspect.txt‎

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ Contents ~
66
1. Introduction |luainspect-introduction|
77
2. Installation |luainspect-installation|
88
3. Usage |luainspect-usage|
9+
4. Commands |luainspect-commands|
910
1. The |:LuaInspect| command
1011
2. The |:LuaInspectToggle| command
11-
3. The |g:loaded_luainspect| option
12-
4. The |g:lua_inspect_warnings| option
13-
5. The |g:lua_inspect_events| option
14-
6. The |g:lua_inspect_internal| option
15-
4. Contact |luainspect-contact|
16-
5. License |luainspect-license|
17-
6. References |luainspect-references|
12+
3. The |:LuaInspectRename| command
13+
4. The |:LuaInspectGoTo| command
14+
5. Options |luainspect-options|
15+
1. The |g:loaded_luainspect| option
16+
2. The |g:lua_inspect_mappings| option
17+
3. The |g:lua_inspect_warnings| option
18+
4. The |g:lua_inspect_events| option
19+
5. The |g:lua_inspect_internal| option
20+
6. Contact |luainspect-contact|
21+
7. License |luainspect-license|
22+
8. References |luainspect-references|
1823

1924
===============================================================================
2025
*luainspect-introduction*
@@ -85,6 +90,10 @@ When you open any Lua file the semantic highlighting should be enabled
8590
automatically within a few seconds, so you don't have to configure anything if
8691
you're happy with the defaults.
8792

93+
===============================================================================
94+
*luainspect-commands*
95+
Commands ~
96+
8897
-------------------------------------------------------------------------------
8998
The *:LuaInspect* command
9099

@@ -130,6 +139,24 @@ of choice in your |vimrc| script though. For example:
130139
imap <F6> <C-o>:LuaInspectToggle<CR>
131140
nmap <F6> :LuaInspectToggle<CR>
132141
<
142+
-------------------------------------------------------------------------------
143+
The *:LuaInspectRename* command
144+
145+
This command renames the variable under the cursor. It's used to define the
146+
'<F2>' mapping and can be used if you don't like the default mappings and want
147+
to define your own.
148+
149+
-------------------------------------------------------------------------------
150+
The *:LuaInspectGoTo* command
151+
152+
This command jumps to the definition of the variable under the cursor. It's
153+
used to define the 'gd' mapping and can be used if you don't like the default
154+
mappings and want to define your own.
155+
156+
===============================================================================
157+
*luainspect-options*
158+
Options ~
159+
133160
-------------------------------------------------------------------------------
134161
The *g:loaded_luainspect* option
135162

@@ -139,6 +166,13 @@ script:
139166
>
140167
:let g:loaded_luainspect = 1
141168
<
169+
-------------------------------------------------------------------------------
170+
The *g:lua_inspect_mappings* option
171+
172+
If this is set to true (1, the default value) then the '<F2>' and 'gd' mappings
173+
are defined in Lua buffers (as buffer local mappings). You can set it to false
174+
(0) to disable the default mappings (so you can define your own).
175+
142176
-------------------------------------------------------------------------------
143177
The *g:lua_inspect_warnings* option
144178

@@ -188,7 +222,7 @@ lua-inspect. If you like this plug-in please vote for it on Vim Online [14].
188222
*luainspect-license*
189223
License ~
190224

191-
This software is licensed under the MIT license [15]. Š 2013 Peter Odding
225+
This software is licensed under the MIT license [15]. Š 2014 Peter Odding
192226
<peter@peterodding.com>.
193227

194228
The source code repository and distributions contain bundled copies of

‎plugin/luainspect.vim‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim plug-in
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: August 19, 2013
3+
" Last Change: June 17, 2014
44
" URL: http://peterodding.com/code/vim/lua-inspect/
55

66
" Support for automatic update using the GLVS plug-in.
@@ -24,6 +24,11 @@ catch
2424
finish
2525
endtry
2626

27+
if !exists('g:lua_inspect_mappings')
28+
" Change this to disable default key mappings.
29+
let g:lua_inspect_mappings = 1
30+
endif
31+
2732
if !exists('g:lua_inspect_warnings')
2833
" Change this to disable automatic warning messages.
2934
let g:lua_inspect_warnings = 1
@@ -55,6 +60,12 @@ command! -bar -bang LuaInspect call xolox#luainspect#highlight_cmd(<q-bang> == '
5560
" This command can be used as a toggle to enable/disable the highlighting.
5661
command! -bar LuaInspectToggle call xolox#luainspect#toggle_cmd()
5762

63+
" This command can be used to rename variables.
64+
command! -bar LuaInspectRename call xolox#luainspect#make_request('rename')
65+
66+
" This command can be used to jump to a variable's definition.
67+
command! -bar LuaInspectGoTo call xolox#luainspect#make_request('go_to')
68+
5869
" Automatically enable the plug-in in Lua buffers.
5970
augroup PluginLuaInspect
6071
autocmd! FileType lua call xolox#luainspect#auto_enable()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /