R-nvim / R.nvim

Neovim plugin to edit R files
GNU General Public License v3.0
128 stars 15 forks source link

Closing inline code chunks with backticks #121

Closed j-w-e closed 2 months ago

j-w-e commented 2 months ago

In an Rmd or qmd file, you can start an inline code block with a backtick using the rmdchunk=2 option. Can I request that typing a second backtick closes the chunk, not closes and opens a new one?

For example, typing a ` when starting from this (with cursor represented by |):

Test `r |`

Currently, that results in:

Test `r ``r |`

I would propose that this is more intuitive, and matches how autopair plugins tend to work, for example:

Test `r `|

I assume this can be achieved by checking if the next character is a `, as an additional if statement following this line, but I don't know enough of the Neovim API to know how to do that sensibly.

jalvesaq commented 2 months ago

I would propose that this is more intuitive, and matches how autopair plugins tend to work

I agree. I'll see this later.