-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_profile
More file actions
129 lines (111 loc) · 3.28 KB
/
Copy pathdot_profile
File metadata and controls
129 lines (111 loc) · 3.28 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
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
PATH="${HOME}/.npm-user/bin:${PATH}" # .npmrc: prefix
PATH="/usr/local/sbin:${PATH}"
PATH="/usr/local/opt/coreutils/libexec/gnubin:${PATH}" # brew coreutils "prefixless"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:${MANPATH}" # "
export GOPATH="${HOME}/.gopath"
PATH="${GOPATH}/bin:${PATH}"
PATH="${HOME}/.cargo/bin:${PATH}" # rust
export NVM_DIR="${HOME}/.nvm"
[ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh" # This loads nvm
export PYENV_ROOT="${HOME}/.pyenv"
PATH="${PYENV_ROOT}/bin:${PATH}"
PATH="${HOME}/.local/bin:${PATH}" # pip --user
PATH="${HOME}/bin:${PATH}" # keep as last PATH tweak
if hash mise 2>/dev/null; then
eval "$(mise activate)"
fi
export EDITOR='vim' # avoid git interaction issue with vim's vi mode
export PIP_REQUIRE_VIRTUALENV="true"
export PYTHONDONTWRITEBYTECODE=1
export HOMEBREW_NO_EMOJI=1
if hash delta 2>/dev/null; then
export GIT_PAGER="delta"
fi
if hash difft 2>/dev/null; then
# export GIT_EXTERNAL_DIFF="difft"
export DFT_DISPLAY="inline"
fi
if hash ag 2>/dev/null; then
# ag uses .gitignore
export FZF_DEFAULT_COMMAND='ag -g ""'
fi
if hash rg 2>/dev/null; then
# rg better at using .gitignore
export FZF_DEFAULT_COMMAND='rg --color never --files'
fi
setup_ssh_agent() {
local SHARED_SSH_AUTH_SOCK="${HOME}/.ssh/ssh_auth_sock"
if [ -z "${SSH_AUTH_SOCK}" \
-a -S "${SHARED_SSH_AUTH_SOCK}" ]; then
export SSH_AUTH_SOCK="${SHARED_SSH_AUTH_SOCK}"
fi
ssh-add -l >/dev/null 2>&1 # test agent functionality
if [ "${?}" -ne 2 ]; then # 2 means unable to contact agent
return # existing agent is working
fi
if hash ssh-agent 2>/dev/null; then
eval $(ssh-agent)
if [ -d $(dirname "${SHARED_SSH_AUTH_SOCK}") ]; then
ln -sf "${SSH_AUTH_SOCK}" "${SHARED_SSH_AUTH_SOCK}" &&
export SSH_AUTH_SOCK="${SHARED_SSH_AUTH_SOCK}"
fi
fi
}
setup_ssh_agent
alias g='git'
alias l.='ls -d .*'
alias la='ls -a'
alias ld='lrt ~/Downloads'
alias lf='ls -FA'
alias ll='ls -lA'
alias lrs='ls -lrS'
alias lrt='ls -lrt'
alias vea='source .venv/bin/activate'
alias ved='deactivate'
alias vi='vim'
if hash nvim 2>/dev/null; then
alias vim='nvim'
export EDITOR='nvim'
fi
# alias GNU find (defaults to cwd for path...)
if hash gfind 2>/dev/null; then
alias find=gfind
fi
if hash dircolors 2>/dev/null; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls -F --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
fi
# GNU and macOS (BSD) *grep both support color
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias s3-cli='$(which node) --max_old_space_size=4096 $(which s3-cli)'
function tp {
WRAPPER_BIN="${HOME}/.tmuxp/${1}"
if [ -x "${WRAPPER_BIN}" ]; then
"${WRAPPER_BIN}" "${@:2}"
else
tmuxp load "${@}"
fi
}
function ws {
tp "${@}" || {
echo "activating tmux manually"
WS_DIR="${1}"
if [ ! -d "${WS_DIR}" ]; then
WS_DIR="${HOME}/workspace/${WS_DIR}"
fi
# subshell to retain working directory
(cd "${WS_DIR}" && exec tmux new-session -As "${1}")
}
}
function mkdcd {
DIR=$(date -I)
if [ -n "${1}" ]; then
DIR="${DIR}.${1// /_}"
fi
mkdir "${DIR}" && cd "${DIR}" && pwd
}
[[ -s "$HOME/.profile.local" ]] && source "$HOME/.profile.local"