Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #239780

Re: Why ``color_prompt`` is only set for ``xterm``?

From Andrei POPESCU <andreimpopescu@gmail.com>
Newsgroups linux.debian.user
Subject Re: Why ``color_prompt`` is only set for ``xterm``?
Date 2021-09-07 20:40 +0200
Message-ID <CUOaK-7FB-3@gated-at.bofh.it> (permalink)
References <CT562-5UL-1@gated-at.bofh.it> <CT5pn-61K-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Jo, 02 sep 21, 19:34:07, David Wright wrote:
> 
> (I use my own customisations for distinct colours on each host,
> and inverse colours for root's prompt.)

Since we're sharing bash prompts here's mine, as an extract from the 
diff to /etc/skel/.bashrc


--- /etc/skel/.bashrc	2019-04-18 07:12:36.000000000 +0300
+++ .config/bash/bashrc	2020-05-22 09:54:21.882114365 +0300
@@ -38,6 +38,9 @@
 # set a fancy prompt (non-color, unless we know we "want" color)
 case "$TERM" in
     xterm-color|*-256color) color_prompt=yes;;
+    rxvt*) color_prompt=yes;;
+    linux) color_prompt=yes;;
+    screen*) color_prompt=yes;;
 esac
 
 # uncomment for a colored prompt, if the terminal has the capability; turned
@@ -56,8 +59,16 @@
     fi
 fi
 
+# add git branch information to avoid commiting to 'master' by mistake
+if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
+        . /usr/lib/git-core/git-sh-prompt
+fi
+GIT_PS1_SHOWUPSTREAM="verbose"
+#PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00;32m\]" "\[\033[00m\]\n└─> \$ "'
+PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00;32m\]" "\[\033[00m\]\$ "'
+
 if [ "$color_prompt" = yes ]; then
-    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
 else
     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 fi


Lately I've been using fish primarily, which already has that and more 
in it's default selection of prompts (I'm using the "Clasic + VCS").


Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Why ``color_prompt`` is only set for ``xterm``? IL Ka <kazakevichilya@gmail.com> - 2021-09-03 02:20 +0200
  Re: Why ``color_prompt`` is only set for ``xterm``? David Wright <deblis@lionunicorn.co.uk> - 2021-09-03 02:40 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? Nicholas Geovanis <nickgeovanis@gmail.com> - 2021-09-03 03:10 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? piorunz <piorunz@gmx.com> - 2021-09-03 03:50 +0200
      Re: Why ``color_prompt`` is only set for ``xterm``? Mark Neyhart <Mark.Neyhart@akleg.gov> - 2021-09-03 22:00 +0200
        Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt examples) Intense Red <intnsred@golgotha.net> - 2021-09-05 07:30 +0200
          Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt examples) Cindy Sue Causey <butterflybytes@gmail.com> - 2021-09-05 14:20 +0200
          Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt  examples) Greg Wooledge <greg@wooledge.org> - 2021-09-05 15:10 +0200
            Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt examples) Cindy Sue Causey <butterflybytes@gmail.com> - 2021-09-05 15:40 +0200
              Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt  examples) Greg Wooledge <greg@wooledge.org> - 2021-09-05 15:50 +0200
      Re: Why ``color_prompt`` is only set for ``xterm``? David Wright <deblis@lionunicorn.co.uk> - 2021-09-05 06:30 +0200
        Re: Why ``color_prompt`` is only set for ``xterm``? Greg Wooledge <greg@wooledge.org> - 2021-09-05 15:10 +0200
          Re: Why ``color_prompt`` is only set for ``xterm``? David Wright <deblis@lionunicorn.co.uk> - 2021-09-07 17:10 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? Nate Bargmann <n0nb@n0nb.us> - 2021-09-05 18:50 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? Andrei POPESCU <andreimpopescu@gmail.com> - 2021-09-07 20:40 +0200

csiph-web