-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzshrc
167 lines (147 loc) · 4.94 KB
/
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
. ~/.zprofile
. ~/.scripts/zsh-jump
# Plugins
if which brew &>/dev/null && which z &>/dev/null; then
. `brew --prefix`/etc/profile.d/z.sh
fi
# ZSH Move
autoload -Uz zmv
# Completion
autoload -Uz compinit
zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename "$HOME/.zshrc"
compinit
# VCS
autoload -Uz vcs_info
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' actionformats '.%F{2}%b%F{3}.%F{1}%a%f'
zstyle ':vcs_info:*' formats '.%F{2}%b%%f'
zstyle ':vcs_info:*' enable git svn hg
# Auto Mime Type Running
autoload -Uz zsh-mime-setup
autoload -Uz pick-web-browser
zstyle ':mime:*' mailcap ~/.mailcap
# Example: to make it not background an app
# zstyle ':mime:.txt:' flags needsterminal
zsh-mime-setup
alias -s html=pick-web-browser
# Colors
autoload -Uz colors
autoload -Uz zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
PR_NO_COLOUR="%{$terminfo[sgr0]%}"
### ZSH options
# pushd options
setopt auto_pushd # pushes visited dirs on a stack to popd
setopt pushd_silent # pushd silently
setopt pushd_to_home # "pushd" w/o args takes you home
# completion options
setopt auto_list # outputs completion opts immediately on ambig
setopt list_types # shows types of possible completion opts
setopt complete_in_word # complete while in mid of word, and don't move cursor
setopt extended_glob # extra zsh glob features
# history options
setopt share_history # all zsh sessions merge history
setopt hist_ignore_dups # don't put duplicates in history
setopt hist_reduce_blanks # remove extra spaces hist commands
# input/output options
setopt aliases # expand aliases
setopt clobber # allow > and >> to clobber/create files
setopt interactive_comments # allow comments in interactive shell
# job control options
setopt no_hup # don't kill bg jobs as terminal ends
unsetopt notify # output status of bg'd jobs just before prompt
# prompt options
setopt prompt_subst # allow param expansion, command subst, arith in prompt
# misc
unsetopt beep # never beep please
setopt auto_cd # you can cd by just typing a folder name
setopt vi # vim mode
#Aliases
alias -g ugster="[email protected]"
alias -g uwask="[email protected]"
alias -g uwcsc="[email protected]"
alias -g uw="[email protected]"
alias althack='telnet nethack.alt.org'
alias caocrawl='ssh [email protected]'
alias date='date +"~ %I:%M %p on %A, the %eth of %B ~"'
alias ftp="gftp-text"
alias music="ncmpcpp"
alias pwmd="pwd" # I typo this 90% of the time
alias top="htop"
alias tram="transmission-remote"
alias tree='tree -AC'
alias vim='nvim'
alias govim='GOPATH=$PWD vim'
alias open=xdg-open
# Variables
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
export PROMPT='$PR_GREEN%m$PR_WHITE.$PR_BLUE%n$PR_WHITE $PR_MAGENTA%c\
$PR_WHITE${vcs_info_msg_0_}: '
preexec () { echo -ne "\e[0m" } # removes colour after the prompt input
# ZSH HOOKS
# Needed for revision control identification
precmd_vcs() {
vcs_info
}
# Add your function to these lists to register a hook
precmd_functions+=("precmd_vcs")
chpwd_functions+=()
zshexit_functions+=()
# Modified cd/ls functions
TODO_OPTIONS="--summary"
ls()
{
/bin/ls --color -G "$@"
}
# For old find compat, automatically add searchdir of '.' if none supplied
find()
{
if [[ ! -d "$1" && "$1" == -* ]]; then
/usr/bin/find . $@
else
/usr/bin/find $@
fi
}
up()
{
local cdstr=""
for x in $(seq $1); do
cdstr+="../"
done
builtin cd ${cdstr}
}
# Execute these as a terminal opens
date
# Nugbase-web style source
if [ -f './scripts/source-me.sh' ]; then
source './scripts/source-me.sh' &> /dev/null
echo '~ loaded ./scripts/source-me.sh ~'
fi
# Secrets: OpenAI / ChatGPT if available
if [ -f ~/.secret/openai.sh ]; then
source ~/.secret/openai.sh
echo '~ loaded secrets ~'
fi
if ! type "ag" > /dev/null; then
echo '-> ag not installed'
fi
# Generated by fzf.git/install script
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
if ! type "fzf" > /dev/null; then
echo '-> fzf not installed'
echo 'recommend: git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install'
fi
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/lung/Programs/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/lung/Programs/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/lung/Programs/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/lung/Programs/google-cloud-sdk/completion.zsh.inc'; fi