aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-01 18:43:30 +0800
committerGitHub <noreply@github.com>2024-04-01 18:43:30 +0800
commit381806729db1016106b02d866c4f4f64f76a351f (patch)
treec6adb451a97faec543f4499a703a40730fba4007 /runtime/lua
parent2e97ae26647cb52e028d59a6e4e57d28c93e6283 (diff)
downloadrneovim-381806729db1016106b02d866c4f4f64f76a351f.tar.gz
rneovim-381806729db1016106b02d866c4f4f64f76a351f.tar.bz2
rneovim-381806729db1016106b02d866c4f4f64f76a351f.zip
vim-patch:9.0.1643: filetype detection fails if file name ends in many '~' (#28141)
Problem: Filetype detection fails if file name ends in many '~'. Solution: Strip multiple '~' at the same time. (closes vim/vim#12553) https://github.com/vim/vim/commit/c12e4eecbb26cedca96e0810d3501043356eebaa In Nvim this already works as Lua filetype detection isn't subject to such a small recursion limit as autocommands, but it still makes sense to avoid unnecessary recursion. Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/vim/filetype.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 86374b26e5..190071bbc7 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -2064,7 +2064,7 @@ local pattern = {
['%.?zsh.*'] = starsetf('zsh'),
-- Ignored extension
['.*~'] = function(path, bufnr)
- local short = path:gsub('~$', '', 1)
+ local short = path:gsub('~+$', '', 1)
if path ~= short and short ~= '' then
return M.match({ buf = bufnr, filename = fn.fnameescape(short) })
end