Skip to content

Instantly share code, notes, and snippets.

@Artturin
Created February 24, 2026 14:05
Show Gist options
  • Select an option

  • Save Artturin/abb14bcd40c259a89696fb8fe30b314f to your computer and use it in GitHub Desktop.

Select an option

Save Artturin/abb14bcd40c259a89696fb8fe30b314f to your computer and use it in GitHub Desktop.
Only attach copilot.lua in git repos
require("copilot").setup({
should_attach = function(_, _)
local obj = vim.system({ "git", "-C", vim.fn.expand("%:p:h"), "rev-parse", "--is-inside-work-tree" }, { text = true }):wait()
if obj.code == 0 then
return true
else
return false
end
end,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment