[Question/Feature Request]: `chop_down_parameter` and `align_parameter`
Configuration
column_limit: 90
indent_width: 2
use_tab: false
tab_width: 4
continuation_indent_width: 4
keep_simple_control_block_one_line: false
keep_simple_function_one_line: false
align_args: true
align_parameter: false
align_table_field: true
spaces_before_call: 1
spaces_inside_functioncall_parens: false
spaces_inside_functiondef_parens: false
spaces_inside_table_braces: true
spaces_around_equals_in_field: true
chop_down_parameter: true
chop_down_table: true
chop_down_kv_table: true
break_after_functioncall_lp: true
break_before_functioncall_rp: true
break_after_functiondef_lp: true
break_before_functiondef_rp: true
break_after_table_lb: true
break_before_table_rb: true
break_after_operator: true
table_sep: ","
extra_sep_at_table_end: true
double_quote_to_single_quote: false
single_quote_to_double_quote: true
line_breaks_after_function_body: 1
column_table_limit: 80
line_separator: lf
Example 1
If I have something like the following:
Issue
map(
"t", self.cfg.layout_mapping, function()
api.nvim_win_set_config(
self.winid, M.get_view(self.cfg.views[g.__lf_layout_idx])
)
g.__lf_layout_idx = g.__lf_layout_idx < #self.cfg.views and g.__lf_layout_idx +
1 or 1
end
)
How could I get it to break each parameter onto its own line (similar to something like rustfmt)
I've tried modifying several configuration options but could not get it to work. I thought
the most relevant options here would be chop_down_parameter and align_parameter, but they don't
do what I was expecting.
Maybe another option could be given to the configuration
Solution
map(
"t",
self.cfg.layout_mapping,
function()
api.nvim_win_set_config(
self.winid, M.get_view(self.cfg.views[g.__lf_layout_idx])
)
g.__lf_layout_idx = g.__lf_layout_idx < #self.cfg.views and g.__lf_layout_idx +
1 or 1
end
)
For instance lua-fmt breaks down each line, but lacks
configurability.
Example 2
I have something like:
Issue
self.term.cmd = ([[%s -last-dir-path='%s' -selection-path='%s' %s]]):format(
self.term.cmd, self.lastdir_tmp, self.lf_tmp, self.term.dir
)
I would expect that an option in the configuration file could 'chop' down each parameter onto its own line resulting in something like:
Solution
self.term.cmd =
([[%s -last-dir-path='%s' -selection-path='%s' %s]]):format(
self.term.cmd,
self.lastdir_tmp,
self.lf_tmp,
self.term.dir
)
On a side note, I see the Chop down operators #205 issue, which would make the call look even nicer
Like
map(
"t",
self.cfg.layout_mapping,
function()
api.nvim_win_set_config(
self.winid, M.get_view(self.cfg.views[g.__lf_layout_idx])
)
g.__lf_layout_idx = g.__lf_layout_idx < #self.cfg.views
and g.__lf_layout_idx + 1
or 1
end
)