aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-03 01:17:10 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-03 01:17:51 +1200
commitf7d0e7bed7f8ef8ca11c2564ccb1b6e40e5fcaaa (patch)
tree83ddc7b36e8aa149fcd4519606e0eb4d445d4881
parente63edd766461f191959c27ec8ced26cec3d197b4 (diff)
downloaddotfiles-f7d0e7bed7f8ef8ca11c2564ccb1b6e40e5fcaaa.tar.gz
Add shebang and opening tag detect for PHP
-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