Skip to content

Unnecessary shell invocations causing massive lag if using interactive shells #163

@Lamby777

Description

@Lamby777

Description

I already fixed this on my fork, but didn't bother opening a PR since the commits are based on my PR #118 from 2023 which still hasn't been looked at... :(

Setting vim.opt.shellcmdflag to make your shell interactive causes the git commands used by this plugin to cause annoying stutters when switching buffers and stuff. This is because the plugin implicitly invokes a shell by passing a string to vim.fn.system(xxxxx), whereas passing a table of arguments can avoid invoking the shell entirely. Git provides a -C flag to specify current working dir, so invoking a shell and running cd is not necessary.

See the commit on my personal fork for an example.

Apparently docs say to prefer vim.system over vim.fn.system as well for Lua, but I didn't want to mess with that and break anything.

Neovim version

NVIM v0.11.2
Build type: RelWithDebInfo
LuaJIT 2.1.1753364724

OS information

Arch Linux, kernel 6.15.8

Steps to reproduce

n/a, i found the source of the bug ^^^

Logs

(it doesn't print anything)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions