aboutsummaryrefslogtreecommitdiff
path: root/.zshrc
blob: a671f93cc81bad76270f529eb5ff1611c0cd1fa8 (plain) (blame)
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
fastfetch

# Instant prompt (must stay near top)

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

# Environment

export PATH="$PATH:$HOME/.local/bin"

export EDITOR="nvim"
export SUDO_EDITOR="nvim"

export DEBUGINFOD_URLS="https://debuginfod.archlinux.org"

HISTFILE="$HOME/.histfile"
HISTSIZE=100000
SAVEHIST=100000

setopt interactivecomments
bindkey -e

# Programs

# Use systemd/user-managed ssh-agent socket
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"

# Completion

autoload -Uz compinit
compinit

zstyle ':completion:*' menu select
zstyle ':completion:*' verbose yes
zstyle ':completion:*' completer \
    _complete \
    _ignored \
    _approximate \
    _list \
    _match \
    _prefix

zstyle ':completion:*' matcher-list \
    'm:{a-z}={A-Z}' \
    'm:{A-Z}={a-z}'

zstyle ':completion:*' max-errors 3 prompt 'Errors: %e'
zstyle ':completion:*' menu select=long-list select
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' accept-exact '*(N)'

# Plugins

source <(fzf --zsh)

eval "$(zoxide init zsh)"

source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion history)

# Aliases

alias yoink='yay -S'
alias yeet='yay -R'
alias x='exit'
alias cls='clear'

alias ls='eza -lh --group-directories-first --color=always --git --icons=auto'
alias tree='eza -T -lh --group-directories-first --git --icons=auto'

alias sudo='sudo -E'
alias cd='z'

# Functions

mkcd() {
    mkdir -p "$1" && cd "$1"
}

command_title() {
    printf '\033]0;%s\007' "$1"
}

autoload -Uz add-zsh-hook
add-zsh-hook preexec command_title

# Prompt

source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme

[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh