4 ms·
I have a question that suits the context. How can I get syntax highlighting on Bash while in interactive mode of interpreted languages like Python. Also applie
by sravfeyn 15y ago
I have a question that suits the context.
How can I get syntax highlighting on Bash while in interactive mode of interpreted languages like Python.
Also applies to Standard-ML prompt.
- deefour 15y agoThere's a couple gems that help with this in ruby. Coolline[1] colors syntax in the readline as you type. There's a gem[2] that integrates this with Pry[3] (an alternative to irb). For colored output in Pry's REPL, awesome_print[4] can be integrated[5] using pry's .pryrc files. [1]https://github.com/Mon-Ouie/coolline [2]https://github.com/pry/pry-coolline [3]https://github.com/pry/pry [4]https://github.com/michaeldv/awesome_print [5]https://gist.github.com/004b0cdfccf0e29d83e3
- tomku 15y agoBash doesn't actually handle the syntax highlighting in those cases, it's all done by the interpreter itself. You'll need to either modify your interpreter through a plugin or replace it. For Python, check out bpython [1]. If you don't mind using a graphical program for your interactive REPL, check out DreamPie [2] or the newish GUI version of ipython [3], which is a bit of a bear to install, unfortunately. I don't think the command-line version of ipython supports syntax highlighting, but I'd love to be wrong about that. I'm not really qualified to talk about Standard ML as my experience with it have been primarily in Emacs rather than the REPL. [1] http://bpython-interpreter.org/ http://bpython-interpreter.org/ [2] http://dreampie.sourceforge.net/ http://dreampie.sourceforge.net/ [3] http://ipython.org/ http://ipython.org/
- sravfeyn 15y agoThank You.
- daxelrod 15y agoThis leads to a wonderful idea: is it possible to make Bash syntax-highlight the Bash code you type at the prompt? I'm guessing the answer is currently "no".