diff --git a/README.md b/README.md index 69ce7f3..23e200e 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,18 @@ You don't need to use this command unless you've disabled automatic highlighting * luaInspectWrongArgCount * luaInspectSyntaxError -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). +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). + +### The `:LuaInspectToggle` command + +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: + + " Don't enable the lua-inspect plug-in automatically in Lua buffers. + let g:lua_inspect_events = '' + + " Enable/disable the lua-inspect plug-in manually using . + imap :LuaInspectToggle + nmap :LuaInspectToggle ### The `g:loaded_luainspect` option diff --git a/autoload/xolox/luainspect.vim b/autoload/xolox/luainspect.vim index 1f0b869..7c59fc6 100644 --- a/autoload/xolox/luainspect.vim +++ b/autoload/xolox/luainspect.vim @@ -1,9 +1,19 @@ " Vim script. " Author: Peter Odding -" Last Change: September 26, 2011 +" Last Change: November 16, 2011 " URL: http://peterodding.com/code/vim/lua-inspect/ -let g:xolox#luainspect#version = '0.4.13' +let g:xolox#luainspect#version = '0.4.14' + +function! xolox#luainspect#toggle_cmd() " {{{1 + if !(exists('b:luainspect_disabled') && b:luainspect_disabled) + " Enabled -> disabled. + call xolox#luainspect#highlight_cmd(1) + else + " Disabled -> enabled. + call xolox#luainspect#highlight_cmd(0) + endif +endfunction function! xolox#luainspect#auto_enable() " {{{1 if !&diff && !exists('b:luainspect_disabled') diff --git a/doc/luainspect.txt b/doc/luainspect.txt index fc84171..310a8d9 100644 --- a/doc/luainspect.txt +++ b/doc/luainspect.txt @@ -90,9 +90,28 @@ current buffer using one of the following highlighting groups: If you don't like one or more of the default styles the Vim documentation describes how to change them (see |: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| +buffer. When you want to re-enable the highlighting execute |:LuaInspect| again, but now without the bang (see |:command-bang|). +------------------------------------------------------------------------------- +The *:LuaInspectToggle* command + +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: +> + " Don't enable the lua-inspect plug-in automatically in Lua buffers. + let g:lua_inspect_events = '' + + " Enable/disable the lua-inspect plug-in manually using . + imap :LuaInspectToggle + nmap :LuaInspectToggle + ------------------------------------------------------------------------------- The *g:loaded_luainspect* option diff --git a/plugin/luainspect.vim b/plugin/luainspect.vim index 12b4db1..08dac52 100644 --- a/plugin/luainspect.vim +++ b/plugin/luainspect.vim @@ -1,6 +1,6 @@ " Vim plug-in " Author: Peter Odding -" Last Change: August 27, 2011 +" Last Change: November 15, 2011 " URL: http://peterodding.com/code/vim/lua-inspect/ " Support for automatic update using the GLVS plug-in. @@ -36,9 +36,12 @@ if !exists('g:lua_inspect_internal') let g:lua_inspect_internal = has('lua') endif -" This command updates highlighting when automatic highlighting is disabled. +" This command enables/updates highlighting when automatic highlighting is disabled. command! -bar -bang LuaInspect call xolox#luainspect#highlight_cmd( == '!') +" This command can be used as a toggle to enable/disable the highlighting. +command! -bar LuaInspectToggle call xolox#luainspect#toggle_cmd() + " Automatically enable the plug-in in Lua buffers. augroup PluginLuaInspect autocmd! FileType lua call xolox#luainspect#auto_enable()