lua.vim 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. " Tyler Miller <tmillr@proton.me>
  8. " Last Change: 2024 Jan 14
  9. if exists("b:did_ftplugin")
  10. finish
  11. endif
  12. let b:did_ftplugin = 1
  13. let s:cpo_save = &cpo
  14. set cpo&vim
  15. setlocal comments=:---,:--
  16. setlocal commentstring=--\ %s
  17. setlocal formatoptions-=t formatoptions+=croql
  18. let &l:define = '\<function\|\<local\%(\s\+function\)\='
  19. " TODO: handle init.lua
  20. setlocal includeexpr=tr(v:fname,'.','/')
  21. setlocal suffixesadd=.lua
  22. let b:undo_ftplugin = "setlocal cms< com< def< fo< inex< sua<"
  23. if exists("loaded_matchit") && !exists("b:match_words")
  24. let b:match_ignorecase = 0
  25. let b:match_words =
  26. \ '\<\%(do\|function\|if\)\>:' ..
  27. \ '\<\%(return\|else\|elseif\)\>:' ..
  28. \ '\<end\>,' ..
  29. \ '\<repeat\>:\<until\>,' ..
  30. \ '\%(--\)\=\[\(=*\)\[:]\1]'
  31. let b:undo_ftplugin ..= " | unlet! b:match_words b:match_ignorecase"
  32. endif
  33. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  34. let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\n"
  35. if has("win32")
  36. let b:browsefilter ..= "All Files (*.*)\t*\n"
  37. else
  38. let b:browsefilter ..= "All Files (*)\t*\n"
  39. endif
  40. let b:undo_ftplugin ..= " | unlet! b:browsefilter"
  41. endif
  42. let &cpo = s:cpo_save
  43. unlet s:cpo_save
  44. " vim: nowrap sw=2 sts=2 ts=8 noet: