Skip to content

fix(preview): avoid ftplugin side effects in scratch preview buffers#335

Merged
dmtrKovalenko merged 1 commit intodmtrKovalenko:mainfrom
anmonteiro:anmonteiro/picker-highlighter
Apr 4, 2026
Merged

fix(preview): avoid ftplugin side effects in scratch preview buffers#335
dmtrKovalenko merged 1 commit intodmtrKovalenko:mainfrom
anmonteiro:anmonteiro/picker-highlighter

Conversation

@anmonteiro
Copy link
Copy Markdown
Contributor

@anmonteiro anmonteiro commented Apr 4, 2026

noticed that e.g. my Merlin plugin was being loaded while cycling through file results in the picker.

this does what telescope does, it avoids running the filetype events and just loads the filetype highlighter.

@dmtrKovalenko dmtrKovalenko merged commit db4cd28 into dmtrKovalenko:main Apr 4, 2026
38 checks passed
@anmonteiro anmonteiro deleted the anmonteiro/picker-highlighter branch April 4, 2026 16:06
@mrcjkb
Copy link
Copy Markdown
Contributor

mrcjkb commented Apr 11, 2026

I don't think this is a good change.

Reason: This forces preview highlighting on the user.
Neovim's philosophy allows the user to configure syntax highlighting on ftplugin events. For example, I may want to conditionally enable tree-sitter highlighting depending on the file size in languages with slow parsers or inefficient queries. With tree-sitter highlighting enabled unconditionally, preview scratch buffers can really slow down the UI.

Before this change, fff.nvim already set all the right properties to prevent side-effects like starting LSP clients.

If this is about lazy-loading plugins:
See :h lua-plugin-lazy.
If a plugin is misbehaving in a scratch buffer because it emits a filetype event, that should be fixed in the plugin (e.g. it can check the buftype property).

There is nothing in :h filetype that states that scratch/preview buffers cannot have a filetype. Another example of buffers that have filetypes are fugitive.vim diffs.

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.

3 participants