-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
136 lines (118 loc) · 3.66 KB
/
bashrc
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
130
131
132
133
134
135
136
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return ;;
esac
export TERM=xterm-256color
export PAGER=less
export LESS="-X -R"
export HISTTIMEFORMAT='%F %T '
export HISTSIZE=1000
export HISTFILESIZE=2000
export HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
# shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# aliases
alias rebash='source ~/.bashrc'
alias lls='ls -ltr'
alias xcat='xmllint --format'
alias lls="ls -ltr"
alias l="less"
alias listd="ls -ltr | grep ^d"
alias igrep="grep -i"
alias llo="lsof +d ."
alias pysmp="python -m SimpleHTTPServer"
alias tmat="tmux attach"
alias giturl="git remote set-url origin"
alias duf='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'
alias agp='ack-grep --passthru'
alias hg='history | grep'
alias pe='perl -pe'
alias ipe='perl -i -pe'
alias fargs="find . -type f | xargs"
xless() { xmllint --format $1 | less; }
wless() { cut -c -$COLUMNS $1 | less; }
pshere() { ps -fp $(pwdx $(ps -e | awk '{print $1}' | grep -v PID) 2>/dev/null | grep $PWD | cut -d: -f1 | tr '\n' , | perl -pe "s#(.*),#\1#"); }
pss() { ps -fu $(whoami); }
fp() {
dir=${2:-.}
find ${dir} -name "*$1*"
}
ac() { awk '{print $COL}' COL=$1; }
# marks
jump() {
[ -z "$1" ] && echo "mark name missing" && return 1
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
mark() {
[ -z "$1" ] && echo "mark name missing" && return 1
mkdir -p "$MARKPATH"
ln -s "$(pwd)" "$MARKPATH/$1"
}
unmark() {
[ -z "$1" ] && echo "mark name missing" && return 1
rm -i "$MARKPATH/$1"
}
marks() {
ls -l "$MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
}
_completemarks() {
local curw=${COMP_WORDS[COMP_CWORD]}
local wordlist=$(find $MARKPATH -type l -printf "%f\n")
COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
return 0
}
export MARKPATH=${HOME}/.marks
mkdir -p ${MARKPATH}
complete -F _completemarks jump unmark
PROMPT_COMMAND='echo -ne "\033]0;`hostname`: ${PWD} - `$WHOAMI` \007"'
if command -v kubectl &>/dev/null; then
source <(kubectl completion bash)
alias k=kubectl
complete -F __start_kubectl k
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/aayoubi/miniconda3/bin/conda' 'shell.bash' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/aayoubi/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/aayoubi/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/aayoubi/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH="$PATH:/usr/local/go/bin"
jcurl() {
curl $@ | jq
}
# pnpm
export PNPM_HOME="/home/aayoubi/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
export PATH="$PATH:/opt/nvim-linux64/bin"
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
alias vi=nvim
alias vim=nvim