e9t
e9t

Reputation: 16422

R syntax highlighting in Terminal

Can we get syntax highlighting for R in the Terminal?

Upvotes: 31

Views: 5211

Answers (4)

Kahovius
Kahovius

Reputation: 146

Another option now would be to use radian instead of the default R prompt.

Upvotes: 2

e9t
e9t

Reputation: 16422

I've finally found a library that meets my needs.
Now I'm much happier with my coding environment.

colorout is an R package that colorizes R output when running in a terminal emulator.The package cannot be on CRAN because it changes code already loaded by R and this is prohibited by the CRAN Repository Policy. The package replaces the functions that output results and messages to R Console, and this is necessary because we cannot colorize the output without replacing these functions. To install it, do the following in R:

install.packages("devtools")
devtools::install_github("jalvesaq/colorout")
library("colorout")
# do something

Upvotes: 36

Carl Witthoft
Carl Witthoft

Reputation: 21502

As hd1 indicated, this is not an R question. You're asking the OSX Terminal.app to do something it's not capable of. A quick look around Google (happy Zamboni birthday!) shows Vim syntax Highlighting for highlighting within vim , or https://superuser.com/questions/72057/terminal-emulator-with-custom-color-palette , but dunno if these will run under Darwin.

EDIT: I can't stay away from the search :-) . So check out these threads: https://superuser.com/questions/400360/syntax-highlighting-in-terminal-mac-os-x , http://forums.macrumors.com/showthread.php?t=412609 , and a recommendation to install zsh , https://apple.stackexchange.com/questions/12161/os-x-terminal-must-have-utilities

Upvotes: 0

hd1
hd1

Reputation: 34657

Use something like ess on emacs or RStudio for syntax highlighting for R instead of expecting it to work in the terminal.

Upvotes: 5

Related Questions