diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-03 01:17:10 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-03 01:17:51 +1200 |
commit | f7d0e7bed7f8ef8ca11c2564ccb1b6e40e5fcaaa (patch) | |
tree | 83ddc7b36e8aa149fcd4519606e0eb4d445d4881 /vim/ftdetect | |
parent | Refine shebangs in filetype detection (diff) | |
download | dotfiles-f7d0e7bed7f8ef8ca11c2564ccb1b6e40e5fcaaa.tar.gz dotfiles-f7d0e7bed7f8ef8ca11c2564ccb1b6e40e5fcaaa.zip |
Add shebang and opening tag detect for PHP
Diffstat (limited to 'vim/ftdetect')
-rw-r--r-- | vim/ftdetect/; | 12 | ||||
-rw-r--r-- | vim/ftdetect/php.vim | 8 |
2 files changed, 20 insertions, 0 deletions
diff --git a/vim/ftdetect/; b/vim/ftdetect/; new file mode 100644 index 00000000..f57ba0e6 --- /dev/null +++ b/vim/ftdetect/; @@ -0,0 +1,12 @@ +" PHP files +autocmd BufNewFile,BufRead + \ *.php + \ setfiletype php +autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '\m^#!.\<php\>' + \ | setfiletype php + \ | endif + \ | if getline(1) =~? '\m^<?php\>' + \ | setfiletype php + \ | endif diff --git a/vim/ftdetect/php.vim b/vim/ftdetect/php.vim index f28c7ab4..f57ba0e6 100644 --- a/vim/ftdetect/php.vim +++ b/vim/ftdetect/php.vim @@ -2,3 +2,11 @@ autocmd BufNewFile,BufRead \ *.php \ setfiletype php +autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '\m^#!.\<php\>' + \ | setfiletype php + \ | endif + \ | if getline(1) =~? '\m^<?php\>' + \ | setfiletype php + \ | endif |