-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshenv
68 lines (57 loc) · 3.92 KB
/
.zshenv
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
# .zshenv: Sourced for all shells, including non-interactive ones
# Purpose: Set up environment variables and ensure XDG compliance.
# Note: There are some non-standard locations in favor of keeping ~ clean.
# .ssh and other delicate folders are preserved against cleanliness for peace of mind.
# update dotfiels to latest
git pull
#┌─────────────────────────────────────────────────┐
#│ XDG Base Directory Specification │
#└─────────────────────────────────────────────────┘
# XDG: A standard for organizing user directories for config, data, cache, and state files
# More info: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
eval "$(/usr/local/bin/xdg-dirs)"
# custom go program (xdg_user_dirs_update_cross)(https://github.com/adriangalilea/xdg-user-dirs-update-cross)
#┌─────────────────────────────────────────────────┐
#│ Zsh │
#└─────────────────────────────────────────────────┘
export ZDOTDIR="$HOME" # Keep .zshrc in the home directory
export HISTFILE="$XDG_STATE_HOME/zsh/history" # Store Zsh history in XDG state directory
export ZSH_COMPDUMP="$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" # Store completion dump file in XDG cache directory
mkdir -p \
"$XDG_STATE_HOME/zsh" \
"$XDG_CACHE_HOME/zsh" \
"${ZSH_COMPDUMP:h}"
#┌─────────────────────────────────────────────────┐
#│ Misc │
#└─────────────────────────────────────────────────┘
# SSH configuration
export SSH_CONFIG="$XDG_CONFIG_HOME/ssh/config"
# Terminfo directories
export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo:$HOME/.terminfo:/usr/share/terminfo"
mkdir -p "$XDG_DATA_HOME/terminfo"
# synchting
export STCONFIGDIR="$XDG_CONFIG_HOME/syncthing"
export STSTATEDIR="$XDG_STATE_HOME/syncthing"
mkdir -p "$STCONFIGDIR" "$STSTATEDIR"
#┌─────────────────────────────────────────────────┐
#│ zplug │
#└─────────────────────────────────────────────────┘
export ZPLUG_RCFILE="$XDG_CONFIG_HOME/zplug/zplugrc"
export ZPLUG_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/zplug"
#┌─────────────────────────────────────────────────┐
#│ Load fzf functions for completions │
#└─────────────────────────────────────────────────┘
# This section is necessary for the completions pane to have the correct
# functions loaded. Without this, these functions would not be available
# in the non-interactive shell that the completions runs in.
if [[ ! $- == *i* ]] || [[ "${0:t}" = "zsh" ]]; then
# Ensure 'bat' command is available for fzf functions
if ! command -v bat &> /dev/null; then
if command -v batcat &> /dev/null; then
alias bat=batcat
else
alias bat="cat" # Fallback to 'cat' if neither 'bat' nor 'batcat' is available
fi
fi
source "$HOME/.config/shell/fzf_functions.zsh"
fi