-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzshrc
executable file
·151 lines (121 loc) · 3.73 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
if [[ -r "$HOME/.powerlevel10k/powerlevel10k.zsh-theme" ]]; then
source ~/.powerlevel10k/powerlevel10k.zsh-theme
else
echo "PowerLevel 10k not installed. https://github.com/romkatv/powerlevel10k#manual"
fi
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Where Am I?
platform='unknown'
unamestr=`uname`
hoststr=`hostname`
me=`whoami`
fpath=($HOME/.dotfiles/zsh-plugins-compdef $fpath)
autoload -Uz compinit
compinit
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
source $HOME/.dotfiles/zsh-plugins/bundler.plugin.zsh
source $HOME/.dotfiles/zsh-plugins/git.plugin.zsh
source $HOME/.dotfiles/zsh-plugins/rails.plugin.zsh
source $HOME/.dotfiles/zsh-plugins/key-bindings.zsh
zstyle ":completion:*:commands" rehash 1
`which keychain > /dev/null`
if [[ $? == 0 ]]; then
eval `keychain --eval --agents ssh --inherit any --quiet --quick`
function add_all_ssh_keys()
{
ssh-add $(grep -l PRIVATE ~/.ssh)
}
alias ssh="(ssh-add -l > /dev/null || add_all_ssh_keys ) && ssh"
else
echo "Keychain not installed"
fi
#------------------------------
# History
#------------------------------
export HISTCONTROL=ignorespace:ignoredups
export HISTFILE=$HOME/.zsh_history
export HISTSIZE=99999
export HISTFILESIZE=999999
export SAVEHIST=$HISTSIZE
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt share_history # share command history data
#------------------------------
# Variables
#------------------------------
export EDITOR="nvim"
export PAGER="less"
# F@CK Spring
export DISABLE_SPRING=1
#------------------------------
# Aliases
#------------------------------
alias tmux="tmux -u -S /tmp/tmux-sock-$me"
alias millis='python -c "import time; print(int(time.time()*1000))"'
alias vim='nvim'
alias view='nvim -M'
alias iexs='iex -S mix'
alias bundle='nocorrect bundle'
alias fs='foreman start'
#------------------------------
# Functions
#------------------------------
tls ()
{
tmux ls
}
tmux_attach_or_create () {
if (($# == 1)); then
tmux has -t $1 && tmux attach -t $1 || tmux new -s $1
else
echo "Must provide a session name"
fi
}
t ()
{
if (($# == 1)); then
tmux_attach_or_create $1
else
tmux_attach_or_create $(basename $(pwd))
fi
}
_t() {
local line
local -a sessions
tmux ls | cut -d : -f 1 | while read -A line; do sessions=($line $sessions) done
_values $sessions && ret=0
}
compdef _t t
c() { cd ~/Code/$1; }
_c() { _files -W ~/Code -/; }
compdef _c c
_marked_tab() { _files -g "*.md *.markdown"; }
compdef _marked_tab mark
`which thefuck > /dev/null`
if [[ $? == 0 ]]; then
eval $(thefuck --alias)
fi
#------------------------------
# Local settings
#------------------------------
if [[ -r "$HOME/.asdf/asdf.sh" ]]; then
source $HOME/.asdf/asdf.sh
fpath=(${ASDF_DIR}/completions $fpath)
autoload -Uz compinit && compinit
fi
if [[ -r "$HOME/.zshrc.local" ]]; then
source "$HOME/.zshrc.local"
fi
if [[ -r "$HOME/.fzf.zsh" ]]; then
source "$HOME/.fzf.zsh"
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh