Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

neovim/lua/std/ftoptions.lua

Raw
-- per-filetype options harvested from the builtin vimscript ftplugins
-- ( nvim 0.12, before the ftplugin kill ) then filtered to pure-data options.
-- deliberately dropped: omnifunc ( LSP owns it ), includeexpr ( vimscript/autoload ),
-- cinkeys/cinwords ( cindent is off, treesitter indents ).
-- commentstring lives in std.commentstring. edit freely.
local ftoptions = {
	["c"] = {
		comments = [[sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,:///,://]],
		define = [[^\s*#\s*define]],
		formatoptions = [[jcroql]],
		include = [[^\s*#\s*include]],
		path = [[.,/usr/include,,**]],
	},
	["cpp"] = {
		comments = [[sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,:///,://]],
		define = [[^\s*#\s*define]],
		formatoptions = [[jcroql]],
		include = [[^\s*#\s*include]],
		path = [[.,/usr/include,,**]],
	},
	["css"] = {
		comments = [[s1:/*,mb:*,ex:*/]],
		formatoptions = [[jcroql]],
		include = [[^\s*@import\s\+\%(url(\)\=]],
	},
	["html"] = {
		comments = [[s:<!--,m:    ,e:-->]],
		matchpairs = [[(:),{:},[:],<:>]],
	},
	["java"] = {
		comments = [[:///,sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-,fb:•]],
		define = [[\C\m^\s*\%(\%(\%(@\%(interface\)\@!\%(\K\k*\.\)*\K\k*\)\s\+\)*\%(p\%(rivate\|rotected\|ublic\)\s\+\)\=\)\@>\%(\%(\%(abstract\|final\|non-sealed\|s\%(ealed\|tatic\|trictfp\)\)\s\+\)*\%(class\|enum\|@\=interface\|record\)\s\+\ze\K\k*\>\|\%(\%(abstract\|default\|final\|native\|s\%(tatic\|trictfp\|ynchronized\)\)\s\+\)*\%(<.\{-1,}>\s\+\)\=\%(\K\k*\.\)*\K\k*\s*\%(<.\{-1,}>\%(\s\|\[\)\@=\)\=\s*\%(\[\]\s*\)*\s\+\ze\%(\<\%(assert\|case\|instanceof\|new\|return\|throw\|when\)\s\+\)\@18<!\K\k*\s*(\)]],
		formatoptions = [[jcroql]],
		include = [[\C\m^\s*import\s\+\ze\%(\K\k*\.\)\+\K\k*;]],
		suffixesadd = [[.java]],
	},
	["javascript"] = {
		comments = [[sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://]],
		define = [[\(^\s*(*async\s\+function\|(*function\)\|^\s*\(\*\|static\|async\|get\|set\|\i\+\.\)\|^\s*\(\ze\i\+\)\(([^)]*).*{$\|\s*[:=,]\)\|^\s*\(export\s\+\|export\s\+default\s\+\)*\(var\|let\|const\|function\|class\)\|\<as\>]],
		formatoptions = [[jcroql]],
		suffixesadd = [[.js,.jsx,.es,.es6,.cjs,.mjs,.jsm,.vue,.json]],
	},
	["javascriptreact"] = {
		comments = [[sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://]],
		define = [[\(^\s*(*async\s\+function\|(*function\)\|^\s*\(\*\|static\|async\|get\|set\|\i\+\.\)\|^\s*\(\ze\i\+\)\(([^)]*).*{$\|\s*[:=,]\)\|^\s*\(export\s\+\|export\s\+default\s\+\)*\(var\|let\|const\|function\|class\)\|\<as\>]],
		formatoptions = [[jcroql]],
		suffixesadd = [[.js,.jsx,.es,.es6,.cjs,.mjs,.jsm,.vue,.json]],
	},
	["json"] = {
		formatoptions = [[cqj]],
	},
	["jsonc"] = {
		comments = [[sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://]],
		formatoptions = [[cqj]],
	},
	["ocaml"] = {
		comments = [[sr:(**,mb:  ,ex:*),sr:(* ,mb: ,ex:*)]],
		formatoptions = [[cqort]],
		iskeyword = [[@,48-57,_,192-255,-,',`]],
	},
	["roc"] = {
		comments = [[:##,:#]],
	},
	["rust"] = {
		comments = [[s0:/*!,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://]],
		formatoptions = [[croqnlj]],
		include = [[\v^\s*(pub\s+)?use\s+\zs(\f|:)+]],
		matchpairs = [[(:),{:},[:],<:>]],
		suffixesadd = [[.rs]],
	},
	["scss"] = {
		comments = [[s1:/*,mb:*,ex:*/,://]],
		define = [[^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@=]],
		include = [[^\s*@import\s\+\%(url(\)\=["']\=]],
		suffixesadd = [[.sass,.scss,.css]],
	},
	["typescript"] = {
		comments = [[sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://]],
		formatoptions = [[jcroql]],
		iskeyword = [[@,48-57,_,192-255,-,$,#]],
		suffixesadd = [[.ts,.d.ts,.tsx,.js,.jsx,.cjs,.mjs]],
	},
	["typescriptreact"] = {
		comments = [[sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://]],
		formatoptions = [[jcroql]],
		iskeyword = [[@,48-57,_,192-255,-,$,#]],
		suffixesadd = [[.ts,.d.ts,.tsx,.js,.jsx,.cjs,.mjs]],
	},
	["zig"] = {
		comments = [[:///,://!,://]],
		define = [[\v(<fn>|<const>|<var>|^\s*\#\s*define)]],
		formatoptions = [[jcroql]],
		include = [[\v(\@import>|\@cInclude>|^\s*\#\s*include)]],
		iskeyword = [[@,48-57,_,192-255,-,@-@]],
		suffixesadd = [[.zig,.zir,.zon]],
	},
}

return ftoptions