vim-pandoc / vim-rmarkdown

Rmarkdown support for vim
100 stars 26 forks source link

formating rmarkdown files #9

Open etheleon opened 9 years ago

etheleon commented 9 years ago

Hi,

i've written a small function to use in my own ~/.vimrc.local to open a chunk. Maybe we could add this to one of the functions in this vim package.

function Chunk()
   normal i```{r}^M^M```^[k
endfunction
nnoremap <leader>r :call Chunk()<CR>

however its not complete. I was hopping it could do the wrapping of the a few lines of code (visual selection) and wrapping the starting and ending chunk identifiers around the code. Not familiar with vim enough to write this piece of code

| <multiline CODE> 
| <multiline CODE> 
| <multiline CODE> 
| ```{r}
| <multiline CODE> 
| <multiline CODE> 
| <multiline CODE> 
| ```

any ideas?