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

59 lines
1.3 KiB
Lua
Raw Normal View History

2024-04-20 16:29:45 +00:00
local configs = {
default = {
2024-04-27 03:36:40 +00:00
brace_last_indent = false,
brace_last_wrap = true,
2024-04-27 03:59:30 +00:00
brace_pad = false,
2024-04-27 03:36:40 +00:00
comma_last = false,
comma_prefix = false,
comma_prefix_indent = false,
2024-04-20 16:29:45 +00:00
line_prefix = '',
},
go = {
2024-04-27 03:36:40 +00:00
comma_last = true,
2024-04-27 03:59:30 +00:00
},
2024-04-20 16:29:45 +00:00
}
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
}