diff options
| author | Max Christian Pohle | 2016-05-09 17:00:35 +0200 |
|---|---|---|
| committer | Max Christian Pohle | 2016-05-09 17:00:35 +0200 |
| commit | c2a13ef3f498d90fb9f46b830e14c31156635676 (patch) | |
| tree | e125ca03554399949d6ca0fd27b7cf1953cbf02c /indent/php.vim | |
| parent | 8fd5f60d660f385b766b9c0e7ac874632c1cea1f (diff) | |
| download | vim-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.vim | 37 |
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. | ||
| 3 | if exists("b:did_indent") | ||
| 4 | finish | ||
| 5 | endif | ||
| 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: | ||
| 8 | if exists('s:doing_indent_inits') | ||
| 9 | finish | ||
| 10 | endif | ||
| 11 | let s:doing_indent_inits = 1 | ||
| 12 | runtime! indent/html.vim | ||
| 13 | unlet b:did_indent | ||
| 14 | runtime! indent/php.vim | ||
| 15 | unlet s:doing_indent_inits | ||
| 16 | function! 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 | ||
| 35 | endfunction | ||
| 36 | setlocal indentexpr=GetPhpHtmlIndent(v:lnum) | ||
| 37 | setlocal indentkeys+=<>> | ||
