lua.vim 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. " Vim filetype plugin file.
  2. " Language: Lua
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Previous Maintainer: Max Ischenko <mfi@ukr.net>
  5. " Last Change: 2021 Nov 15
  6. " Only do this when not done yet for this buffer
  7. if exists("b:did_ftplugin")
  8. finish
  9. endif
  10. " Don't load another plugin for this buffer
  11. let b:did_ftplugin = 1
  12. let s:cpo_save = &cpo
  13. set cpo&vim
  14. " Set 'formatoptions' to break comment lines but not other lines, and insert
  15. " the comment leader when hitting <CR> or using "o".
  16. setlocal formatoptions-=t formatoptions+=croql
  17. setlocal comments=:--
  18. setlocal commentstring=--%s
  19. setlocal suffixesadd=.lua
  20. let b:undo_ftplugin = "setlocal fo< com< cms< sua<"
  21. if exists("loaded_matchit") && !exists("b:match_words")
  22. let b:match_ignorecase = 0
  23. let b:match_words =
  24. \ '\<\%(do\|function\|if\)\>:' .
  25. \ '\<\%(return\|else\|elseif\)\>:' .
  26. \ '\<end\>,' .
  27. \ '\<repeat\>:\<until\>,' .
  28. \ '\%(--\)\=\[\(=*\)\[:]\1]'
  29. let b:undo_ftplugin .= " | unlet! b:match_words b:match_ignorecase"
  30. endif
  31. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  32. let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\n" .
  33. \ "All Files (*.*)\t*.*\n"
  34. let b:undo_ftplugin .= " | unlet! b:browsefilter"
  35. endif
  36. let &cpo = s:cpo_save
  37. unlet s:cpo_save