From 48dce99ef66642cce337c71367b07d5345e2acf6 Mon Sep 17 00:00:00 2001 From: David Briscoe Date: Fri, 11 Aug 2017 11:26:49 -0700 Subject: [PATCH] Only define autocmds for lua files Fix #17. Limit automatic commands to check for syntax errors/undefined globals and change Vim's "completeopt" setting to lua buffers. --- ftplugin/lua.vim | 9 +++++++++ plugin/lua-ftplugin.vim | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ftplugin/lua.vim b/ftplugin/lua.vim index 3a53f25..2a573ce 100644 --- a/ftplugin/lua.vim +++ b/ftplugin/lua.vim @@ -94,6 +94,15 @@ if has('balloon_eval') call add(s:undo_ftplugin, 'setlocal ballooneval< balloonexpr<') endif +" Autocommands {{{1 +" Automatic commands to check for syntax errors and/or undefined globals +" and change Vim's "completeopt" setting on the fly for Lua buffers. +augroup PluginFileTypeLua + autocmd! + autocmd WinEnter call xolox#lua#tweakoptions() + autocmd BufWritePost call xolox#lua#autocheck() +augroup END + " }}}1 " Let Vim know how to disable the plug-in. diff --git a/plugin/lua-ftplugin.vim b/plugin/lua-ftplugin.vim index 05c6ce5..6164b76 100644 --- a/plugin/lua-ftplugin.vim +++ b/plugin/lua-ftplugin.vim @@ -29,14 +29,6 @@ endtry command! -bar LuaCheckSyntax call xolox#lua#checksyntax() command! -bar -bang LuaCheckGlobals call xolox#lua#checkglobals( == '!') -" Automatic commands to check for syntax errors and/or undefined globals -" and change Vim's "completeopt" setting on the fly for Lua buffers. -augroup PluginFileTypeLua - autocmd! - autocmd WinEnter * call xolox#lua#tweakoptions() - autocmd BufWritePost * call xolox#lua#autocheck() -augroup END - " Make sure the plug-in is only loaded once. let g:loaded_lua_ftplugin = 1