# Disable weird indentation for R in vim

Published on

By default, vim indents multi-line function calls in R in the following strange way:

some_function(
arg1,
arg2,
arg3)

There are two issues with this style:

1. It steals horizontal space, so if some of the arguments are themselves complex expressions, the lines will quickly become too long.
2. If you rename some_function or change it to a different function, the whole block needs to be re-aligned.

A saner indentation is

some_function(
arg1,
arg2,
arg3)

where the indentation amount is small and fixed (say, two spaces).

To make vim indent R code this way, add to your .vimrc:

let r_indent_align_args = 0

For more information, see :help ft-r-indent.