[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs Shell Ansi Colors
From: |
Lorenzo Isella |
Subject: |
Re: Emacs Shell Ansi Colors |
Date: |
Mon, 29 Sep 2008 15:02:57 +0200 |
OK,
I think we are getting to the bottom of this. Apologies in advance for
the long email, but there are several suggestions here about what to
modify (and how), and my knowledge of shell scripting is clearly on a
different league wrt the one of many people on the list.
To make a long story short, this is the output of your command:
~$ env | grep TERM
TERM=xterm
COLORTERM=gnome-terminal
and this is my .bashrc file (or better: the part about aliases and
colors, which I think is relevant here):
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color)
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
'
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
;;
esac
# Comment in the above and uncomment this below for a color prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
'
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
and this is my /etc/profile file:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
fi
if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
export PATH
umask 022
As to your suggestion:
> in case you need a drop-in solution for emacs, you can use the lines
> below.
>
> (comint-send-string (current-buffer) "alias ls='ls --color'")
> then do a
> (comint-send-input)
please, do not laugh, but I am a bit at a loss about the way I should
put this into my .emacs file. The part dealing with the shell is now:
(require 'shell-command)
(shell-command-completion-mode)
;; ;;Now I add another customization for the shell-mode
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(custom-set-variables
'(comint-scroll-to-bottom-on-input t) ; always insert at the bottom
'(comint-scroll-to-bottom-on-output t) ; always add output at the bottom
'(comint-scroll-show-maximum-output t) ; scroll to show max possible output
'(comint-completion-autolist t) ; show completion list when ambiguous
'(comint-input-ignoredups t) ; no duplicates in command history
'(comint-completion-addsuffix t) ; insert space/slash after
file completion
)
; make completion buffers disappear after 3 seconds.
(add-hook 'completion-setup-hook
(lambda () (run-at-time 3 nil
(lambda () (delete-windows-on "*Completions*")))))
(add-hook 'shell-mode-hook '(lambda () (toggle-truncate-lines 1)))
(setq comint-prompt-read-only t)
What should I actually add to this?
Hope this is the conclusion, thanks again to everybody.
Cheers
Lorenzo
2008/9/29 Paul R <paul.r.ml@gmail.com>:
>
> Lorenzo> So it looks like there could be a problem with the TERM
> Lorenzo> environment variable (but do not ask me what this stands
> Lorenzo> for). I suppose (hope?) this is a one-liner for somebody
> Lorenzo> really knowledgeable about emacs. Kind Regards
>
> in case you need a drop-in solution for emacs, you can use the lines
> below.
>
> (comint-send-string (current-buffer) "alias ls='ls --color'")
> then do a
> (comint-send-input)
>
> --
> Paul
>
--
It is hard to want something you cannot describe.
- Emacs Shell Ansi Colors, Lorenzo Isella, 2008/09/28
- Re: Emacs Shell Ansi Colors, Thierry Volpiatto, 2008/09/28
- Message not available
- Re: Emacs Shell Ansi Colors, Lorenzo Isella, 2008/09/29
- Re: Emacs Shell Ansi Colors, Thierry Volpiatto, 2008/09/29
- Re: Emacs Shell Ansi Colors, Paul R, 2008/09/29
- Re: Emacs Shell Ansi Colors, Paul R, 2008/09/29
- Re: Emacs Shell Ansi Colors,
Lorenzo Isella <=
- Re: Emacs Shell Ansi Colors, Paul R, 2008/09/29
- Re: Emacs Shell Ansi Colors, Lorenzo Isella, 2008/09/29
- Message not available
- Re: Emacs Shell Ansi Colors, Andreas Politz, 2008/09/29
- Re: Emacs Shell Ansi Colors, Peter Dyballa, 2008/09/29
- Message not available
- Re: Emacs Shell Ansi Colors, Richard Riley, 2008/09/29
- Message not available
- Re: Emacs Shell Ansi Colors, Richard Riley, 2008/09/29
- Re: Emacs Shell Ansi Colors, Paul R, 2008/09/29