jalvesaq / Nvim-R

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

Outliner for R documents with VOoM #726

Closed iago-pssjd closed 1 year ago

iago-pssjd commented 1 year ago

Hi,

Since among the suggestions given inside the documentation it appears VOoM as an outliner for Rmarkdown documents, https://github.com/jalvesaq/Nvim-R/blob/093cb979650ac5b0c9b9f49d3cfd5151557668af/doc/Nvim-R.txt#L242-L250 I wanted to announce here that I added a mode to VOoM in order to may use it as an outliner for R. VOoM with such mode added is the branch voom-mode-r of my fork: https://github.com/iago-pssjd/VOoM/tree/voom_mode_r

In order to detect this mode when openning R files you only need to update the configuration line to

let voom_ft_modes = {'rmd': 'pandoc', 'rnoweb': 'latex', 'r':'r'} 

and building the code sections is as easy as starting a line by #R, adding as many ! as the section level and adding a whitespace before the title



#R! This is a title of level 1

## a comment

... some R code ...

#R!! A title of level 2

... more R code ...
jalvesaq commented 1 year ago

Thanks for your contribution!

Why did you choose "#R!", "#R!!", etc. as level indicators?

iago-pssjd commented 1 year ago

Because a number of subjective impressions: I believe it is easy to add (in particular, there is no need to add anything after the heading title), easy to remember , since it has a certain similarity with the shebang for shell scripting, I find it nice (not annoying) and because I think it would not be used to start a normal (non-heading) comment.

Of course, as said, all this is subjective and it would apply to a lot of other possibilities too. In fact I was thinking in other options too. I believe the reason of the "shebang similarity and looking at it as an adaptation to R" is the main reason for my "final" decision. Beyond all this, I would be open to modify it if someone suggests a better option being as easy to implement as this one.

jalvesaq commented 1 year ago

I'm closing the "issue" because it is not about a problem that I have to fix. Please, feel free to include a section in Nvim-R's wiki on your Voom mode for R.

iago-pssjd commented 1 year ago

Ok! thanks