This repository was archived by the owner on Jan 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
178 lines (143 loc) · 4.47 KB
/
zshrc
File metadata and controls
178 lines (143 loc) · 4.47 KB
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
168
169
170
171
172
173
174
175
176
177
178
#-*-sh-*-
# ~/.zshrc
# loaded for interactive shell, both login and non-login
# TODO: most of the stuff in this file should only be loaded for login shells
# zsh options:
HISTFILE=$HOME/.zhistory
HISTSIZE=100000
SAVEHIST=100000
#setopt SHARE_HISTORY
#setopt HIST_IGNORE_ALL_DUPS
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_IGNORE_DUPS
setopt NO_HUP
setopt AUTO_CD
#setopt NO_CHECK_JOBS
alias re-source="source ~/.zshenv && source ~/.zshrc"
alias rm="nocorrect rm"
alias f="noglob find . -iname"
# if not interactive...
#if [[ $- != *i* ]]; then
# return
#fi
if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
tmux attach-session -t main || tmux new-session -s main
fi
####################################################
# how the login prompt appears
source $RC/zsh-git-prompt/zshrc.sh
# http://aperiodic.net/phil/prompt/
autoload colors 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}]%}'
done
PR_NO_COLOR="%{$terminfo[sgr0]%}"
typeset -A altchar
set -A altchar ${(s..)terminfo[acsc]}
PR_SET_CHARSET="%{$terminfo[enacs]%}"
PR_SHIFT_IN="%{$terminfo[smacs]%}"
PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
PR_HBAR=${altchar[q]:--}
PR_ULCORNER=${altchar[l]:--}
PR_LLCORNER=${altchar[m]:--}
PR_LRCORNER=${altchar[j]:--}
PR_URCORNER=${altchar[k]:--}
# %n is username
# %m is hostname
# %d is directory
# %1~ is directory basename, home replaced with ~
PR_USER=%(!.${PR_LIGHT_RED}.${PR_GREEN})%n
PR_DIR=${PR_BLUE}%~${PR_NO_COLOR}
jobs=${PR_BLUE}%(1j. %j.)${PR_NO_COLOR}
exitstatus=${PR_RED}%(0?.. %?)${PR_NO_COLOR}
PS1='${PR_NO_COLOR}[%m %D{%I:%M:%S}${jobs}${exitstatus}] ${PR_USER}$(git_super_status) ${PR_DIR}
%(!.#.$) ' # '#' if running with priveleges, '$' otherwise
#PS1="%# '${vcs_info_msg_0_}'"
#RPROMPT="[${jobs}${exitstatus}%*]"
#defaults:
#PS2="%_> " # printed when the shell needs more information to complete a command
#PS3="?# " # when in a select loop
#PS4="+%N:%i> " # execution trace prompt
########################################################
# dynamic terminal title
if test "$EMACS" == "t"; then
unsetopt zle
export TERM=xterm-color
else
precmd () {
case $TERM in
xterm*|rxvt|vt*)
print -Pn "\e]0;%m : %3~\a"
;;
screen)
print -Pn "\e]0;%m : %3~\a\ek%m : %3~\e\\"
;;
esac
}
preexec () {
case $TERM in
xterm*|rxvt|vt*)
print -Pn "\e]0;%m : $1\a"
;;
screen)
print -Pn "\e]0;%m : $1\a\ek%m : $1\e\\"
;;
esac
}
fi
# --------------------------------------------
# fix a problem with tramp
if [ "$TERM" = "dumb" ]
then
unsetopt zle
unsetopt prompt_cr
unsetopt prompt_subst
unfunction precmd
unfunction preexec
PS1='$ '
fi
# bindkeys
# --------------------------------------------
# TODO: make all of these bindkeys dependent of $TERM
# bindkey "^[[H" beginning-of-line # Home
# bindkey "^[[F" end-of-line # Home
# bindkey '\e[5~' history-search-backward
# bindkey '\e[6~' history-search-forward
# case $TERM in (xterm*|rxvt)
# bindkey '\e[7~' beginning-of-line
# bindkey '\e[8~' end-of-line ;;
# (*)
# bindkey '\e[1~' beginning-of-line
# bindkey '\e[4~' end-of-line ;;
# esac
# bindkey '^[[3~' backward-delete-char
#delete-char
#bindkey '^?' backward-delete-char
#bindkey '^H' backward-delete-char
# emacs bindings
bindkey -e
# -----------------------------------------------
# Don't complete backup files as executables
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'
#zstyle ':completion:*' verbose yes
#zstyle ':completion:*:descriptions' format '%B%d%b'
#zstyle ':completion:*:messages' format '%d'
#zstyle ':completion:*:warnings' format 'No matches for: %d'
#zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
#zstyle ':completion:*' group-name ''
zstyle ':completion:*' completer _complete _approximate
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' max-errors 1
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle :compinstall filename '/home/pweaver/.zshrc'
autoload -Uz compinit
# todo
# speedup by using compinit -C when possible.
# https://gist.github.com/ctechols/ca1035271ad134841284
compinit
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh