-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc.darwin
More file actions
93 lines (79 loc) · 1.96 KB
/
.bashrc.darwin
File metadata and controls
93 lines (79 loc) · 1.96 KB
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
PS1="\[\033[36m\]\u:\[\033[33m\]\t\[\033[0m\]\[\033[0m\]\[\033[32m\] \W\[\033[0m\] $ "
# ls aliases
export LSCOLORS=Exfxcxdxbxegedabagacad
alias ls="ls -G"
alias ll="ls -lG"
alias la="ls -laG"
alias lsd="ls -lF -G | grep --color=never '^d'"
# grep aliases
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# avoid overwriting another file
alias mv='mv -i'
alias cp='cp -i'
alias rm=rmtrash
# cd aliases
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# emacs aliases
alias em='emacs -nw'
alias emacs='emacs -nw'
# vim aliases
alias vi='vim'
# ocaml
alias ocaml='rlwrap ocaml'
# utf encoder
alias utf='nkf -w --overwrite'
# zip all files in current directory
alias zipeachdir="find . \! -name '*.zip' \! -name '.' -type d -exec zip -r {}.zip {} \;"
# git aliasess
alias gb='git branch'
alias gc='git checkout'
alias gcb='git checkout -b'
alias gs='git status'
alias gst='git status'
alias gcm='git checkout master'
alias gpom='git pull origin master'
alias gmm='git merge master'
function mkcd () {
mkdir $1;
cd $1
}
function mktx () {
git clone https://github.com/YosukeHiguchi/LaTex_Template report > /dev/null 2> /dev/null;
rm "report/.git" "report/README.md" "report/preamble_exp.tex";
if [ $# -eq 1 ]; then
mv report $1
fi
}
function opcat() {
open `cat $1`
}
function cdl () {
fileName=();
filePath=();
while read file; do
if [ -d "${file}" ]; then
fileName+=("${file}");
filePath+=($PWD"/${file}");
fi;
done < <(ls);
n=${#fileName[@]};
COUNT=0;
while [ $COUNT -lt $n ]; do
if [ $((COUNT % 2)) -eq 0 ]; then
echo -e "\033[0;34m" $COUNT : "${fileName[$COUNT]}" "\033[0;39m";
else
echo "" $COUNT : "${fileName[$COUNT]}";
fi;
((COUNT++));
done;
read -p "cd to -> " to;
if [ $to -lt $n ]; then
cd ${filePath[$to]};
else
cd .;
fi
}