vim-patch:8.1.1593: filetype not detected for C++ header files without extension

Problem:    Filetype not detected for C++ header files without extension.
Solution:   Recognize the file by the Emacs file mode. (Dmitry Ilyin,
            closes vim/vim#4593)
6a7af8e2db
This commit is contained in:
Jan Edmund Lazo
2019-06-25 21:20:19 -04:00
parent 10c983fabe
commit 62c7fcbdab
2 changed files with 11 additions and 4 deletions

View File

@@ -212,6 +212,11 @@ else
elseif s:line1 =~# '^" *[vV]im$'
set ft=vim
" libcxx and libstdc++ standard library headers like "iostream" do not have
" an extension, recognize the Emacs file mode.
elseif s:line1 =~? '-\*-.*C++.*-\*-'
set ft=cpp
" MOO
elseif s:line1 =~# '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$'
set ft=moo

View File

@@ -581,6 +581,8 @@ let s:script_checks = {
\ 'cfengine': [['#!/path/cfengine']],
\ 'erlang': [['#!/path/escript']],
\ 'haskell': [['#!/path/haskell']],
\ 'cpp': [['// Standard iostream objects -*- C++ -*-'],
\ ['// -*- C++ -*-']],
\ }
func Test_script_detection()