jalvesaq / Nvim-R

Vim plugin to work with R
GNU General Public License v2.0
968 stars 125 forks source link

Is it possible to change the indentation behavior after parenthesis to be the same as curly brace? #803

Closed jarodmeng closed 9 months ago

jarodmeng commented 9 months ago

When I type a line break after an open curly brace ({), the auto indent of the new line is shiftwidth from the start of the line.

# The following is typed without pressing any Tab key
test_func <- function() {
  run_some_code
}

When I type a line break after an open parenthesis ((), the auto indent of the new line is at the same position as the parenthesis.

# The following is typed without pressing any Tab key
df %>%
  mutate(
         test_col = do_something(another_col)
         )

I would like the output to look like this instead.

df %>%
  mutate(
    test_col = do_something(another_col)
  )

Is there a way to set options to achieve this?

jalvesaq commented 9 months ago

Please, see this: https://github.com/jalvesaq/R-Vim-runtime/issues/1

jarodmeng commented 9 months ago

Thanks for the link. In this case, I might write a simple customized indentexpr to replace the one shipped with nvim-r.

jalvesaq commented 9 months ago

Could you share customized indentexpr here? Others might benefit from it.