Commits

David Chambers committed fa4f4e2

use feature detection when setting bash prompt

Comments (0)

Files changed (1)

80=customizing-your-bash-prompt-for-pleasure-and-profit.text

 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+#### Update: 20 April 2012, 1:15am (America/Los_Angeles)
+
+I've recently taken up Vim. In Vim, one can enter `:shell` while in command
+mode to open a shell. The first time I did so I noticed that the colour codes
+appeared in the prompt. Feature detection can be used to ensure that colour
+codes are only provided to "smart" terminals:
+
+    :::bash
+    [[ "$TERM" == dumb ]] && PS1="\n\w\n> "
+    [[ "$TERM" != dumb ]] && PS1="\n\[\e[1;36m\]\w\n\[\e[1;32m\]> \[\e[0m\]"
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
 #### Note for Mac OS X users
 
 Terminal loads your **~/.bash_profile** but not your **~/.bashrc**. As a