-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
executable file
·113 lines (89 loc) · 3.05 KB
/
zshrc
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
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zshhistory
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt SHARE_HISTORY
# Prevent ranger from loading it's default config.
export RANGER_LOAD_DEFAULT_RC=FALSE
# configure PATH
setopt extended_glob null_glob
path=(
$path
/var/lib/flatpak/exports/bin
$HOME/.local/share/flatpak/exports/bin
$HOME/.local/bin
$HOME/.local/scripts
)
# remove duplicate entries from PATH.
typeset -U path
# exclude any directories that don't exist.
path=($^path(N-/))
# finally, set the PATH. Remember that there is a special relationship in zsh
# between $PATH and $path, which allows you to do to this.
export PATH
# Set env variable for GPG
GPG_TTY=$(tty)
export GPG_TTY
# enable vi mode
bindkey -v
export KEYTIMEOUT=1
# Source browser settings if file exists
[ -f ~/.browser ] && source ~/.browser
export TERM=tmux-256color
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'left' vi-backward-char
bindkey -M menuselect 'down' vi-down-line-or-history
bindkey -M menuselect 'up' vi-up-line-or-history
bindkey -M menuselect 'right' vi-forward-char
# Fix backspace bug when switching modes
bindkey "^?" backward-delete-char
# Load aliases and shortcuts if existent.
[ -f "$HOME/aliasrc" ] && source "$HOME/aliasrc"
#change ZSH autosuggest highlight color
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=006'
# Set ctrl+space to accept suggestion.
bindkey '^ ' autosuggest-accept
# Start hook for direnv
eval "$(direnv hook zsh)"
bindkey -s '^f' "tmux-sessionizer\n"
# pacman and apt put these in 2 different locations
# so I need to figure out which one to load depending on what OS I'm currently using.
# Arch / Pacman
if [[ -d /usr/share/zsh/plugins ]]; then
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null
# Ubuntu / APT
elif [[ -d /usr/share/zsh-autosuggestions ]]; then
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null
fi
if which starship >/dev/null 2>&1; then
eval "$(starship init zsh)"
fi
if [ -d /home/linuxbrew/ ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# Set EDITOR.
# Do this AFTER loading brew vars, since it's installed via homebrew now on a lot of my systems.
if command -v nvim >/dev/null; then
export EDITOR=$(which nvim)
else
export EDITOR=/usr/bin/vim
fi
# Set up fzf key bindings and fuzzy completion
source <(fzf --zsh)
if [ -f /home/linuxbrew/.linuxbrew/bin/zoxide ] || [ -f /usr/bin/zoxide ]; then
eval "$(zoxide init zsh --cmd cd)"
fi