summaryrefslogtreecommitdiff
path: root/.zshrc
blob: bc999f0c3131596476f331b3f332231cd1cf18f6 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
typeset -U PATH path
path=(	"$HOME/bin"
	"$HOME/.local/bin"
	"$HOME/.cargo/bin"
	"/bin"
	"/usr/bin"
	"/usr/sbin"
	"/usr/games"
	"/usr/local/games"
	"/usr/local/bin"
	"/usr/local/sbin"
	"/run/wrappers/bin"
	"/home/$USER/.nix-profile/bin"
	"/etc/profiles/per-user/$USER/bin"
	"/nix/var/nix/profiles/default/bin"
	"/run/current-system/sw/bin"
)
export PATH
EDITOR=nvim
export EDITOR

autoload -Uz compinit 
compinit
zmodload zsh/complist
zstyle ':completion:*' menu select

bindkey -v
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char

function zle-keymap-select () {
	case $KEYMAP in
		vicmd) echo -ne '\e[1 q';;
		viins|main) echo -ne '\e[5 q';;
	esac
}
zle -N zle-keymap-select

zle-line-init() {
	zle -K viins
	echo -ne "\e[5 q"
}
zle -N zle-line-init

autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^e' edit-command-line

alias ls='ls --color'
alias la='ls -la --color'
alias vim='nvim'
alias listen='mpv --no-video'
#alias mpv='mpv -vo=drm'

setopt auto_cd

HISTSIZE=999999999
SAVEHIST=999999999
HISTFILE=~/.history

if [[ "$(grep ^ID= /etc/os-release)" == *"arch"* ]]; then
	source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
	source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
elif [[ "$(grep ^ID= /etc/os-release)" == *"debian"* ]]; then
	source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
	source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
elif [[ "$(grep ^ID= /etc/os-release)" == *"ubuntu"* ]]; then
	source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
	source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
fi

bindkey '^f' end-of-line

autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats '|%F{3}%b%f'

gpg-connect-agent updatestartuptty /bye > /dev/null

unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
  export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi

setopt PROMPT_SUBST
PROMPT='<%F{2}%n%f@%F{6}%m%f|%F{5}%~%f${vcs_info_msg_0_}%f> '