($foo)
{
foo();
}
Instead of: >
if ($foo)
{
foo();
}
NOTE: Indenting will be a bit slower if this option is used because some
optimizations won't be available.
*PHP_vintage_case_default_indent*
To indent 'case:' and 'default:' statements in switch() blocks: >
:let g:PHP_vintage_case_default_indent = 1
In PHP braces are not required inside 'case/default' blocks therefore 'case:'
and 'default:' are indented at the same level than the 'switch()' to avoid
meaningless indentation. You can use the above option to return to the
traditional way.
*PHP_noArrowMatching*
By default the indent script will indent multi-line chained calls by matching
the position of the '->': >
$user_name_very_long->name()
->age()
->info();
<
You can revert to the classic way of indenting by setting this option to 1: >
:let g:PHP_noArrowMatching = 1
<
You will obtain the following result: >
$user_name_very_long->name()
->age()
->info();
<
*PHP_IndentFunctionCallParameters*
Extra indentation levels to add to parameters in multi-line function calls. >
let g:PHP_IndentFunctionCallParameters = 1
Function call arguments will indent 1 extra level. For two-space indentation: >
function call_the_thing(
$with_this,
$and_that
) {
$this->do_the_thing(
$with_this,
$and_that
);
}
<
*PHP_IndentFunctionDeclarationParameters*
Extra indentation levels to add to arguments in multi-line function
definitions. >
let g:PHP_IndentFunctionDeclarationParameters = 1
<
Function arguments in declarations will indent 1 extra level. For two-space
indentation: >
function call_the_thing(
$with_this,
$and_that
) {
$this->do_the_thing(
$with_this,
$and_that
);
}
<
PYTHON *ft-python-indent*
The amount of indent can be set with the `g:python_indent` |Dictionary|, which
needs to be created before adding the items: >
let g:python_indent = {}
The examples given are the defaults. Note that the dictionary values are set
to an expression, so that you can change the value of 'shiftwidth' later
without having to update these values.
Indent after an open paren: >
let g:python_indent.open_paren = 'shiftwidth() * 2'
Indent after a nested paren: >
let g:python_indent.nested_paren = 'shiftwidth()'
Indent for a continuation line: >
let g:python_indent.continue = 'shiftwidth() * 2'
By default, the closing paren on a multiline construct lines up under the first
non-whitespace character of the previous line.
If you prefer that it's lined up under the first character of the line that
starts the multiline construct, reset this key: >
let g:python_indent.closed_paren_align_last_line = v:false
The method uses |searchpair()| to look back for unclosed parentheses. This
can sometimes be slow, thus it timeouts after 150 msec. If you notice the
indenting isn't correct, you can set a larger timeout in msec: >
let g:python_indent.searchpair_timeout = 500
If looking back for unclosed parenthesis is still too slow, especially during
a copy-paste operation, or if you don't need indenting inside multi-line
parentheses, you can completely disable this feature: >
let g:python_indent.disable_parentheses_indenting = 1
For backward compatibility, these variables are also supported: >
g:pyindent_open_paren
g:pyindent_nested_paren
g:pyindent_continue
g:pyindent_searchpair_timeout
g:pyindent_disable_parentheses_indenting
R *ft-r-indent*
Function arguments are aligned if they span for multiple lines. If you prefer
do not have the arguments of functions aligned, put in your |vimrc|:
>
let r_indent_align_args = 0
<
All lines beginning with a comment character, #, get the same indentation
level of the normal R code. Users of Emacs/ESS may be used to have lines
beginning with a single # indented in the 40th column, ## indented as R code,
and ### not indented.