Fix up options
This commit is contained in:
parent
fd03ed5973
commit
df6ecf04bd
@ -1,16 +1,15 @@
|
|||||||
local configs = {
|
local configs = {
|
||||||
default = {
|
default = {
|
||||||
|
brace_last_indent = false,
|
||||||
|
brace_last_wrap = true,
|
||||||
|
brace_pad = true,
|
||||||
|
comma_last = false,
|
||||||
|
comma_prefix = false,
|
||||||
|
comma_prefix_indent = false,
|
||||||
line_prefix = '',
|
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 = {
|
go = {
|
||||||
tail_comma = true,
|
comma_last = true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ function WrapContext:wrap()
|
|||||||
local last_param = i == #self.params.parsed
|
local last_param = i == #self.params.parsed
|
||||||
|
|
||||||
local line = ''
|
local line = ''
|
||||||
if self.opt.comma_first then
|
if self.opt.comma_prefix then
|
||||||
line = line .. self.indent .. self.opt.line_prefix
|
line = line .. self.indent .. self.opt.line_prefix
|
||||||
if not first_param then
|
if not first_param then
|
||||||
line = line .. ', '
|
line = line .. ', '
|
||||||
@ -378,12 +378,12 @@ function WrapContext:wrap()
|
|||||||
line = line .. param.text
|
line = line .. param.text
|
||||||
else
|
else
|
||||||
line = line .. self.indent .. self.opt.line_prefix .. param.text
|
line = line .. self.indent .. self.opt.line_prefix .. param.text
|
||||||
if not last_param or self.opt.tail_comma then
|
if not last_param or self.opt.comma_last then
|
||||||
line = line .. ','
|
line = line .. ','
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if last_param and not self.opt.wrap_closing_brace then
|
if last_param and not self.opt.brace_last_wrap then
|
||||||
line = line .. self.suffix
|
line = line .. self.suffix
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ function WrapContext:wrap()
|
|||||||
row = row + 1
|
row = row + 1
|
||||||
vim.fn.execute(string.format('%d>', row))
|
vim.fn.execute(string.format('%d>', row))
|
||||||
|
|
||||||
if first_param and self.opt.comma_first_indent then
|
if first_param and self.opt.comma_prefix_indent then
|
||||||
local prev_shiftwidth = vim.o.shiftwidth
|
local prev_shiftwidth = vim.o.shiftwidth
|
||||||
vim.o.shiftwidth = prev_shiftwidth - 2
|
vim.o.shiftwidth = prev_shiftwidth - 2
|
||||||
vim.fn.execute(string.format('%d>', row))
|
vim.fn.execute(string.format('%d>', row))
|
||||||
@ -404,8 +404,11 @@ function WrapContext:wrap()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.opt.wrap_closing_brace then
|
if self.opt.brace_last_wrap then
|
||||||
vim.fn.append(row, self.indent .. self.suffix)
|
vim.fn.append(row, self.indent .. self.suffix)
|
||||||
|
if self.opt.brace_last_indent then
|
||||||
|
vim.fn.execute(string.format('%d>', row + 1))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if cursor then
|
if cursor then
|
||||||
|
Loading…
Reference in New Issue
Block a user