blob: 2604257594c964c5611e9899da90108c533d677f [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file.
Bram Moolenaar519cc552021-11-16 19:18:26 +00002" Language: Lua
3" Maintainer: Doug Kearns <dougkearns@gmail.com>
4" Previous Maintainer: Max Ischenko <mfi@ukr.net>
5" Last Change: 2021 Nov 15
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7" Only do this when not done yet for this buffer
8if exists("b:did_ftplugin")
9 finish
10endif
11
12" Don't load another plugin for this buffer
13let b:did_ftplugin = 1
14
Bram Moolenaarf1568ec2011-12-14 21:17:39 +010015let s:cpo_save = &cpo
16set cpo&vim
17
Bram Moolenaar071d4272004-06-13 20:20:40 +000018" Set 'formatoptions' to break comment lines but not other lines, and insert
19" the comment leader when hitting <CR> or using "o".
Bram Moolenaar519cc552021-11-16 19:18:26 +000020setlocal formatoptions-=t formatoptions+=croql
Bram Moolenaar071d4272004-06-13 20:20:40 +000021
Bram Moolenaar519cc552021-11-16 19:18:26 +000022setlocal comments=:--
23setlocal commentstring=--%s
Bram Moolenaar071d4272004-06-13 20:20:40 +000024setlocal suffixesadd=.lua
25
Bram Moolenaar519cc552021-11-16 19:18:26 +000026let b:undo_ftplugin = "setlocal fo< com< cms< sua<"
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaar519cc552021-11-16 19:18:26 +000028if exists("loaded_matchit") && !exists("b:match_words")
Bram Moolenaar071d4272004-06-13 20:20:40 +000029 let b:match_ignorecase = 0
30 let b:match_words =
Bram Moolenaar519cc552021-11-16 19:18:26 +000031 \ '\<\%(do\|function\|if\)\>:' .
32 \ '\<\%(return\|else\|elseif\)\>:' .
33 \ '\<end\>,' .
34 \ '\<repeat\>:\<until\>,' .
35 \ '\%(--\)\=\[\(=*\)\[:]\1]'
36 let b:undo_ftplugin .= " | unlet! b:match_words b:match_ignorecase"
37endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000038
Bram Moolenaar519cc552021-11-16 19:18:26 +000039if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
40 let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\n" .
41 \ "All Files (*.*)\t*.*\n"
42 let b:undo_ftplugin .= " | unlet! b:browsefilter"
43endif
Bram Moolenaarf1568ec2011-12-14 21:17:39 +010044
45let &cpo = s:cpo_save
46unlet s:cpo_save