-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
146 lines (130 loc) · 4.61 KB
/
dot_zshrc
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# ~/.zshrc
# zoug
#
# zsh configuration file
#
# The following lines were added by compinstall
zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' rehash true
zstyle ':completion:*' max-errors 1
zstyle :compinstall filename '~/.zshrc'
autoload -Uz compinit
autoload -U colors
compinit
colors
# these are replaced by starship in my setup
#autoload -U promptinit
#promptinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
setopt appendhistory
setopt autocd
setopt completealiases
unsetopt beep
bindkey -v
# End of lines configured by zsh-newuser-install
# setopts
# see `man zshoptions`
setopt VI
setopt nocorrectall
setopt always_last_prompt
setopt always_to_end
setopt auto_list
setopt auto_param_keys
setopt auto_param_slash
setopt auto_remove_slash
setopt no_bash_auto_list
setopt complete_aliases
setopt complete_in_word
setopt glob_complete
setopt hash_list_all
setopt list_ambiguous
setopt no_list_beep
setopt list_packed
setopt no_list_rows_first
setopt list_types
setopt menu_complete
setopt rec_exact
setopt extended_history
# ignore duplicate commands in history
setopt hist_ignore_all_dups
# don't save commands preceded with space
setopt hist_ignore_space
# share history between shells
setopt share_history
# aliases
source ~/.zsh_aliases
# allows for easy config edits using $EDITOR to edit files
# conf x vim edits first .xinitrc, then .vimrc
# special target "script" can be used to edit bin scripts (in ~/bin). E.g. "conf script hello.sh" opens ~/bin/hello.sh then marks file as executable
# by default, edits the ".config/GIVEN_NAME/config" file
conf() {
while [[ -n $1 ]] ; do
case $1 in
alias) $EDITOR ~/.zsh_aliases && source ~/.zsh_aliases ;;
alacritty) $EDITOR ~/.config/alacritty/alacritty.toml ;;
bspwm) $EDITOR ~/.config/bspwm/bspwmrc ;;
conky) $EDITOR ~/.config/conky/conky.conf ;;
dns) sudo $EDITOR /etc/resolv.conf ;;
dunst) $EDITOR ~/.config/dunst/dunstrc ;;
env) sudo $EDITOR /etc/environment ;;
fstab) sudo $EDITOR /etc/fstab ;;
git) $EDITOR ~/.gitconfig ;;
grub) sudo $EDITOR /etc/default/grub ;;
hosts) sudo $EDITOR /etc/hosts ;;
mc) $EDITOR ~/.mc/config.json ;;
minio) $EDITOR ~/.mc/config.json ;;
mpd) $EDITOR ~/.config/mpd/mpd.conf ;;
ncmpcpp) $EDITOR ~/.ncmpcpp/config ;;
nvim) $EDITOR ~/.config/nvim/init.lua ;;
pacman) sudo $EDITOR /etc/pacman.conf ;;
profile) sudo $EDITOR /etc/profile ;;
script) shift && $EDITOR ~/bin/$1 && [[ -f ~/bin/$1 ]] && chmod +x ~/bin/$1;;
ssh) $EDITOR ~/.ssh/config ;;
starship) $EDITOR ~/.config/starship.toml ;;
sxhkd) $EDITOR ~/.config/sxhkd/sxhkdrc && pkill -USR1 -x sxhkd ;;
tmux) $EDITOR ~/.tmux.conf ;;
vim) $EDITOR ~/.vimrc ;;
x) $EDITOR ~/.xinitrc ;;
xres) $EDITOR ~/.Xresources && xrdb ~/.Xresources ;;
zprofile) $EDITOR ~/.zprofile ;;
zsh) $EDITOR ~/.zshrc && source ~/.zshrc ;;
*) $EDITOR ~/.config/$1/config ;;
esac
shift
done
}
# env variables are all set in /etc/environment (`conf env`)
# path is handled in /etc/profile (`conf profile`)
# easily set brightness
brightness() {
echo "$1" | sudo tee /sys/class/backlight/intel_backlight/brightness
}
brightnessmax() {
cat /sys/class/backlight/intel_backlight/max_brightness | sudo tee /sys/class/backlight/intel_backlight/brightness
}
# displays random fortune with cowsay and colored by lolcat
#fortune | cowsay | lolcat
fastfetch
# zsh-autosuggestions (https://github.com/zsh-users/zsh-autosuggestions/)
# override default strategy for zsh-autosuggestions, then source the file
# package must be installed
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
# starship prompt
eval "$(starship init zsh)"
# manual prompt
# see man zshmisc for details: $' ' is the delimiter, %~ means current path, %F{x} %f means apply color x until %f.
#PS1=$'%M %F{red}»%f %~ %F{red}»%f '
# right prompt contains git info
#source ~/.dotfiles/git-prompt.sh
#setopt PROMPT_SUBST ; RPS1='%F{red}«%f$(__git_ps1 " (%s)") %F{red}«%f'
# if using promptinit:
#prompt walters
# zoxide (smarter cd)
eval "$(zoxide init zsh)"
# direnv
eval "$(direnv hook zsh)"