Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Now works on Windows and disables easytags.vim

 * When I tested luainspect.vim on Windows for the first time and found
   that it didn't work (using Vim 7.2 without if-lua) I realized Windows
   programs generally don't like single quoted arguments so I inverted
   all quotes and now it works :-D

 * My easytags.vim plug-in also performs dynamic highlighting (which is
   why it wasn't difficult for me to write the first prototype of
   luainspect.vim) and the two types of highlighting conflict with each
   other. Because I believe luainspect.vim to be of more value then the
   minimal highlighting done by easytags.vim I've disabled that.

 * Removed the workaround for the editor.LineCount reference in ast.lua
   since it's already fixed in luainspect HEAD. Thanks David!
  • Loading branch information...
commit ce2b578242ccf3d4eef658accc7e4711f34fbbbc 1 parent 3968548
@xolox authored
Showing with 9 additions and 15 deletions.
  1. +8 −8 luainspect.vim
  2. +1 −7 luainspect4vim.lua
View
16 luainspect.vim
@@ -1,6 +1,6 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: August 8, 2010
+" Last Change: August 10, 2010
" URL: http://peterodding.com/code/vim/lua-inspect/
" Version: 0.2.1
" License: MIT
@@ -46,19 +46,19 @@ command! -bar -bang LuaInspect call s:RunLuaInspect(<q-bang> == '!')
augroup PluginLuaInspect
" Clear existing automatic commands.
- autocmd!
+ autocmd!
+ " Disable easytags.vim because it doesn't play nice with luainspect.vim!
+ autocmd BufReadPost * if s:IsEnabled() | let b:easytags_nohl = 1 | endif
" Define the configured automatic commands.
for s:event in split(g:lua_inspect_events, ',')
- execute 'autocmd' s:event '* call s:AutoEnable()'
+ execute 'autocmd' s:event '* if s:IsEnabled() | LuaInspect | endif'
endfor
augroup END
" Script local functions. {{{1
-function! s:AutoEnable() " {{{2
- if &ft == 'lua' && !&diff && !exists('b:luainspect_disabled')
- LuaInspect
- end
+function! s:IsEnabled()
+ return &ft == 'lua' && !&diff && !exists('b:luainspect_disabled')
endfunction
function! s:RunLuaInspect(disable) " {{{2
@@ -78,7 +78,7 @@ function! s:RunLuaInspect(disable) " {{{2
if !(exists('b:luainspect_input') && b:luainspect_input == l:input)
if !(has('lua') && g:lua_inspect_internal)
" Run LuaInspect as an external program.
- let b:luainspect_output = system("lua -e 'require\"luainspect4vim\" (io.read \"*a\")'", l:input)
+ let b:luainspect_output = system('lua -e "require ''luainspect4vim'' (io.read ''*a'')"', l:input)
else
" Run LuaInspect using the Lua interface for Vim.
redir => b:luainspect_output
View
8 luainspect4vim.lua
@@ -3,7 +3,7 @@
This module is part of the luainspect.vim plug-in for the Vim text editor.
Author: Peter Odding <peter@peterodding.com>
- Last Change: August 7, 2010
+ Last Change: August 10, 2010
URL: http://peterodding.com/code/vim/lua-inspect/
License: MIT
@@ -46,13 +46,7 @@ return function(src)
src = LA.remove_shebang(src)
local f, err, linenum, colnum, linenum2 = LA.loadstring(src)
if not f then return end -- TODO Highlight syntax errors like spelling errors
- -- FIXME ast_from_string() references editor.LineCount
- local numlines = 1
- for _ in src:gmatch '\n' do numlines = numlines + 1 end
- local editor_save = _G.editor
- _G.editor = { lineCount = numlines }
local ast; ast, err, linenum, colnum, linenum2 = LA.ast_from_string(src, "noname.lua")
- _G.editor = editor_save
if not ast then return end
local tokenlist = LA.ast_to_tokenlist(ast, src)
LI.inspect(ast, tokenlist)
Please sign in to comment.
Something went wrong with that request. Please try again.