For example, vim will not indent correctly the following code:
flights <- flights %>%
group_by(year, month, day) %>%
select(arr_delay, dep_delay) %>%
summarise(
arr = mean(arr_delay, na.rm = TRUE),
dep = mean(dep_delay, na.rm = TRUE)
) %>%
filter(arr > 30 | dep > 30)
Is there a way to fix this?
I'm using the Vim-R-Plugin, the related issue is here.
One thing you can do is learn vimscript and modify this behavior yourself. If it works well, you can contribute the change to the original author.
I started out this way but ended up writing my own indent code from scratch that does everything just the way I like it. I talked with the R plugin author about replacing his code with mine but my code has a couple of bugs I've never taken the time to find and that don't bother me much (it gets stuck if you have an unmatched close curly bracket, for example). I never got the motivation to clean it up the rest of the way and try and get it into the VIM repository.
In response to your query, I have put my code on github. You can try using my indent code instead of the r-plugin code if you want. It may or may not solve your issue (no promises). If I get motivated enough I may fix it up enough that we could make it the default vim indent code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With