diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-09-03 19:27:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-03 19:27:57 +0200 |
commit | 927d4d2a15b8474cd6c605df65ef53873cf73131 (patch) | |
tree | 981409e86ba3f095e2033fbb8c3bf60a1f36dbed /runtime/filetype.lua | |
parent | c50460cf3b02f8e684d038a1ea37e6fdc2d13a09 (diff) | |
download | rneovim-927d4d2a15b8474cd6c605df65ef53873cf73131.tar.gz rneovim-927d4d2a15b8474cd6c605df65ef53873cf73131.tar.bz2 rneovim-927d4d2a15b8474cd6c605df65ef53873cf73131.zip |
fix(filetype): run filetype.match on StdinReadPost (#20070)
Problem: filetype detection does not run on piped input
Solution: add `StdinReadPost` to main filetype.lua autocommand
Rationale: legacy filetype detection checked contents by sourcing
`scripts.vim` in separate autocommands, including on `StdinReadPost`.
For Lua filetype detection, this was moved into the main autocommand,
with bundled `scripts.vim` gated behind `g:do_legacy_filetype` (i.e.,
only user `scripts.vim` are sourced for compatibility by default). Adding
`StdinReadPost` to the main autocommand again runs content checks on
piped input without requiring code duplication and low-payoff
refactoring.
Diffstat (limited to 'runtime/filetype.lua')
-rw-r--r-- | runtime/filetype.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/filetype.lua b/runtime/filetype.lua index 9f5b5fd0dc..c50ba6453d 100644 --- a/runtime/filetype.lua +++ b/runtime/filetype.lua @@ -6,7 +6,7 @@ vim.g.did_load_filetypes = 1 vim.api.nvim_create_augroup('filetypedetect', { clear = false }) -vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { +vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, { group = 'filetypedetect', callback = function(args) local ft, on_detect = vim.filetype.match({ filename = args.match, buf = args.buf }) |