1
argonaut.nvim/lua/argonaut/config.lua

60 lines
1.3 KiB
Lua
Raw Normal View History

2024-04-20 16:29:45 +00:00
local configs = {
default = {
line_prefix = '',
padded_braces = {},
tail_comma = false,
tail_comma_braces = {},
tail_indent_braces = {},
wrap_closing_brace = true,
comma_first = false,
comma_first_indent = false,
},
go = {
tail_comma = true,
}
}
2024-04-20 19:16:54 +00:00
local function set(opts, filetypes)
2024-04-20 16:29:45 +00:00
if opts then
if type(filetypes) == 'string' then
filetypes = {filetypes}
elseif not filetypes then
filetypes = {'default'}
end
for _, filetype in ipairs(filetypes) do
local config = configs[filetype]
if not config then
config = {}
configs[filetype] = config
end
for key, value in pairs(opts) do
config[key] = value
end
end
end
end
2024-04-20 19:16:54 +00:00
local function get()
2024-04-20 16:29:45 +00:00
local file_config = configs[vim.bo.filetype]
local config = {}
for key, value in pairs(configs.default) do
config[key] = value
if file_config then
local file_value = file_config[key]
if file_value ~= nil then
config[key] = file_config[key]
end
end
end
return config
end
return {
2024-04-20 19:16:54 +00:00
set = set,
get = get,
2024-04-20 16:29:45 +00:00
}