-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
154 lines (121 loc) · 3.8 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
if [[ `uname` == 'Linux' ]]; then
alias pbcopy="xclip -sel clip"
alias pbpaste="xclip -sel clip -o"
else
export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
fi
alias ls='ls -G --color'
alias ll='ls -l'
alias l='less'
alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
alias sl=ls
export PATH="$PATH:~/bin"
export EDITOR='emacs -nw'
# Git shit
alias gst='git status'
source ~/.zshd/zsh-git-prompt/zshrc.sh
function chpwd() { # to ls after directory change
emulate -LR zsh
ls
}
function echodo () {
echo "$@"
"$@"
}
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
function _user_host() {
if [[ -n $SSH_CONNECTION ]]; then
me="%n@%m"
# elif [[ $USER = "root" ]]; then
# me="%{bg[red]}ROOT"
elif [[ $LOGNAME != $USER ]]; then
me="%n"
fi
echo me:$me
if [[ -n $me ]]; then
echo "%{$fg[cyan]%}$me%{$reset_color%}:"
fi
}
PROMPT="${ret_status} ${_user_host}%{$reset_color%} %D{%a %m/%d %k:%M:%S} %{$fg_bold[green]%}> %{$reset_color%}"
RPROMPT="\$(git_super_status) %~" # prompt for right side of screen
# Configures PATH and OCAMLPATH for godi. Check that the paths
# match your local godi installation!
function godi () {
if [ -z "$1" ]; then
echo $PATH | sed 's/.*\/godi.\([0-9.]\+\)\/.*/\1/g'
else
shopt -s extglob
case $PATH in
*/godi/*) echodo export PATH=${PATH//godi\/+([0-9.])/godi\/$1} ;;
*) echodo export PATH=/opt/godi/$1/bin:$PATH ;;
esac
fi
if [ -d .git ]; then
export OCAMLPATH=$PWD:$PWD/lib:$PWD/ps-lib
echo OCAMLPATH=$OCAMLPATH
fi
}
# ssh autocomplete known_hosts
zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' max-errors 2 numeric
zstyle :compinstall filename '/home/bruce/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=100000
setopt autocd extendedglob
bindkey -e
#allow tab completion in the middle of a word
setopt COMPLETE_IN_WORD
## keep background processes at full speed
setopt NOBGNICE
## restart running processes on exit
setopt HUP
## history
setopt APPEND_HISTORY
## for sharing history between zsh processes
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
## never ever beep ever
setopt NO_BEEP
## automatically decide when to page a list of completions
LISTMAX=0
## disable mail checking
xMAILCHECK=0
autoload -U colors
colors
# End of lines configured by zsh-newuser-install
md() { mkdir $1 && cd $1 }
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _match _correct _approximate _prefix
zstyle ':completion:*' completions 1
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' file-sort modification
zstyle ':completion:*' glob 1
zstyle ':completion:*' ignore-parents parent pwd directory
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=** r:|=** l:|=*'
zstyle ':completion:*' match-original both
zstyle ':completion:*' max-errors 1 numeric
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' substitute 1
zstyle :compinstall filename '/home/bruce/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Ocaml stuff
alias ocaml='ledit -x -h ~/.ocaml_history ocaml'
eval `opam config env`
eval `opam config env`
# OPAM configuration
. ~/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
## Pivotal stuff
alias loadGlobalProtect='launchctl load /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*'
alias unloadGlobalProtect='launchctl unload /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*'