-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc_iyui
129 lines (112 loc) · 3.65 KB
/
.bashrc_iyui
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
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
#---alias keys-------------------------------------------------------
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias la='ls -al'
alias ll='ls -l'
alias lt='ls -lt | head'
alias scpr='scp -r -l 1000'
alias gedit='gedit &> /dev/null '
alias edit='mobatexteditor'
#--------------------------------------------------------------------
# setup gedit editor only X11 display is available
if ! [ "aaa$DISPLAY" = "aaa" ]; then
gsettings set org.gnome.gedit.preferences.ui show-tabs-mode 'always'
gsettings set org.gnome.gedit.preferences.editor tabs-size 2
gsettings set org.gnome.gedit.preferences.editor insert-spaces true
fi
# enables search through history just by typing first few chars of command and type "upward key" \e[A
if [[ $- == *i* ]]
then
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
fi
export HISTSIZE=20000
export HISTFILESIZE=20000
export HISTCONTROL=ignoreboth
# Add git branch to PS1 if it's present
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\n\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\n\$ '
fi
parse_git_branch
# keyword-search files in $1 specified directory or lower. Returns matched file locations.
function wsearch() {
find $1 -type f \
\( ! -name "*.png" -a ! -name "*.jpg" -a ! -name "*.dat" -a ! -name "*.svn*" -a ! -name "*.eps" -a ! -name "*.ps" \) | \
while read -r file; do grep -rl "$2" $file; done
}
export -f wsearch
# extract compressed files
function extract () {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xf) tar xf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
export -f extract
# instead of cd ../../../ just type up 3
function up(){
local d=""
limit=$1
for ((i=1 ; i <= limit ; i++))
do
d=$d/..
done
d=$(echo $d | sed 's/^\///')
if [ -z "$d" ]; then
d=..
fi
c $d
}
export -f up
# cd and ls in one command
function c() {
local dir="$1"
local dir="${dir:=$HOME}"
if [[ -d "$dir" ]]; then
cd "$dir" >/dev/null; ls --color=auto
elif [ "$1" == "-" ] ; then
cd - >/dev/null; ls --color=auto
else
echo "bash: c: $dir: Directory not found"
fi
}
export -f c
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
#__conda_setup="$('/grpK/cpd/cpdall/ndvesm12/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
#if [ $? -eq 0 ]; then
# eval "$__conda_setup"
#else
# if [ -f "/grpK/cpd/cpdall/ndvesm12/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/grpK/cpd/cpdall/ndvesm12/anaconda3/etc/profile.d/conda.sh"
# else
# export PATH="/grpK/cpd/cpdall/ndvesm12/anaconda3/bin:$PATH"
# fi
#fi
#unset __conda_setup
# <<< conda initialize <<<