-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
52 lines (43 loc) · 1.29 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
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
# Source local definitions
if [[ -f ~/.zshrc.local ]]; then
source ~/.zshrc.local
fi
# Set vim as the default editor
export EDITOR='vim'
export VISUAL='vim'
# Set fpath to include local directory
fpath=("$HOME/.zfunctions" $fpath)
# Predictable SSH authentication socket location.
if [[ -S "$SSH_AUTH_SOCK" && ! -h "$SSH_AUTH_SOCK" ]]; then
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock;
fi
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock;
agent() { SSH_AUTH_SOCK=$(ssh-agent | sed -n 's/SSH_AUTH_SOCK=\([^;]*\).*/\1/p') ssh-add && fixsshsock-choice }
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
#String date
sdate() { date +%y%m%d-%H%M%S }
# insert "sudo " at the beginning of the line
prepend-sudo() {
if [[ $BUFFER != "sudo "* ]]; then
BUFFER="sudo $BUFFER"; CURSOR+=5
fi
}
zle -N prepend-sudo
bindkey "^[s" prepend-sudo
# Use Ctrl-x,Ctrl-l to get the output of the last command
zmodload -i zsh/parameter
insert-last-command-output() {
LBUFFER+="$(eval $history[$((HISTCMD-1))])"
}
zle -N insert-last-command-output
bindkey "^X^L" insert-last-command-output
export KEYTIMEOUT=10