summaryrefslogtreecommitdiff
path: root/.config/zsh/.zshrc
blob: b2ad5529dd819e8237a0a8ca45763a1808299e7a (plain)
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
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Useful scripts
addr="127.0.0.1:7897"
alias pro="export http_proxy=$addr && export https_proxy=$addr"
alias upro="unset http_proxy && unset https_proxy"
alias music='tmux new-session -s $$ "tmux source-file ~/.config/ncmpcpp/tsession"'
alias wget="wget --hsts-file ~/.cache/wget-hsts"
alias dotfiles='/usr/bin/git --git-dir="$HOME/.local/dotfiles" --work-tree="$HOME"'

# Export PATH
#export PATH="$PATH:/home/pico/data/codes/scripts:/home/pico/.local/share/cargo/bin"
export PATH="$PATH:/home/pico/data/codes/scripts"

# XDG_BASE_DIR
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"

# XDG_USER_DIR
export XDG_DESKTOP_DIR="$HOME/data/desktop"
export XDG_DOCUMENTS_DIR="$HOME/data/documents"
export XDG_DOWNLOAD_DIR="$HOME/data/downloads"
export XDG_MUSIC_DIR="$HOME/data/music"
export XDG_PICTURES_DIR="$HOME/data/pictures"
export XDG_PUBLICSHARE_DIR="$HOME/data/public"
export XDG_TEMPLATES_DIR="$HOME/data/templates"
export XDG_VIDEOS_DIR="$HOME/data/videos"

# export env variables
export ZIM_CONFIG_FILE="$HOME/.config/zsh/zimrc"
export ZIM_HOME="$XDG_DATA_HOME/zim"
export ZDOTDIR="$HOME/.config/zsh"
export VIMINIT="source ~/.config/vim/vimrc"
export GNUPGHOME="$HOME/.config/gnupg"
export TERM=xterm-256color
export LESSHISTFILE="$HOME/.cache/lesshst"
export PASSWORD_STORE_DIR="$HOME/.local/pass"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export GOPATH="$XDG_DATA_HOME/go"
export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
export XINITRC="$XDG_CONFIG_HOME/X11/xerverrc"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export FEHBG_PATH="$XDG_CONFIG_HOME/feh/fehbg"
export EDITOR="vim"

# Download zimfw plugin manager if missing.
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
  curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \
      https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
fi

# Install missing modules and update ${ZIM_HOME}/init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then
  source ${ZIM_HOME}/zimfw.zsh init -q
fi

# Initialize modules.
source ${ZIM_HOME}/init.zsh

# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh

export GPG_TTY=$TTY
#unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_BY:-0}" -ne $$ ]; then
    export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
gpgconf --launch gpg-agent