Skip to content

Instantly share code, notes, and snippets.

@BenderIsMyGod
Last active July 8, 2021 04:29
Show Gist options
  • Save BenderIsMyGod/6298fe3f33f7083c4768420eb67e198b to your computer and use it in GitHub Desktop.
Save BenderIsMyGod/6298fe3f33f7083c4768420eb67e198b to your computer and use it in GitHub Desktop.
Tcsh / csh fancy shell prompt with date, color and more
# $FreeBSD: releng/10.3/etc/root/dot.cshrc 243893 2012-12-05 13:56:39Z eadler $
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#
alias h history 25
alias j jobs -l
alias la ls -aF
alias lf ls -FA
alias ll ls -lAF
# A righteous umask
umask 22
set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)
setenv EDITOR nano
setenv PAGER less
setenv BLOCKSIZE K
if ($?prompt) then
# An interactive shell -- set some stuff up
set prompt="\n%B%{\033[34m%}[%h] %d %D.%w.%Y %P\n%{\033[37m%}[%n]@[%m][%~]\n%{\033[30m%}%b"
#Above, a more fancy prompt than the original, for colors variations see comments
set promptchars = "%#"
set filec
set history = 1000
set savehist = (1000 merge)
set autolist = ambiguous
# Use history to aid expansion
set autoexpand
set autorehash
set mail = (/var/mail/$USER)
if ( $?tcsh ) then
bindkey "^W" backward-delete-word
bindkey -k up history-search-backward
bindkey -k down history-search-forward
endif
endif
@BenderIsMyGod
Copy link
Author

For colors indications see the fillowing from https://www.cs.umd.edu/~srhuang/teaching/code_snippets/prompt_color.tcsh.html

# Add these lines to your ~/.cshrc.mine file on the linux grace machines...
# don't worry too much about what they mean.

# Colors!
set     red="%{\033[1;31m%}"
set   green="%{\033[0;32m%}"
set  yellow="%{\033[1;33m%}"
set    blue="%{\033[1;34m%}"
set magenta="%{\033[1;35m%}"
set    cyan="%{\033[1;36m%}"
set   white="%{\033[0;37m%}"
set     end="%{\033[0m%}" # This is needed at the end... :(

# Setting the actual prompt.  I made two separate versions for you to try, pick
# whichever one you like better, and change the colors as you want.  Just don't
# mess with the ${end} guy in either line...  Comment out or delete the prompt you don't use.

set prompt="${green}%n${blue}@%m ${white}%~ ${green}%%${end} "
set prompt="[${green}%n${blue}@%m ${white}%~ ]${end} "

# Clean up after ourselves...
unset red green yellow blue magenta cyan yellow white end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment