comparison runtime/scripts.vim @ 17188:93cb37b45636 v8.1.1593

patch 8.1.1593: filetype not detected for C++ header files without extension commit https://github.com/vim/vim/commit/6a7af8e2dbcb768a768831d9e6355c855c215ebc Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 25 21:34:26 2019 +0200 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 #4593)
author Bram Moolenaar <Bram@vim.org>
date Tue, 25 Jun 2019 21:45:05 +0200
parents acd7eaa13d2b
children 432714f5c0f7
comparison
equal deleted inserted replaced
17187:3e79aa490556 17188:93cb37b45636
193 193
194 " Bourne-like shell scripts: sh ksh bash bash2 194 " Bourne-like shell scripts: sh ksh bash bash2
195 if s:line1 =~# '^:$' 195 if s:line1 =~# '^:$'
196 call dist#ft#SetFileTypeSH(s:line1) " defined in filetype.vim 196 call dist#ft#SetFileTypeSH(s:line1) " defined in filetype.vim
197 197
198 " Z shell scripts 198 " Z shell scripts
199 elseif s:line1 =~# '^#compdef\>' || s:line1 =~# '^#autoload\>' || 199 elseif s:line1 =~# '^#compdef\>' || s:line1 =~# '^#autoload\>' ||
200 \ "\n".s:line1."\n".s:line2."\n".s:line3."\n".s:line4."\n".s:line5 =~# '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' 200 \ "\n".s:line1."\n".s:line2."\n".s:line3."\n".s:line4."\n".s:line5 =~# '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>'
201 set ft=zsh 201 set ft=zsh
202 202
203 " ELM Mail files 203 " ELM Mail files
204 elseif s:line1 =~# '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' 204 elseif s:line1 =~# '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$'
205 set ft=mail 205 set ft=mail
206 206
207 " Mason 207 " Mason
208 elseif s:line1 =~# '^<[%&].*>' 208 elseif s:line1 =~# '^<[%&].*>'
209 set ft=mason 209 set ft=mason
210 210
211 " Vim scripts (must have '" vim' as the first line to trigger this) 211 " Vim scripts (must have '" vim' as the first line to trigger this)
212 elseif s:line1 =~# '^" *[vV]im$' 212 elseif s:line1 =~# '^" *[vV]im$'
213 set ft=vim 213 set ft=vim
214 214
215 " MOO 215 " libcxx and libstdc++ standard library headers like "iostream" do not have
216 " an extension, recognize the Emacs file mode.
217 elseif s:line1 =~? '-\*-.*C++.*-\*-'
218 set ft=cpp
219
220 " MOO
216 elseif s:line1 =~# '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' 221 elseif s:line1 =~# '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$'
217 set ft=moo 222 set ft=moo
218 223
219 " Diff file: 224 " Diff file:
220 " - "diff" in first line (context diff) 225 " - "diff" in first line (context diff)