1
This commit is contained in:
Alex Yatskov 2023-02-20 13:01:31 -08:00
parent 64ee7ec609
commit 6fe2301c89

View File

@ -1,4 +1,5 @@
local ArgonautConfig = {
local argonaut_configs = {
default = {
line_prefix = '',
padded_braces = {},
tail_comma = false,
@ -8,14 +9,46 @@ local ArgonautConfig = {
comma_first = false,
comma_first_indent = false,
}
}
local function setup(opts)
local function setup(opts, filetypes)
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 = argonaut_configs[filetype]
if not config then
config = {}
argonaut_configs[filetype] = config
end
for key, value in pairs(opts) do
ArgonautConfig[key] = value
config[key] = value
end
end
end
end
local function get_config()
local file_config = argonaut_configs[vim.bo.filetype]
local config = {}
for key, value in pairs(argonaut_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
local function get_cursor_pos()
local _, row, col, _ = unpack(vim.fn.getpos('.'))
@ -262,5 +295,5 @@ end
return {
reflow = reflow,
ssetup = setup,
setup = setup,
}