diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-09-18 07:34:35 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-18 07:34:35 -0400 |
| commit | 4f9ccb1e2aabe874c8d8e99326d06953ede71b68 (patch) | |
| tree | 18feace4a9608f778816db1f0c91467efc734fd3 /runtime/lua/vim/provider/python.lua | |
| parent | 60a613a997c4fbd4b895f306b3b8dd9a9abf3249 (diff) | |
| download | rneovim-4f9ccb1e2aabe874c8d8e99326d06953ede71b68.tar.gz rneovim-4f9ccb1e2aabe874c8d8e99326d06953ede71b68.tar.bz2 rneovim-4f9ccb1e2aabe874c8d8e99326d06953ede71b68.zip | |
fix(restart): missing 'filetype' after session load #41975
Problem:
A buffer loaded (`bufload()`) from a (`BufAdd nested=false`) autocmd
does not trigger `BufReadPost` (which does filetype-detection). Then
'filetype' is never set.
A session file does `:badd` on all buffers:
:badd +0 a.md
:badd +0 b.md
:edit a.md
If a mystery plugin(?) loads the buffers via `bufload()` from the
`nested=false BufAdd` autocmd triggered by those `:badd` calls, filetype
detection never happens.
Solution:
When `BufReadPost` was skipped and 'filetype' is empty, retry the
`filetypedetect` augroup.
`do_write` uses a similar approach:
https://github.com/neovim/neovim/blob/9047ee1460ede5aa8b0f0807c15bb554f5dcb8f1/src/nvim/ex_cmds.c#L1964-L1967
Note: Intentionally not using ":filetype detect".
- It silently re-enables detection when the user turned it off.
- It runs `do_modelines` again (redundant).
- It loses the `<afile>` name.
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions