aboutsummaryrefslogtreecommitdiff
path: root/vim/ftdetect
diff options
context:
space:
mode:
Diffstat (limited to 'vim/ftdetect')
-rw-r--r--vim/ftdetect/;12
-rw-r--r--vim/ftdetect/php.vim8
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