-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshellrc
More file actions
93 lines (72 loc) · 2.05 KB
/
Copy pathshellrc
File metadata and controls
93 lines (72 loc) · 2.05 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
#! /bin/zsh
is_ubuntu() {
has_cmd lsb_release || return 1
local os
os=$(lsb_release -i | cut -d ':' -f2)
[[ "$os" == *"Ubuntu" ]] || [[ "$os" == *"neon" ]] || [[ "$os" == *"elementary OS" ]] || [[ "$os" == *"LinuxMint" ]]
}
is_mac() {
[[ "$OSTYPE" == "darwin"* ]]
}
has_cmd() {
command -v $1 > /dev/null
}
if is_ubuntu; then
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
export JDK_HOME="/usr/lib/jvm/java-8-oracle"
fi
if is_mac; then
export JAVA_HOME=`/usr/libexec/java_home -v 1.8 2> /dev/null`
export JDK_HOME=`/usr/libexec/java_home -v 1.8 2> /dev/null`
fi
if [[ -s ~/.nvm/nvm.sh ]]; then
export NVM_DIR="$HOME/.nvm"
source "$HOME/.nvm/nvm.sh"
fi
export PATH="$HOME/bin:$PATH"
[[ $- = *i* ]] || return 0
# code for interactive shell only
if [[ -n "$ZSH_VERSION" ]]; then
[ -d ~/.slimzsh ] || git clone --recursive https://github.com/changs/slimzsh.git ~/.slimzsh
if [[ -e ~/.slimzsh/slim.zsh ]]; then
source "$HOME/.slimzsh/slim.zsh"
else
autoload -U compinit promptinit
compinit
promptinit
prompt walters
fi
unsetopt correct_all
elif [[ -n "$BASH_VERSION" ]]; then
[ -d ~/.liquidprompt ] || git clone https://github.com/nojhan/liquidprompt.git ~/.liquidprompt
[ -f ~/.liquidprompt/liquidprompt ] && source ~/.liquidprompt/liquidprompt
fi
if is_ubuntu; then
alias trash=trash-put
alias open="xdg-open"
fi
technoidentity_upgrade_all() {
is_ubuntu && sudo apt-get update && sudo apt-get upgrade -y
is_mac && has_cmd brew && brew update && brew upgrade
local dir=$(pwd)
if cd ~/.technoidentity/dotfiles; then
git pull --ff-only
fi
cd $dir
has_cmd npm && npm update -g
}
alias upa=technoidentity_upgrade_all
alias gst="git status"
if has_cmd emacs; then
export ALTERNATE_EDITOR=""
export EDITOR="emacsclient -t"
export VISUAL="emacsclient -c"
alias ec="emacsclient -c -n"
alias et="emacsclient -t"
fi
if is_mac; then
alias ls='ls -G'
else
alias ls='ls --color=auto'
fi
alias j=z