Skip to content

Only define autocmds for lua files #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ftplugin/lua.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 <buffer> call xolox#lua#tweakoptions()
autocmd BufWritePost <buffer> call xolox#lua#autocheck()
augroup END

" }}}1

" Let Vim know how to disable the plug-in.
Expand Down
8 changes: 0 additions & 8 deletions plugin/lua-ftplugin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ endtry
command! -bar LuaCheckSyntax call xolox#lua#checksyntax()
command! -bar -bang LuaCheckGlobals call xolox#lua#checkglobals(<q-bang> == '!')

" 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

Expand Down