patch 9.1.1327: filetype: nroff detection can be improved

Problem:  filetype: nroff detection can be improved
Solution: improve nroff detection (Eisuke Kawashima)

- explicitly check roff comments and macros typically found in manpages
- do not try to detect alphabetically-sectioned files, except for n, as
  nroff
    - l: > 'l' happens to be a section for historical reasons
         <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391977>
    - n: e.g. /usr/share/man/mann/Tcl.n.gz
    - o: unsure (perhaps fedora-specific)
    - p: unsure (perhaps fedora-specific)

closes: #17160

Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Eisuke Kawashima
2025-04-21 10:51:05 +02:00
committed by Christian Brabandt
parent 187df69fd1
commit 2cb42efc18
4 changed files with 21 additions and 8 deletions

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2025 Apr 19
" Last Change: 2025 Apr 21
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Listen very carefully, I will say this only once
@ -1728,7 +1728,7 @@ au BufNewFile,BufRead *.me
\ setf nroff |
\ endif
au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff
au BufNewFile,BufRead *.[0-9],*.[013]p,*.[1-8]x,*.3{am,perl,pm,posix,type},*.[nlop] call dist#ft#FTnroff()
au BufNewFile,BufRead *.[0-9],*.[013]p,*.[1-8]x,*.3{am,perl,pm,posix,type},*.n call dist#ft#FTnroff()
" Nroff or Objective C++
au BufNewFile,BufRead *.mm call dist#ft#FTmm()