Open atweiden opened 1 year ago
I think the logic would be clearer if the call to wincmd p
was right after lwindow
. Then you don't need the if
or multiple points of return.
Can you provide example code? I’m open to making that change, but I don’t see how to restrict calling wincmd p
without a conditional check of the err
variable. For example, after setting g:zig_fmt_autoswitch
to 0, this would result in calling wincmd p
even if no location list were present:
execute 'silent! lwindow ' . win_height
if !get(g:, 'zig_fmt_autoswitch', 1)
wincmd p
endif
I also don’t see what to do with the echohl Error
line without conditionally checking the err
variable.
Set
g:zig_fmt_autoswitch
to 0 in your vimrc to disable automatically switching to the location list if/whenzig fmt
encounters code formatting errors.When set to 0,
g:zig_fmt_autoswitch
configures the Vim cursor to remain where it was prior to runningzig fmt
. The location list — which gets populated with code formatting errors as per normal — can then be viewed at a glance, without losing focus.Either don’t set
g:zig_fmt_autoswitch
at all, or set it to 1, to keep the current behaviour of this plugin.