-
Notifications
You must be signed in to change notification settings - Fork 2
/
zshrc
61 lines (47 loc) · 1.68 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
test -f ~/.zshrc.local && source ~/.zshrc.local
# no spelling correction on:
alias mv='nocorrect mv'
alias cp='nocorrect cp'
alias mkdir='nocorrect mkdir'
alias ls='ls --color'
# alias ack='ack-grep'
# Emacs-style commandline editing
bindkey -e
# zsh completion magic:
zstyle ':completion:*' completer _list _expand _complete _ignored _match _prefix
zstyle ':completion:*' condition 'NUMERIC != 1'
zstyle ':completion:*' matcher-list '' 'r:|[._-]=* r:|=*' 'm:{a-z}={A-Z} l:|=* r:|=*'
zstyle ':completion:*' match-original both
zstyle ':completion:*' max-errors 1
autoload -U compinit
compinit
# auto quote urls when needed
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
# setup prompt and colors
autoload -U colors
colors
export PROMPT="%j %{$fg[blue]%}%m%{$reset_color%}:%{$fg_bold[yellow]%}%30<..<%~%{$reset_color%}> "
export HISTSIZE=1000000000
export HISTFILE=~/.zsh_history
export SAVEHIST=300000000
precmd() { print -Pn '\e]0;%(!.%n@.)%m: %~\a' }
preexec () { print -Pn "\e]0;%(!.%n@.)%m: $1\a" }
# Add a bunch of helpers if we are running in X.
if [ -n "$DISPLAY" ]; then
function disable-caps {
python -c 'from ctypes import *; X11 = cdll.LoadLibrary("libX11.so.6"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(2), c_uint(0)); X11.XCloseDisplay(display)'
}
function toggle-trackpad {
synclient TouchpadOff=$(synclient -l | grep TouchpadOff | awk '{print !$3}')
}
function _dbus-upower {
dbus-send --system --print-reply --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.$1
}
function suspend {
_dbus-upower Suspend
}
function hibernate {
_dbus-upower Hibernate
}
fi