niklaas / lightline-gitdiff

Show added, deleted and modified lines (`git diff`) in your statusline or lightline
Other
27 stars 4 forks source link

Causes a nonzero exit status when used in combination with `vipe` #19

Open niklaas opened 9 months ago

niklaas commented 9 months ago
❯ ls | vipe | xargs echo
nvim exited nonzero, aborting
niklaas commented 9 months ago

Closing with :w and then :q works as expected while closing with :wq causes the error.

niklaas commented 9 months ago

https://github.com/niklaas/lightline-gitdiff/blob/287ffdd019948ebeae88be783e3d7e37aecb3cc9/autoload/lightline/gitdiff/utils.vim#L33

is the culprit because it's the last call which updates v:shell_error. When vim is opened using vipe, this isn't within a git repository, so the exit code is nonzero. This will be leaked to vim's exit code.

I haven't found a clever way to prevent this yet since v:shell_error is read only and there's no way to circumvent it.

niklaas commented 9 months ago

OK, for the time being, my workaround is not to add the plugin as the last one since that seems not to call the call system mentioned above as the very last one. 😅