138 lines
3.3 KiB
Bash
138 lines
3.3 KiB
Bash
###############################################################################
|
|
# File .bashrc
|
|
# jul.io
|
|
###############################################################################
|
|
umask 022
|
|
|
|
# set PATH so it includes user's private bin if it exists
|
|
if [ -d ~/bin ] ; then
|
|
PATH="~/bin:${PATH}"
|
|
export PATH
|
|
fi
|
|
|
|
# do the same with MANPATH
|
|
if [ -d ~/man ]; then
|
|
MANPATH=~/man:"${MANPATH}"
|
|
export MANPATH
|
|
fi
|
|
|
|
# some programs use a special .dot directory for not
|
|
# trashing the home directory with .dotfiles
|
|
if [ -d ~/.dot ]; then
|
|
DOT=~/.dot
|
|
export DOT
|
|
fi
|
|
|
|
export COLORTERM=1
|
|
|
|
# change darkblue dir-colors to lightgrey because it's unreadable with black background
|
|
LS_COLORS="di=01;90"
|
|
export LS_COLORS
|
|
|
|
# prefered editor
|
|
export EDITOR=vi
|
|
|
|
# bash history control
|
|
export HISTCONTROL=ignoreboth:erasedups
|
|
export HISTFILESIZE=
|
|
export HISTSIZE=5000
|
|
shopt -s histappend
|
|
shopt -s cmdhist
|
|
|
|
# completion
|
|
shopt -s cdspell
|
|
shopt -s hostcomplete
|
|
|
|
# If not running interactively, don't do any more
|
|
[ -z "$PS1" ] && return
|
|
|
|
###############################################################################
|
|
# running interactively
|
|
###############################################################################
|
|
# check the window size after each command and, if necessary,
|
|
# update the values of LINES and COLUMNS.
|
|
shopt -s checkwinsize
|
|
|
|
# only linux, not SunOS etc
|
|
if [ `uname` == "Linux" ]; then
|
|
# enable color support of ls
|
|
if [ "$TERM" != "dumb" ]; then
|
|
eval `dircolors -b`
|
|
alias ls='ls --color'
|
|
fi
|
|
fi
|
|
|
|
# make less more friendly for non-text input files, see lesspipe(1)
|
|
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
|
|
|
|
# set a fancy prompt
|
|
if [ $UID == 0 ]; then
|
|
# root: red
|
|
PS_COLOR="\[\033[1;31m\]"
|
|
else
|
|
# user
|
|
PS_COLOR="\[\033[33m\]"
|
|
fi
|
|
PS1="\t ${PS_COLOR}${debian_chroot:+($debian_chroot)}\u\[\033[0m\]@\h:\w\$ "
|
|
|
|
# if this is an xterm modify the title
|
|
case $TERM in
|
|
xterm*)
|
|
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} $(date +%H:%M:%S) [${PWD}]\007"'
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
# define your own aliases in ~/.bash_aliases
|
|
[ -f ~/.bash_aliases ] && source ~/.bash_aliases
|
|
|
|
# local bashrc
|
|
[ -f ~/.bashrc_local ] && source ~/.bashrc_local
|
|
|
|
# enable programmable completion features
|
|
if [ -f /etc/bash_completion ]; then
|
|
. /etc/bash_completion
|
|
fi
|
|
|
|
# This allows you to bookmark your favorite places across the file system
|
|
# Define a variable containing a path and you will be able to cd into it regardless of the directory you're in
|
|
shopt -s cdable_vars
|
|
|
|
# Examples:
|
|
# export dotfiles="$HOME/dotfiles"
|
|
export projects="$HOME/projects"
|
|
export elements="$HOME/elements"
|
|
export develop="$HOME/elements/develop"
|
|
|
|
# ssh using a new window when we are in TMUX
|
|
SSHEXEC=$(which ssh)
|
|
ssh() {
|
|
if [ -n "$TMUX" ]
|
|
then
|
|
title="$*"
|
|
#if [ "$1" = -t ]
|
|
#then
|
|
# title="$2"
|
|
# shift 2
|
|
#fi
|
|
#if [ "$1" = "stay" ]
|
|
#then
|
|
# "$SSHEXEC $@"
|
|
#else
|
|
tmux new-window -n "$title" "$SSHEXEC $( echo $@ | sed 's/stay//')"
|
|
#fi
|
|
else
|
|
$SSHEXEC $@
|
|
fi
|
|
}
|
|
|
|
# colorful manpages
|
|
export LESS_TERMCAP_mb=$'\e[1;32m'
|
|
export LESS_TERMCAP_md=$'\e[1;32m'
|
|
export LESS_TERMCAP_me=$'\e[0m'
|
|
export LESS_TERMCAP_se=$'\e[0m'
|
|
export LESS_TERMCAP_so=$'\e[01;33m'
|
|
export LESS_TERMCAP_ue=$'\e[0m'
|
|
export LESS_TERMCAP_us=$'\e[1;4;31m'
|