# HG changeset patch # User zegervdv # Date 1659645551 -7200 # Node ID 1e6287df57f5c936588dfee54b4bab5ec538f477 # Parent a2a5862a3bd3b168e4d942454f56f81b64f0565c abort filetypo when there are no matches diff -r a2a5862a3bd3 -r 1e6287df57f5 dot_config/nvim/plugin/filetypo.lua --- a/dot_config/nvim/plugin/filetypo.lua Thu Jul 28 22:25:29 2022 +0200 +++ b/dot_config/nvim/plugin/filetypo.lua Thu Aug 04 22:39:11 2022 +0200 @@ -5,7 +5,11 @@ local filename = vim.fn.expand '%' local matching_files = vim.fn.split(vim.fn.glob(filename .. '*', 0), '\n') - if matching_files == nil then matching_files = vim.fn.split(vim.fn.glob(filename .. '*', 1), '\n') end + if matching_files == nil or vim.tbl_isempty(matching_files) then + matching_files = vim.fn.split(vim.fn.glob(filename .. '*', 1), '\n') + end + + if matching_files == nil or vim.tbl_isempty(matching_files) then return end local buf = vim.api.nvim_get_current_buf() vim.schedule(function()