aboutsummaryrefslogtreecommitdiff
path: root/after/indent/php.vim
diff options
context:
space:
mode:
authorMax Christian Pohle2022-12-18 20:29:55 +0100
committerMax Christian Pohle2022-12-18 20:56:01 +0100
commit07797b39851da045aa1bfd0289de0858a1377c48 (patch)
tree4ca5d2b26d2ca9d01fc052fce5a26f88364a53d0 /after/indent/php.vim
parent1086af63639d2a108f39ae077e0e201dddf4f523 (diff)
downloadvim-07797b39851da045aa1bfd0289de0858a1377c48.tar.bz2
vim-07797b39851da045aa1bfd0289de0858a1377c48.zip
Switched to nvim and neovide
Diffstat (limited to 'after/indent/php.vim')
-rw-r--r--after/indent/php.vim37
1 files changed, 37 insertions, 0 deletions
diff --git a/after/indent/php.vim b/after/indent/php.vim
new file mode 100644
index 0000000..ef723a6
--- /dev/null
+++ b/after/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+=<>>
..