Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

New :LuaInspectToggle command

  • Loading branch information...
commit 1ed6e7aa1466ba59932740079f40db1412493fed 1 parent befaf4b
Peter Odding authored November 16, 2011
13  README.md
Source Rendered
@@ -45,7 +45,18 @@ You don't need to use this command unless you've disabled automatic highlighting
45 45
  * <span style="border-bottom: 1px dotted green">luaInspectWrongArgCount</span>
46 46
  * <span style="border-bottom: 1px dotted red">luaInspectSyntaxError</span>
47 47
 
48  
-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 reenable the highlighting execute `:LuaInspect` again, but now without the [bang](http://vimdoc.sourceforge.net/htmldoc/map.html#:command-bang).
  48
+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).
  49
+
  50
+### The `:LuaInspectToggle` command
  51
+
  52
+By default the semantic highlighting and the warning messages in the location list window are automatically applied to Lua buffers and updated every once in a while, but this can be disabled by setting `g:lua_inspect_events` to an empty string in your [vimrc script] [vimrc]. If the plug-in is not automatically enabled then it may be useful to enable/disable it using a key mapping. That's what the `:LuaInspectToggle` command is for. You still have to define your key mapping of choice in your [vimrc script] [vimrc] though. For example:
  53
+
  54
+    " Don't enable the lua-inspect plug-in automatically in Lua buffers.
  55
+    let g:lua_inspect_events = ''
  56
+
  57
+    " Enable/disable the lua-inspect plug-in manually using <F6>.
  58
+    imap <F6> <C-o>:LuaInspectToggle<CR>
  59
+    nmap <F6>      :LuaInspectToggle<CR>
49 60
 
50 61
 ### The `g:loaded_luainspect` option
51 62
 
14  autoload/xolox/luainspect.vim
... ...
@@ -1,9 +1,19 @@
1 1
 " Vim script.
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: September 26, 2011
  3
+" Last Change: November 16, 2011
4 4
 " URL: http://peterodding.com/code/vim/lua-inspect/
5 5
 
6  
-let g:xolox#luainspect#version = '0.4.13'
  6
+let g:xolox#luainspect#version = '0.4.14'
  7
+
  8
+function! xolox#luainspect#toggle_cmd() " {{{1
  9
+  if !(exists('b:luainspect_disabled') && b:luainspect_disabled)
  10
+    " Enabled -> disabled.
  11
+    call xolox#luainspect#highlight_cmd(1)
  12
+  else
  13
+    " Disabled -> enabled.
  14
+    call xolox#luainspect#highlight_cmd(0)
  15
+  endif
  16
+endfunction
7 17
 
8 18
 function! xolox#luainspect#auto_enable() " {{{1
9 19
   if !&diff && !exists('b:luainspect_disabled')
21  doc/luainspect.txt
@@ -90,10 +90,29 @@ current buffer using one of the following highlighting groups:
90 90
 If you don't like one or more of the default styles the Vim documentation
91 91
 describes how to change them (see |:hi-default|). If you want to disable the
92 92
 semantic highlighting in a specific Vim buffer execute ':LuaInspect!' in that
93  
-buffer. When you want to reenable the highlighting execute |:LuaInspect|
  93
+buffer. When you want to re-enable the highlighting execute |:LuaInspect|
94 94
 again, but now without the bang (see |:command-bang|).
95 95
 
96 96
 -------------------------------------------------------------------------------
  97
+The *:LuaInspectToggle* command
  98
+
  99
+By default the semantic highlighting and the warning messages in the location
  100
+list window are automatically applied to Lua buffers and updated every once in
  101
+a while, but this can be disabled by setting |g:lua_inspect_events| to an
  102
+empty string in your [vimrc script] [vimrc]. If the plug-in is not
  103
+automatically enabled then it may be useful to enable/disable it using a key
  104
+mapping. That's what the |:LuaInspectToggle| command is for. You still have to
  105
+define your key mapping of choice in your [vimrc script] [vimrc] though. For
  106
+example:
  107
+>
  108
+    " Don't enable the lua-inspect plug-in automatically in Lua buffers.
  109
+    let g:lua_inspect_events = ''
  110
+    
  111
+    " Enable/disable the lua-inspect plug-in manually using <F6>.
  112
+    imap <F6> <C-o>:LuaInspectToggle<CR>
  113
+    nmap <F6>      :LuaInspectToggle<CR>
  114
+
  115
+-------------------------------------------------------------------------------
97 116
 The *g:loaded_luainspect* option
98 117
 
99 118
 This variable isn't really an option but if you want to avoid loading the
7  plugin/luainspect.vim
... ...
@@ -1,6 +1,6 @@
1 1
 " Vim plug-in
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: August 27, 2011
  3
+" Last Change: November 15, 2011
4 4
 " URL: http://peterodding.com/code/vim/lua-inspect/
5 5
 
6 6
 " Support for automatic update using the GLVS plug-in.
@@ -36,9 +36,12 @@ if !exists('g:lua_inspect_internal')
36 36
   let g:lua_inspect_internal = has('lua')
37 37
 endif
38 38
 
39  
-" This command updates highlighting when automatic highlighting is disabled.
  39
+" This command enables/updates highlighting when automatic highlighting is disabled.
40 40
 command! -bar -bang LuaInspect call xolox#luainspect#highlight_cmd(<q-bang> == '!')
41 41
 
  42
+" This command can be used as a toggle to enable/disable the highlighting.
  43
+command! -bar LuaInspectToggle call xolox#luainspect#toggle_cmd()
  44
+
42 45
 " Automatically enable the plug-in in Lua buffers.
43 46
 augroup PluginLuaInspect
44 47
   autocmd! FileType lua call xolox#luainspect#auto_enable()

0 notes on commit 1ed6e7a

Please sign in to comment.
Something went wrong with that request. Please try again.