diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2023-08-24 21:39:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-24 21:39:57 -0500 |
commit | 0b0d912763890652c20d219ad92ab8d91195ca02 (patch) | |
tree | e0d30128164df9d8216c8c6a2610ef178c767000 /runtime/filetype.lua | |
parent | 5b4f1f56c350995521aafa60419b93708de80fd9 (diff) | |
parent | af38b46a2574f59358bc3bf54dd7c34b5c0f396d (diff) | |
download | rneovim-0b0d912763890652c20d219ad92ab8d91195ca02.tar.gz rneovim-0b0d912763890652c20d219ad92ab8d91195ca02.tar.bz2 rneovim-0b0d912763890652c20d219ad92ab8d91195ca02.zip |
Merge pull request #24864 from gpanders/filetype-on-detect-order
Diffstat (limited to 'runtime/filetype.lua')
-rw-r--r-- | runtime/filetype.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/filetype.lua b/runtime/filetype.lua index cf5fe39656..4a4f37a1c4 100644 --- a/runtime/filetype.lua +++ b/runtime/filetype.lua @@ -18,12 +18,15 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, { end) end else - vim.api.nvim_buf_call(args.buf, function() - vim.api.nvim_cmd({ cmd = 'setf', args = { ft } }, {}) - end) + -- on_detect is called before setting the filetype so that it can set any buffer local + -- variables that may be used the filetype's ftplugin if on_detect then on_detect(args.buf) end + + vim.api.nvim_buf_call(args.buf, function() + vim.api.nvim_cmd({ cmd = 'setf', args = { ft } }, {}) + end) end end, }) |