I have been writing R scripts in Vim for some time now. Starting an hour ago, I began facing an issue that every time I type an underscore (_
), it gets automati
It may be also worthwhile to add that a convenient setting may involve re-assigning the operator, for instance the .vimrc
setting:
" Nvim-R extra settings
"" Change assignment operator
let R_assign_map = "|"
Would assign the r assignment operator <-
to Shift+|. This feature is described ithe provided documentation. In the R_assign
section.
The VIM: r-plugin does indeed change the mapping but the documentation section 4.1 states "it is possible to insert an actual underscore into your file by typing a second underscore".
Thus, while you can disable the conversion of _ to <- it is easy to override temporarily.
To add more options to what you can do, Nvim-R has not only R_assign_map as @konrad pointed out, but R_assign
which manages how the feature works. A previous answer on duplicate answer mentioned an outdated version of R_assign (older name) being set to 0 as the answer.
I have found that the actual way to use this variable as of at least this post date (while the variable is still called R_assign
) that there are 2 valid values thus 3 functions. I have only tried values of -1 to 3, but I found 1 and 2 to produce something, so here they are:
let R_assign=-1
(anything but 1 and 2)) made it so that _ produced <- and any subsequent _ keys produced more <-let R_assign=1
produced the default documented behaviour of 1 _ makes a <- and the next _ makes (thus two _) a single _let R_assign=2
flips it so that a single _ makes _ and another _ makes a <- (so two _ for a <-):verbose imap _
should tell you which (probably filetype plugin) has set this.
It's less likely to be an abbreviation, but :verbose ia _
would tell you.