lua.vim 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. " Vim filetype plugin file.
  2. " Language: Lua
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Previous Maintainer: Max Ischenko <mfi@ukr.net>
  5. " Contributor: Dorai Sitaram <ds26@gte.com>
  6. " C.D. MacEachern <craig.daniel.maceachern@gmail.com>
  7. " Last Change: 2022 Nov 19
  8. if exists("b:did_ftplugin")
  9. finish
  10. endif
  11. let b:did_ftplugin = 1
  12. let s:cpo_save = &cpo
  13. set cpo&vim
  14. setlocal comments=:--
  15. setlocal commentstring=--\ %s
  16. setlocal formatoptions-=t formatoptions+=croql
  17. let &l:define = '\<function\|\<local\%(\s\+function\)\='
  18. " TODO: handle init.lua
  19. setlocal includeexpr=tr(v:fname,'.','/')
  20. setlocal suffixesadd=.lua
  21. let b:undo_ftplugin = "setlocal cms< com< def< fo< inex< sua<"
  22. if exists("loaded_matchit") && !exists("b:match_words")
  23. let b:match_ignorecase = 0
  24. let b:match_words =
  25. \ '\<\%(do\|function\|if\)\>:' ..
  26. \ '\<\%(return\|else\|elseif\)\>:' ..
  27. \ '\<end\>,' ..
  28. \ '\<repeat\>:\<until\>,' ..
  29. \ '\%(--\)\=\[\(=*\)\[:]\1]'
  30. let b:undo_ftplugin ..= " | unlet! b:match_words b:match_ignorecase"
  31. endif
  32. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  33. let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\n" ..
  34. \ "All Files (*.*)\t*.*\n"
  35. let b:undo_ftplugin ..= " | unlet! b:browsefilter"
  36. endif
  37. let &cpo = s:cpo_save
  38. unlet s:cpo_save
  39. " vim: nowrap sw=2 sts=2 ts=8 noet: