Skip to content

nvim-lint triggers a full lint run on BufEnter — linters spawn on every buffer switch #160

@ooloth

Description

@ooloth

Current state

lua/config/plugins/specs/nvim-lint.lua registers lint.try_lint() on both BufEnter and BufWritePost. BufEnter fires every time the user switches to any buffer — including switching windows, opening help pages, and navigating the file tree — causing a full lint process to spawn on each transition regardless of whether the buffer's content has changed.

Ideal state

  • Linting is triggered only on BufWritePost (and optionally InsertLeave for a real-time feel after leaving insert mode).
  • BufEnter is removed from the autocmd event list.
  • No lint processes are spawned when the user switches windows or opens a non-editable buffer.

Starting points

  • lua/config/plugins/specs/nvim-lint.lua — the autocmd registration listing BufEnter alongside BufWritePost

QA plan

  1. Open lua/config/plugins/specs/nvim-lint.lua. Expect to see BufEnter in the autocmd event list passed to nvim_create_autocmd.
  2. After the fix, read the file. Expect BufEnter to be absent; BufWritePost (and optionally InsertLeave) remain.
  3. Start Neovim, open a linted file, and switch to another window. Expect no linter process to be spawned (observable via :lua print(vim.inspect(require('lint').get_running())) returning an empty table immediately after the switch).
  4. Save the linted file. Expect lint.try_lint() to run and diagnostics to appear normally.

Done when

lint.try_lint() is not invoked when the user switches buffers or windows — only after a file save (and optionally after leaving insert mode).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions