0

I use shell inside emacs but by default it prints output in 1 color.

However, when I use grep, I would like to see substring I'm searching highlighted.

To see colors, I can manually type TERM=ansi when shell starts, but I wonder if there is a way to run shell with TERM defined?

1 Answer 1

1

Presumably you are using bash? If you add TERM=ansi to your .bashrc all interactive non-login shells that are opened will have it set (including emacs).

Otherwise if You only want that set in emacs you can create a file ~/.emacd.d/init_bash.sh (replacing "bash" with your default shell if not bash) containing TERM=ansi.

From the shell docstring (C-h f shell):

If a file ‘~/.emacs_SHELLNAME’ exists, or ‘~/.emacs.d/init_SHELLNAME.sh’, it is given as initial input...

1
  • Thanks! Adding init_bash.sh works!
    – Stepan S
    Commented Jan 27, 2017 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.