blob: 196c34578057509648edc05ff0e4fb76ba63b5e0 (
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# zsh initalization file
# export 'SHELL' to child processes
export SHELL
# set lang
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# set history
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.histfile
# check for non-interactive shell
if [[ $- != *i* ]]
then
# We are being invoked from a non-interactive shell. If this
# is an SSH session (as in "ssh host command"), source
# /etc/profile so we get PATH and other essential variables.
[[ -n "$SSH_CLIENT" ]] && source /etc/profile
# Don't do anything else.
return
fi
# load zsh plugins
bindkey -v
tabs
autoload compinit
compinit
autoload -U colors && colors
setopt promptsubst
# update PATH
PATH=$PATH:$HOME/.local/bin
PATH=$PATH:$HOME/.cargo/bin
# vim mode >:)
# no ryan i am not copying you
set -o vi
set show-mode-in-prompt on
# fallback zsh prompt
function prompt_char {
if [ $UID -eq 0 ]; then echo '#'; else echo '$'; fi
}
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "%F{13} [${ref#refs/heads/}]%{$reset_color%}"
}
PROMPT='%(!.%F{9}.%F{10})%n@%m: %F{15}%c%F{12}$(git_prompt_info)%F{12}$(prompt_char)%F{15} '
PROMPT2='%_%F{12}:%F{15} '
# set shell prompt using starship
if command -v "starship" > /dev/null; then
eval "$(starship init zsh)"
fi
# aliases
alias rf="rm -fr" # remove le french hon hon hon
alias ls="ls --color=auto"
alias ip="ip --color=auto"
alias grep="grep --color=auto"
alias diff="diff --color=auto"
alias vim="nvim"
alias ssh='TERM=xterm-256color ssh' # xterm-kitty bad
# zoxide
eval "$(zoxide init zsh)"
alias cd="z"
# nix rebuild
alias rs="sudo nixos-rebuild switch --flake ~/.config/nix#$(hostname)"
alias rh="home-manager switch --flake ~/.config/nix#$(hostname)"
# manpages
export LESS_TERMCAP_md=$'\e[1;36m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[1;92m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;35m'
export GROFF_NO_SGR=1
# keybinds
bindkey "\e[1;5D" backward-word
bindkey "\e[1;5C" forward-word
bindkey "\e[3;5~" kill-word
bindkey "\C-_" backward-kill-word
bindkey "\e[3~" delete-char
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
bindkey "\e\d" undo
# gpg
export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
# tmux
alias tmux="tmux -u"
|