Mercurial > vim
comparison runtime/filetype.vim @ 32623:2cd120c9daba v9.0.1643
patch 9.0.1643: filetype detection fails if file name ends in many '~'
Commit: https://github.com/vim/vim/commit/c12e4eecbb26cedca96e0810d3501043356eebaa
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 22 12:18:57 2023 +0100
patch 9.0.1643: filetype detection fails if file name ends in many '~'
Problem: Filetype detection fails if file name ends in many '~'.
Solution: Strip multiple '~' at the same time. (closes https://github.com/vim/vim/issues/12553)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 22 Jun 2023 13:30:05 +0200 |
parents | c659c4a5aae2 |
children | eeed0045eff4 |
comparison
equal
deleted
inserted
replaced
32622:dfe2a1a0824c | 32623:2cd120c9daba |
---|---|
19 if exists("*fnameescape") | 19 if exists("*fnameescape") |
20 au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew,?\+.pacsave,?\+.pacnew | 20 au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew,?\+.pacsave,?\+.pacnew |
21 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) | 21 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) |
22 au BufNewFile,BufRead *~ | 22 au BufNewFile,BufRead *~ |
23 \ let s:name = expand("<afile>") | | 23 \ let s:name = expand("<afile>") | |
24 \ let s:short = substitute(s:name, '\~$', '', '') | | 24 \ let s:short = substitute(s:name, '\~\+$', '', '') | |
25 \ if s:name != s:short && s:short != "" | | 25 \ if s:name != s:short && s:short != "" | |
26 \ exe "doau filetypedetect BufRead " . fnameescape(s:short) | | 26 \ exe "doau filetypedetect BufRead " . fnameescape(s:short) | |
27 \ endif | | 27 \ endif | |
28 \ unlet! s:name s:short | 28 \ unlet! s:name s:short |
29 au BufNewFile,BufRead ?\+.in | 29 au BufNewFile,BufRead ?\+.in |