aboutsummaryrefslogtreecommitdiff
path: root/indent/php.vim
diff options
context:
space:
mode:
authorMax Christian Pohle2016-05-09 17:00:35 +0200
committerMax Christian Pohle2016-05-09 17:00:35 +0200
commitc2a13ef3f498d90fb9f46b830e14c31156635676 (patch)
treee125ca03554399949d6ca0fd27b7cf1953cbf02c /indent/php.vim
parent8fd5f60d660f385b766b9c0e7ac874632c1cea1f (diff)
downloadvim-karlmarks-c2a13ef3f498d90fb9f46b830e14c31156635676.tar.bz2
vim-karlmarks-c2a13ef3f498d90fb9f46b830e14c31156635676.zip
moved repository up again
this repo shell be used for vim exclusively
Diffstat (limited to 'indent/php.vim')
-rw-r--r--indent/php.vim37
1 files changed, 37 insertions, 0 deletions
diff --git a/indent/php.vim b/indent/php.vim
new file mode 100644
index 0000000..ef723a6
--- /dev/null
+++ b/indent/php.vim
@@ -0,0 +1,37 @@
1" Better indent support for PHP by making it possible to indent HTML sections
2" as well.
3if exists("b:did_indent")
4 finish
5endif
6" This script pulls in the default indent/php.vim with the :runtime command
7" which could re-run this script recursively unless we catch that:
8if exists('s:doing_indent_inits')
9 finish
10endif
11let s:doing_indent_inits = 1
12runtime! indent/html.vim
13unlet b:did_indent
14runtime! indent/php.vim
15unlet s:doing_indent_inits
16function! GetPhpHtmlIndent(lnum)
17 if exists('*HtmlIndent')
18 let html_ind = HtmlIndent()
19 else
20 let html_ind = HtmlIndentGet(a:lnum)
21 endif
22 let php_ind = GetPhpIndent()
23 " priority one for php indent script
24 if php_ind > -1
25 return php_ind
26 endif
27 if html_ind > -1
28 if getline(a:num) =~ "^<?" && (0< searchpair('<?', '', '?>', 'nWb')
29 \ || 0 < searchpair('<?', '', '?>', 'nW'))
30 return -1
31 endif
32 return html_ind
33 endif
34 return -1
35endfunction
36setlocal indentexpr=GetPhpHtmlIndent(v:lnum)
37setlocal indentkeys+=<>>
..