Skip to content

Fix: Check source buffer filetype before performing source-based filetype detection - #2

Merged
103sbavert merged 2 commits into
mainfrom
fix/warning-on-virtual-buffer
Jul 16, 2026
Merged

Fix: Check source buffer filetype before performing source-based filetype detection#2
103sbavert merged 2 commits into
mainfrom
fix/warning-on-virtual-buffer

Conversation

@103sbavert

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 16, 2026 07:44
@103sbavert
103sbavert merged commit b7d2686 into main Jul 16, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the SourcePath BufNewFile/BufRead autocmd behavior to gate whether chezmoi_edit:on_edit() runs based on the buffer’s existing filetype.

Changes:

  • Adds a guard in the SourcePath autocmd callback to return early when the buffer filetype is empty.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/nvim-chezmoi/init.lua
Comment on lines +58 to 65
local b = ev.buf
local b_ftype = vim.bo[b].filetype

if not b_ftype or b_ftype == "" then
return
end

chezmoi_edit:on_edit(ev.buf)
@103sbavert
103sbavert deleted the fix/warning-on-virtual-buffer branch July 16, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants