-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
67 lines (53 loc) · 2.25 KB
/
.aliases
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
# Set aliases for zsh and bash (only)
# should only source this for interactive shells
alias_if_exists () {
[[ -e "$2" ]] && alias "$1"=\'"$2"\'
}
# git dotfile management
# https://www.atlassian.com/git/tutorials/dotfiles
alias git-dotfile='/usr/bin/env git --git-dir="$HOME/._dotfile_repo/" --work-tree="$HOME"'
alias hgrep='history | grep'
alias conda_update='conda update -n base conda'
## PLATFORM SPECIFIC
_uname_val=$( uname -s )
case "$_uname_val" in
Darwin*)
# color ls; flags are different on BSD
# use colors set by terminal's theme instead of our own
alias ls="/bin/ls -bFG"
alias la="/bin/ls -abFG"
# sublime text, if installed
_temp_path="/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
if ! [[ -x "$(command -v subl)" ]] && [[ -e "$_temp_path" ]]; then
# define as a shell function, since alias can't contain spaces
# prefer to do this instead of adding to $PATH
eval "subl () { \"${_temp_path}\" \"\$@\"; }"
# need to export function?
# export -f subl
fi
# Mathematica, if installed
alias_if_exists mathkernel "/Applications/Mathematica.app/Contents/MacOS/MathKernel"
# chrome
alias_if_exists "google-chrome" "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
# VS Code
alias_if_exists "vscode" "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
# Julia from app
alias_if_exists "julia" "/Applications/Julia-latest.app/Contents/Resources/julia/bin/julia"
alias_if_exists "julia19" "/Applications/Julia-1.9.app/Contents/Resources/julia/bin/julia"
alias_if_exists "julia18a" "/Applications/Julia-1.8-arm.app/Contents/Resources/julia/bin/julia"
alias_if_exists "julia17" "/Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia"
alias_if_exists "julia16" "/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia"
# Jupyterlab desktop
alias_if_exists jupyter_app "/Applications/JupyterLab.app/Contents/Resources/jlab_server/bin/jupyter"
# macOS has no `md5sum`, so use `md5` as a fallback
command -v md5sum > /dev/null || alias md5sum="md5"
# macOS has no `sha1sum`, so use `shasum` as a fallback
command -v sha1sum > /dev/null || alias sha1sum="shasum"
unset _temp_path
;;
Linux*)
;;
*)
echo "Unrecognized platform ${_uname_val}"
;;
esac