diff options
Diffstat (limited to 'runtime/filetype.lua')
-rw-r--r-- | runtime/filetype.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/filetype.lua b/runtime/filetype.lua index 35bb31edce..7728892c78 100644 --- a/runtime/filetype.lua +++ b/runtime/filetype.lua @@ -13,7 +13,13 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { group = 'filetypedetect', callback = function(args) local ft, on_detect = vim.filetype.match({ buf = args.buf }) - if ft then + if not ft then + -- Generic configuration file used as fallback + ft = require('vim.filetype.detect').conf(args.file, args.buf) + if ft then + vim.api.nvim_cmd({ cmd = 'setf', args = { 'FALLBACK', ft } }, {}) + end + else vim.api.nvim_buf_set_option(args.buf, 'filetype', ft) if on_detect then on_detect(args.buf) |