-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.zshrc
145 lines (109 loc) · 5.02 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
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
export ZSH_CUSTOM=$HOME/.extra/zsh_custom
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="code"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Increase the zsh limit of "do you wish to list all NNN possibilities?"
LISTMAX=500
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="dd.mm.yyyy"
export HISTCONTROL="erasedups:ignoreboth"
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=24'
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
plugins=(sudo adb command-not-found git-extras dircycle systemd rsync zsh-autosuggestions nmap git-extra-commands)
file="$ZSH/oh-my-zsh.sh"; [ -f "$file" ] && source "$file"
# Completion
# Make zsh know about hosts already accessed by SSH
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion::complete:*' use-cache true
zstyle ':completion:*:default' menu select=1
# cd will never select the parent directory (e.g.: cd ../<TAB>):
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# formatting and messages
zstyle ':completion:*' verbose yes
zstyle ':completion:*:matches' group yes
zstyle ':completion:*:options' description yes
zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d --\e[0m'
zstyle ':completion:*:messages' format $'\e[01;35m -- %d --\e[0m'
zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found --\e[0m'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:options' auto-description '%d'
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin
zstyle ':completion:*:complete:scp:*:files' command command -
zstyle ':completion:*:complete:rsync:*:files' command command -
zstyle ':completion:*:complete:git:*:files' command command -
zstyle ':completion:*' list-separator '==>'
zstyle ':completion:*:manuals' separate-sections true
## add colors to processes for kill completion
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
# command completion: highlight matching part of command
zstyle -e ':completion:*:-command-:*:commands' list-colors 'reply=( '\''=(#b)('\''$words[CURRENT]'\''|)*-- #(*)=0=38;5;45=38;5;136'\'' '\''=(#b)('\''$words[CURRENT]'\''|)*=0=38;5;45'\'' )'
# activate menu selection
zstyle ':completion:*' menu select
# activate approximate completion, but only after regular completion (_complete)
zstyle ':completion:::::' completer _complete _approximate
# limit to 2 errors
zstyle ':completion:*:approximate:*' max-errors 2
# User configuration
file="/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"; [ -f "$file" ] && source "$file"
# check zshoptions to see what these do
setopt notify nohashdirs autocd globdots hist_ignore_all_dups noclobber auto_menu \
pathdirs cdablevars checkjobs dotglob histverify histappend autolist listtypes \
prompt_subst rmstarsilent complete_in_word nohup
# Make cd act like pushd instead, letting us use popd to go back
setopt autopushd pushd_ignore_dups pushdtohome pushdminus pushdsilent
setopt inc_append_history # Add comamnds as they are typed, don't wait until shell exit
# no beep sound
setopt nolistbeep no_beep
unsetopt share_history # oh-my-zsh sets this, I don't want it.
unsetopt correct
unsetopt complete_aliases # expand aliases after tab completion finishes
unsetopt listambiguous
# get notified when someone logs in
watch=all # watch all logins
logcheck=30 # every 30 seconds
WATCHFMT="%n from %M has %a tty%l at %T %W"
# Keybindings
# prepend sudo with ^S
insert-root-prefix() {
BUFFER="sudo $BUFFER"
CURSOR="$(($CURSOR + 5))"
}
zle -N insert-root-prefix
bindkey '^S' insert-root-prefix
# edit command in $EDITOR with ^E
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^E' edit-command-line
# push current command to stack
bindkey '^U' push-line
# get last command from stack
bindkey '^Y' get-line
# run help on $0 command
bindkey '^K' run-help
# ls
inline-ls() {
zle push-line
BUFFER=" l"
zle accept-line
}
zle -N inline-ls
bindkey '^F' inline-ls
file="$HOME/.shellrc"; [ -f "$file" ] && source "$file"
# display moo
moo