Bash: My configuration
From FVue
Contents
.alias
# This configuration script is divided into 3 chapters:
# 1. Common
# 2. Domain-specific
# 3. Host-specific
#
# Each chapter contains alpabetized aliases.
#=== 1. Common ======================================================
# C
# Resolve symbolic linked directories of current path
alias c.='cd -P .;pwd'
# G
alias gv=gvim
alias gvi=gvim
# L
alias l='ls -l'
alias lt='ls -ltr'
# O
alias o=less
# S
alias sa='svn add'
alias sc='svn commit'
alias sd='svn diff'
alias se='svn update'
# sg = reserved (execute command as different group ID)
alias si='svn info'
alias sl='svn log'
alias sn='svn annotate'
alias so='svn checkout'
alias spi='svn pe svn:ignore .'
# ss = reserved (iproute2 utility)
alias sr='svn revert'
alias st='svn status'
# su = reserved (change user ID or become super-user)
alias sv='# todo svn vimdiff'
# V
alias v=vim
alias vi=vim
#=== 2. Domain-specific =============================================
# S
# Goto same directory on server
alias s='nameTerminal bach; ssh -A -t bach "test -d \"$PWD\" && cd \"$PWD\"; bash -login"'
#=== 3. Host-specific ===============================================
.bashrc
#!/bin/bash
# Bash runtime configuration script.
# This configuration script is divided into 3 chapters:
# 1. Common
# 2. Domain-specific
# 3. Host-specific
#=== 1. Common ======================================================
function stoppedjobs {
if [ "$(jobs)" ]; then
echo -n "%"
jobs -s | wc -l | sed -e "s/ //g"
fi
} # stoppedjobs()
# My favourite text editor
export EDITOR=/usr/bin/vim
export GREP_OPTIONS="--exclude 'distrib/*' --exclude tags"
# My prompt.
# Color references: Black 0;30 Dark Gray 1;30
# Blue 0;34 Light Blue 1;34
# Green 0;32 Light Green 1;32
# Cyan 0;36 Light Cyan 1;36
# Red 0;31 Light Red 1;31
# Purple 0;35 Light Purple 1;35
# Brown 0;33 Yellow 1;33
# Light Gray 0;37 White 1;37
# See also: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/
export PS1=$'\[\e[0;34m\]\!\[\e[0m\]\[\e[1;32m\]$(stoppedjobs)\[\e[0m\]:\u@\h:\w> '
# Suppress history recording for lines which begin with a
#+ space character (ignorespace), and lines which match with
#+ a previous history entry (ignoredups).
# NOTE: I'm not using 'erasedups' because I've history numbers
#+ displayed on screen via the PS1 prompt, and 'erasedups'
#+ changes history numbers. -- FVu, Sun Dec 3 20:45:52 CET 2006
export HISTCONTROL=ignoreboth
# Suppress history recording for:
# - exit : command 'exit'
export HISTIGNORE=exit
# Suppress history recording for ...
# - exit : command 'exit'
# - l : command 'l'
# - l[ats] : any of the commands 'la', 'lt', 'ls'
export HISTIGNORE="exit:l:l[ats]"
# Indicate max amount of history recordings
export HISTSIZE=500
export VIM=~/.vim
# Operate bash in vi editing mode
set -o vi
[ -r ~/.alias ] && . ~/.alias
# Source additional scripts
for s in ~/.bashrc.d/*.sh ; do
[ -r $s ] && . $s
done
unset s
#=== 2. Domain-specific =============================================
# Project directories. Used by the 'cdp' command
declare -ax PROJ_DIRS=(
$HOME/wproj
$HOME/proj/cdpath/current/paths
$HOME/proj
)
#=== 3. Host-specific ===============================================
.inputrc
# No bell
set bell-style none
# Vi editing mode
set editing-mode vi
set keymap vi
# Produce list of all possible completions at single tab
set show-all-if-ambiguous on
See also
Additional scripts I have in my .bashrc.d:
- cdots.sh
- Creation of seven functions/aliases: 2-8 dots which allow you to move 1-7 directories up, and an optional directory back again –
dir– with TAB-completion!:
.. [dir] = cd ../[dir] ... [dir] = cd ../../[dir] .... [dir] = cd ../../../[dir] ..... [dir] = cd ../../../../[dir] ...... [dir] = cd ../../../../../[dir] ....... [dir] = cd ../../../../../../[dir] ........ [dir] = cd ../../../../../../../[dir]
- nameTerminal.sh
- Change tab and window title of console
Advertisement