Usually when you set up a new account, there are a bunch of niceties that you will want to have. Here are a bunch of things that you can just copy and paste into your startup scripts.
.zshrc
The zsh prompt expansion reference is here.
.zshrc
# set the font if [ `whoami` = "root" ]; then PROMPT='%F{red}%n@%m%f#' else PROMPT='%F{blue}%n@%m%f>' fi # https://superuser.com/questions/1092033/how-can-i-make-zsh-tab-completion-fix-capitalization-errors-for-directories-and autoload -Uz compinit && compinit zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
.bashrc and .bash_profile
Why are there two different bash startup files? You can read about it from Josh Staiger here. Also more information from Ramesh Natarajan here.
.bashrc
# Why .bash_profile and .bashrc? # http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html # http://www.thegeekstuff.com/2008/10/execution-sequence-for-bash_profile-bashrc-bash_login-profile-and-bash_logout # Terminal escapes to set the color BLACK="\[\033[0;30m\]" BLUE="\[\033[0;34m\]" GREEN="\[\033[0;32m\]" CYAN="\[\033[0;36m\]" RED="\[\033[0;31m\]" PURPLE="\[\033[0;35m\]" BROWN="\[\033[0;33m\]" LIGHT_GRAY="\[\033[0;37m\]" DARK_GRAY="\[\033[1;30m\]" LIGHT_BLUE="\[\033[1;34m\]" LIGHT_GREEN="\[\033[1;32m\]" LIGHT_CYAN="\[\033[1;36m\]" LIGHT_RED="\[\033[1;31m\]" LIGHT_PURPLE="\[\033[1;35m\]" YELLOW="\[\033[1;33m\]" WHITE="\[\033[1;37m\]" NO_COLOR="\[\033[0m\]" # Check to see we have an xterm so we can set the title. case $TERM in xterm*) TITLEBAR='\[\033]0;\w\007\]' ;; *) TITLEBAR='' ;; esac if [ `whoami` = "root" ]; then PROMPT_COLOR=${RED} else PROMPT_COLOR=${BLUE} fi PS1="${TITLEBAR}\ ${PROMPT_COLOR}\u@\h>${NO_COLOR}" PS2='>' # some standard environment variables MANPAGER="less" export MANPAGER export EDITOR=emacs # environment variables that will affect the display of ls (and perhaps other programs) export CLICOLOR='YES' export BLOCKSIZE='1024' alias ls='ls -FG' alias dir='ls -l' alias diff='diff -w -C 5 -B' # Make bash check it's window size after a process completes shopt -s checkwinsize
.bash_profile
# Why .bash_profile and .bashrc? # http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html # http://www.thegeekstuff.com/2008/10/execution-sequence-for-bash_profile-bashrc-bash_login-profile-and-bash_logout if [ -f ~/.bashrc ]; then source ~/.bashrc fi
ssh-agent
# ssh-agent configuration
# https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login
# http://mah.everybody.org/docs/ssh
SSH_ENV="$HOME/.ssh/environment-${HOSTNAME}"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add ${HOME}/.ssh/*.rsa
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
.emacs
(configure emacs with --without-ns or it will build the app for you)
These lines in your .emacs will give you a nice backup directory with multiple versions, instead of littering your filesystem with blah~ files everywhere.
.emacs
; http://stackoverflow.com/questions/151945/how-do-i-control-how-emacs-makes-backup-files (setq backup-directory-alist `(("." . "~/Backup/Emacs"))) (setq backup-by-copying t) (setq delete-old-versions t kept-new-versions 5 kept-old-versions 2 version-control t)
.inputrc
To get case insensitive completion in bash, put this into your .inputrc
.inputrc
$include /etc/inputrc
set completion-ignore-case On
Preferred Colors
Text Background: 206:255:221 #CEFFDD