-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
143 lines (114 loc) · 3.2 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
###############
# ZSH OPTIONS #
###############
# Change dir by just typing it's name.
setopt auto_cd
# Auto pushd when changing directories.
setopt auto_pushd
# Don't push dublicate direcories.
setopt pushd_ignore_dups
# Careful `rm`s.
setopt rm_star_wait
# Timestamps and time in history.
setopt extended_history
# When cleaning history remove oldest dups first.
setopt hist_expire_dups_first
# Remove comand from history list if first char is space.
setopt hist_ignore_space
# Cleanup commands in history.
setopt hist_reduce_blanks
# Multiple streams automatically.
setopt multios
# Add our custom compleations.
fpath=(/usr/share/bash-completion/bash_completion $fpath)
fpath=(~/.zcomplete $fpath)
##########
# PREZTO #
##########
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
#########
# ALIAS #
#########
# Emacs with correct daemon settings for Archlinux.
alias e="emacsclient -t --socket-name /run/user/1000/emacs/server"
alias emc="emacsclient -n -c --socket-name /run/user/1000/emacs/server"
# Make these commands ask before clobbering a file. Use -f to override.
alias rm="rm -i"
alias cp="cp -i"
alias mv="mv -i"
if hash exa 2>/dev/null; then
alias ls="exa"
fi
if hash bat 2>/dev/null; then
alias cat="bat"
fi
alias archrss="rsstail -u https://aur.archlinux.org/rss/ -n 10 -d -N -l"
# Pacman
alias pacrank="rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup | sudo tee /etc/pacman.d/mirrorlist"
# Fasd
alias a="fasd -a" # any
alias s="fasd -si" # show / search / select
alias d="fasd -d" # directory
alias f="fasd -f" # file
alias sd="fasd -sid" # interactive directory selection
alias sf="fasd -sif" # interactive file selection
alias z="fasd_cd -d" # cd, same functionality as j in autojump
alias zz="fasd_cd -d -i" # cd with interactive selection
#############
# FUNCTIONS #
#############
# Launch and detach an app.
launch() {
( $* &> /dev/null & )
}
#####################
# VIRTUALENVWRAPPER #
#####################
if [ -f /usr/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=~/.virtualenvs
export PROJECT_HOME=~/Projects
export VIRTUAL_ENV_DISABLE_PROMPT=true
source /usr/bin/virtualenvwrapper.sh
fi
######
# UI #
######
# Base16 Shell
BASE16_SHELL=$HOME/.config/base16-shell/scripts/base16-monokai.sh
[[ -s $BASE16_SHELL ]] && source $BASE16_SHELL
# Starship
if [ -f /usr/bin/starship ]; then
eval "$(starship init zsh)"
else
zstyle ':prezto:module:prompt' theme 'powerlevel10k'
fi
#######
# FZF #
#######
if [ -f /usr/share/fzf/key-bindings.zsh ]; then
export FZF_DEFAULT_COMMAND='fd --type f'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
alias preview="fzf --preview 'bat --color \"always\" {}'"
fi
#######
# NVM #
#######
if [ -f /usr/share/nvm/init-nvm.sh ]; then
source /usr/share/nvm/init-nvm.sh
fi
###########
# Kubectl #
###########
if [ -f /opt/google-cloud-sdk/bin/kubectl ]; then
source <(kubectl completion zsh)
fi
####################
# Google Cloud SDK #
####################
if [ -f /opt/google-cloud-sdk/completion.zsh.inc ]; then
source /opt/google-cloud-sdk/completion.zsh.inc
fi