diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 0ae0f9ca92..29412cee97 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -144,6 +144,9 @@ end local function detect_noext(path, bufnr) local root = fn.fnamemodify(path, ':r') + if root == path then + return + end return M.match({ buf = bufnr, filename = root }) end @@ -1258,8 +1261,7 @@ local extension = { ['dpkg-new'] = detect_noext, ['in'] = function(path, bufnr) if vim.fs.basename(path) ~= 'configure.in' then - local root = fn.fnamemodify(path, ':r') - return M.match({ buf = bufnr, filename = root }) + return detect_noext(path, bufnr) end end, new = detect_noext,