-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_profile
116 lines (91 loc) · 2.42 KB
/
bash_profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#http://blog.sanctum.geek.nz/prompt-directory-shortening/
PS1_PWD_MAX=15
__pwd_ps1() { echo -n $PWD | sed -e "s|${HOME}|~|" -e "s|\(/[^/]*/\).*\(/.\{${PS1_PWD_MAX}\}\)|\1...\2|"; }
GIT_PS1_SHOWDIRTYSTATE=1
PS1='\[\033[01;34m\]$(__pwd_ps1)$(__git_ps1 " \[\033[01;31m\](%s)")$\[\033[00m\] '
alias enable_alert='PS1="$PS1\a"'
#
#set swedish mac keyboard mapping
setxkbmap -layout se -variant mac -option ctrl:nocaps
#turn flow control off
stty -ixon
#add local clang dir to path variable
export PATH=~/arbete/resources/clang/clang+llvm-3.6.0-x86_64-linux-gnu/bin/:$PATH
#vim "$acnd"/httpd.confO
#tolerate typos
#in cd commands
shopt -s cdspell
#ignore git dir in grep
alias grep='grep --exclude-dir=.git --color'
alias naelv='urxvt -e sh -c "mosh aelv -- screen -dr" &'
alias xclipin='xclip -i -selection clipboard'
alias gitclone='git clone $(xclip -o)'
#to remove function:
#unset -f <functionname>
#
#
#basic calculator syntax - function
=() {
calc="${@//p/+}"
calc="${calc//x/*}"
bc -l <<<"scale=10;$calc"
}
function lsext()
{
find . -type f -iname '*.'${1}'' -exec ls -l --color=auto {} \; ;
}
function streambest()
{
livestreamer ${1} best &
}
function mkcd()
{
#if [ ${1} != '' ] ; then
if [ ${1} ] ; then
mkdir ${1}; cd ${1}
echo $(pwd)
fi
}
function mvcd()
{
echo $#
if [ $# == 2 ] ; then
mv ${1} ${2}; cd ${2}
echo $(pwd)
else
echo "need two arguments"
fi
}
function copyfile()
{
cat ${1} | xclip -i -selection clipboard
}
function streamclip()
{
livestreamer $(xclip -o) best &
}
function ytclip()
{
youtube-viewer $(xclip -o) best -q --no-interactive &
}
function streamtest()
{
if livestreamer $(xclip -o) best -Q & > /dev/null; then
printf 'livestreamer ok\n' >&2
else
printf 'livestreamer not ok' >&2
youtube-viewer $(xclip -o) best -q & > /dev/null &
fi
}
#vi(m) mode for bash, rathr than emacs
set -o vi
#change fileformat completetion for vim:
#BACKUP
#$complete -p vim
#complete -F _filedir_xspec vim
complete -f -X '*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class|pdf)' vim
# this is default taken from: http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=blob;f=bash_completion;h=c684a8fd9ded8b79b3ecbbbe30728679dbded276;hb=e777395ac3ce25527e58e04bfc406ae03bdb3b12#l1821
# but with addition of pdf
complete -f -X '*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class|pdf)' vtex
#load .Xmodmap for prtscr -> alt gr
xmodmap ~/.Xmodmap