This seems like a prime case for a text object, but unfortunately, Vim doesn't recognize ```{R}
or ```
as text object delimiters.
There's at least three options that do work:
1. Click and drag with the mouse. A bit blasphemous, perhaps, but it can get the job done if there's not too much needing to be selected and your Vim or equivalent was built with mouse support.
2. Position your cursor on the first line of what you want selected, press Shift + v, then use gg or j to jump down to the last line you want selected. Having visible line numbers can be helpful here. Absolute line numbers for the count for gg, relative line numbers for the count for j.
3. This requires a little set up, but doesn't require you to think about how many lines you're selecting, and makes repeated use almost trivial.
:let @/ = "```"
:let @a = gnVnkoj
This can then be used by positioning the cursor above the section you want to select (even above the delimiter, but after any preceding sections' delimiters), then just running @a.
Explanation:
The first line, simply sets the "last used" search pattern without actually jumping to it by directly setting the search register. The second line sets up a macro in the a
register. gn jumps to the next item of the last used search pattern (should the the opening delimiter) and enters visual mode, selecting it. Shift+v switches to line-wise visual mode. n jumps to the next found instance of the search pattern (should be the closing delimiter). k moves up a line to deselect the delimiter. o moves the cursor to the other end of the selection and "reverses" the selection, so it starts at the bottom and ends at the top, where the cursor now is. j moves down a line to deselect the opening delimiter.