-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrcWSL
176 lines (138 loc) · 4.7 KB
/
zshrcWSL
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
# moves prompt to the bottom of the window
tput cup $LINES
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
# zstyle :compinstall filename '/home/Bastiaan/.zshrc'
autoload -Uz compinit
compinit -i
# End of lines added by compinstall
echo "Parsing ~/.zshrc"
alias ll='ls --color=auto -la'
alias ls='ls --color=auto'
alias ct='cleartool'
alias cr='dos2unix'
alias cd..='cd ..'
eval `dircolors -b`
setopt AUTO_CD
#setopt CORRECT
#setopt CORRECT_ALL
setopt INC_APPEND_HISTORY
#INC_APPEND_HISTORY
#setopt AUTO_LIST
setopt BASH_AUTO_LIST
setopt AUTO_PUSHD
unsetopt AUTO_RESUME
setopt HIST_IGNORE_DUPS
unsetopt NOMATCH
#disable interpretation of backslash in echo
setopt BSD_ECHO
#case insensitive completion with priority on case match (empty string is exact match)
compctl -M '' 'm:{a-zA-Z}={A-Za-z}'
autoload -U colors && colors
# If this is an xterm set the title to user@host:dir
case $TERM in
xterm*)
precmd () {print -Pn "\e]0;%~\a"}
;;
esac
# key bindings
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "^H" backward-delete-word
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix
csdiff () {
echo 'csdiff' "$1" "$2";
dwdiff --algorithm=best --context=4 --punctuation --color --aggregate-changes $*
}
#eval `keychain -q --agents ssh --eval id_rsa`
export EDITOR=vim
export PATH=~/.local/bin:~/bin/:~/nodejs/bin/:$PATH
#source ~/.ssh-find-agent.sh
#set_ssh_agent_socket
#. ssh-find-agent.sh
#ssh-find-agent -a
#if [ -z "$SSH_AUTH_SOCK" ]
#then
# eval $(ssh_agent) > /dev/null
# ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
#fi
#https://superuser.com/questions/325662/how-to-make-ssh-agent-automatically-add-the-key-on-demand
# ssh-add -l > /dev/null || eval $(ssh-agent) > /dev/null;
# ssh-add -l > /dev/null || ssh-add ~/.ssh/agl_rsa
SSH_ENV="$HOME/.ssh/env"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
source "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add ~/.ssh/agl_rsa;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
source "${SSH_ENV}" > /dev/null
ps -F ${SSH_AGENT_PID} > /dev/null || start_agent;
else
start_agent;
fi
echo 'Current keys in agent:'
ssh-add -l
# for VIM and TMUX
if [ "$TERM" = "screen" ]; then
export TERM=xterm-256color
fi
# get git info
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats '%b'
# zstyle ':vcs_info:git*' formats "%{$fg[grey]%}%s %{$reset_color%}%r/%S%{$fg[grey]%} %{$fg[blue]%}%b%{$reset_color%}%m%u%c%{$reset_color%} "
# Set up the prompt (with git branch name)
setopt PROMPT_SUBST
# PROMPT='${vcs_info_msg_0_}'
PROMPT='%(1j. %j .)%{$fg_bold[red]%}${vcs_info_msg_0_} %{$fg_no_bold[yellow]%}${PWD/#$HOME/~}%{$reset_color%} > '
#PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[cyan]%}%m%{$reset_color%}- %{$fg_no_bold[yellow]%}%~%{$reset_color%}% >"
# PROMPT="%{$fg_no_bold[yellow]%}%~%{$reset_color%}% >"
# PROMPT="%(1j. %j .) ${vcs_info_msg_0_} %{$fg_no_bold[yellow]%}%~%{$reset_color%}% >"
#source Dropbox/agnoster.zsh-theme
#export DOCKER_HOST=localhost:2375
fpath=(~/.zsh/completion $fpath)
# autoload -Uz compinit && compinit -i
export TERM=xterm-256color
# export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
# set DISPLAY variable to the IP automatically assigned to WSL2
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
export LIBGL_ALWAYS_INDIRECT=1
sudo /etc/init.d/dbus start &> /dev/null
# source /usr/share/doc/fzf/examples/key-bindings.zsh
# source /usr/share/doc/fzf/examples/completion.zsh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh