-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
executable file
·86 lines (69 loc) · 2.1 KB
/
zshrc
File metadata and controls
executable file
·86 lines (69 loc) · 2.1 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
source "$HOME/.env"
ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
export DISABLE_AUTO_TITLE=true
export VI_MODE_SET_CURSOR=true
export EDITOR='nvim'
plugins=(macos vi-mode history-substring-search fzf zsh-interactive-cd)
source "$ZSH/oh-my-zsh.sh"
# speed up git prompt info (manually run `git status` in the repository fixes
# this)
function git_prompt_info() {
ref=$(git-branch-name -q -h 12 -b 64) || return
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}
# cd into projets faster
# make sure to prepend the current directory '.'
export CDPATH=.:~/Code
# Setup Homebrew
if command -v /opt/homebrew/bin/brew &>/dev/null; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Setup Mise
if command -v mise &>/dev/null; then
eval "$(mise activate zsh)"
eval "$(mise completion zsh)"
fi
# Setup fzf shell history
if command -v fzf &>/dev/null; then
source <(fzf --zsh)
fi
# Setup starship shell prompt
if command -v starship &>/dev/null; then
eval "$(starship init zsh --print-full-init)"
fi
# Custom Paths
PATHS=(
"$HOME/.local/bin"
"$HOME/.bin"
)
LINUX_PATHS=(
"/usr/local/sbin"
)
if [ "$(uname)" != "Darwin" ]; then
PATHS=("${LINUX_PATHS[@]}" "${PATHS[@]}")
fi
# Ensure custom paths are prepended and not duplicated in PATH
for entry in "${PATHS[@]}"; do
PATH=$(echo ":$PATH:" | sed -e "s;:$entry:;:;g" -e 's/^://;s/:$//')
export PATH="$entry:$PATH"
done
for f in ~/.sources/**/*; do
. "$f"
done
if [ "$(uname)" != "Darwin" ]; then
if [[ -z ${SSH_CONNECTION} ]]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
fi
fi
if command -v tmux &>/dev/null && [ -n "$PS1" ] && [[ ! $TERM =~ screen ]] && [[ ! $TERM =~ tmux ]] && [ -z "$TMUX" ]; then
exec tmux new-session -A -s main
fi
function tm() {
[[ -n $TMUX ]] && change="switch-client" || change="attach-session"
if [ $1 ]; then
tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1")
return
fi
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found."
}