awesome 3.3 --> 3.4
[cinan.git] / .bashrc
blob4010979075d87a92f547f06f9725155b4309b45b
1 # check the window size after each command and, if necessary,
2 # update the values of LINES and COLUMNS.
3 shopt -s checkwinsize
5 # Colour Codes
6 export Cyan="\[\e[m\]\[\e[0;36m\]"
7 export Red="\[\e[m\]\[\e[0;31m\]"
8 export LightCyan="\[\e[m\]\[\e[1;36m\]"
9 export LightRed="\[\e[m\]\[\e[1;31m\]"
10 export white="\[\e[0;37m\]"
13 function pre_prompt
15     newPWD="${PWD}"
16     let promptsize=$(echo -n "╒═[ $newPWD ]}╗" | wc -c | tr -d " ")
17     width=$COLUMNS
18     let fillsize=${width}-${promptsize}-1
19     let helping=$fillsize
20     fill=""
21     
22     while [ "$fillsize" -gt "0" ]
23     do
24         fill="${fill}═"
25         let fillsize=${fillsize}-${promptsize}
26     done
27     
28     if [ $helping == $fillsize ]
29     then
30         let cutt=3-${fillsize}
31         newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cutt\}\)\(.*\)/\2/")"
32     fi
36 # Set prompt colour
37 if [ `id -u` -eq 0 ]
38 then
39     cText="${LightRed}"
40     cBorder="${Red}"
41 else
42     cText="${LightCyan}"
43     cBorder="${Cyan}"
46 PROMPT_COMMAND=pre_prompt
48 # Display Prompt
49 PS1="  ${cBorder}╒═${cBorder}═[ ${cText}\$newPWD${cBorder} ]\${fill}╕\n  ${cBorder}└${cBorder}> ${white}"
51 # To enable the settings / commands in this file for login shells as well,
52 # this file has to be sourced in /etc/profile.
54 # If not running interactively, don't do anything
55 [ -z "$PS1" ] && return
57 # set variable identifying the chroot you work in (used in the prompt below)
58 #if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
59 #    debian_chroot=$(cat /etc/debian_chroot)
60 #fi
62 # set a fancy prompt (non-color, overwrite the one in /etc/profile)
63 #PS1='\[\e[0;32m\]\u@\h:\w\$\[\e[1;37m\] '
64 #PS1='\[\e[0;36m\]\w\$\[\e[0;37m\] '
65 #export PROMPT_COMMAND='cwd=${PWD%/}; thisdir="$(echo $cwd | sed '\''s/.*\///'\'')"; dirparts="${cwd:0:$((${#cwd} - ${#thisdir}))}"; dirparts="$(echo ${dirparts%/} | sed '\''s/\//\\[\\e[0;33m\\]\/\\[\\e[32m\\]/g'\'')"; rc=${PWD%/}; rc=${rc:0:1}; PS1="\[\e]0;${cwd}/\007\e[1;36m\][\[\e[0;36m\]$(date "+%I:%M:%S %p")\[\e[1m\]] ${dirparts}\[\e[0;33m\]${rc}\[\e[1;34m\]${thisdir}\[\e[0;33m\]/\[\e[1;33m\] %\[\e[0m\] "'
67 # enable bash completion in interactive shells
68 if [ -f /etc/bash_completion ]; then
69     . /etc/bash_completion
72 export TERM=xterm-256color
75 #FUNCTIONS
76 #delete all files except $1, now works with directories and with rm -r
77 function rr () {
78     if [ "$1" == "-rf" ] || [ "$1" == "-Rf" ];
79     then
80         a=$2; p="-rf";
81     else
82         a=$1; p="";
83     fi
84     c=$(echo $a | grep -o "/" | wc -w); 
85     if [ $c -eq 0 ]; then a=./$a; c=1; fi
86     cd $(echo $a | cut -d / -f 1-$c); 
87     rm $p `ls -1 --color=none | grep -vxF $(echo $a | cut -d / -f $(echo $[c+=1]))`; 
88     cd $OLDPWD; 
91 #find out ATI card temperature and set fan speed
92 function teplota { LD_PRELOAD=libXinerama.so.1 aticonfig --od-gettemperature; }
93 function fan() { aticonfig --pplib-cmd "set fanspeed 0 $1"; }
96 alias ls="ls --color -h"
97 #alias editt="sudo vi /usr/share/themes/openbox_cinan/openbox-3/themerc"
98 #alias pal="xterm -hold -bg black -fg white -geometry 37x12 -e pal"
99 alias pacman="pacman-color"
100 alias du="du -hs"
101 alias df="df -h"
102 alias grep="grep --colour -i"
103 alias rubysearch="ruby ~/skripty/search_interface.rb"
104 alias vi="vim -u ~/.vimrc"
105 alias more="less"
106 alias rtorrent="rtorrent -o http_capath=/etc/ssl/certs"
107 alias smplayer="smplayer 2>/dev/null"
108 alias f="cd /media/data/filmy"
109 alias F="cd /media/data"
110 alias d="cd /media/data2"
111 alias D="cd /media/data2/download"
112 alias "true-combat"="fan 50; true-combat.alsa; fan 3;"
113 alias soffice="env GTK2_RC_FILES=/usr/share/themes/Redmond/gtk-2.0/gtkrc env OOO_FORCE_DESKTOP=gnome soffice"
114 alias t="vim -c :TodoOpen -c :q"