Feature Request: Colorise R Prompt
isezen opened this issue · 3 comments
is it possible to add a feature colourful R prompt in terminal without having the issue explained in the link below?
http://r.789695.n4.nabble.com/Xterm-escape-sequences-in-Prompt-td906375.html
I can think in two ways of colorizing R prompt:
- Putting something like
options(prompt = "\x1b[33m>\x1b[0m ")
in the Rprofile. - Running R in a Neovim's buffer and "syntax" highlighting the prompt.
However, since the goal of the plugin is to help in the development of R scripts, I prefer to colorize only R output because the input is already highlighted in the script and I don't want distractions in the output. Currently, when running R in a Neovim buffer, all lines beginning with ">" are either highlighted with a single color (the default) or highlighted as R code (see options rout_color_input
and Rout_more_colors
).
Unfortunately, first is out of option because of strange behaviour when using the command history (arrow up/down). I didn't know about latter option. I will give it a try, thanks for the answer.
You can try this in your vimrc:
autocmd FileType rout syn region routInput start="^>" end='$' contains=routPrompt keepend | syn match routPrompt "^>" contained
hi def link routPrompt Special
In this case, the option Rout_more_colors
will be ignored. You have to adjust the code above if either your prompt is not ">" or you prefer to highlight the prompt using a highlighting group other than Special
.