summaryrefslogtreecommitdiff
path: root/.zshrc
blob: 91f1569c25974250387b8adf14525f11e53915f3 (plain)
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
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory extendedglob notify
unsetopt autocd beep nomatch
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/dholman/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

# Additional colors
autoload -U colors %% colors

# Additional completion options
zstyle ':completion:*' use-cache on
zstyle ':completion:*:cd:*' ignore-parents parent pwd
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*match:*' original only
zstyle ':completion:*approximate:*' max-errors 1 numeric
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*' squeeze-slashes true

# Useful scripts
source /usr/share/doc/pkgfile/command-not-found.zsh
source /usr/share/git/completion/git-prompt.sh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh

# Vim-style history searching
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down

# Aliases
alias ls="ls --color=auto"
alias pacin="pacaur -S"
alias pacr="pacaur -Rns"
alias pacup="pacaur -Syu"
alias pacsearch="pacaur -Ss"
alias msfconsole="sudo msfconsole --quiet -x \"db_connect root@msf\""

# Important vars
export PATH="$PATH:/home/dholman/bin"
export EDITOR="vim"
export SUDO_EDITOR="vim"
export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0
export GPGKEY=90D8F8E2C830F6129B2FBB1133836B30AA014B82
export GPG_TTY=$(tty)

# Prompt settings
local return_code="%(?..%{$fg[red]%}%? ${exclaim}%{$reset_color%})"
setopt PROMPT_SUBST
GIT_PS1_SHOWUPSTREAM=auto
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
PS1='${return_code}$(__git_ps1 "(%s)")$ '

# Make shell stuff behave nicely
man() {
        env \
        LESS_TERMCAP_mb=$'\e[01;31m' \
        LESS_TERMCAP_md=$'\e[01;31m' \
        LESS_TERMCAP_me=$'\e[0m' \
        LESS_TERMCAP_se=$'\e[0m' \
        LESS_TERMCAP_so=$'\e[01;44;33m' \
        LESS_TERMCAP_ue=$'\e[0m' \
        LESS_TERMCAP_us=$'\e[01;32m' \
        man "$@"
}

rationalise-dot() {
        if [[ $LBUFFER = *.. ]]; then
                LBUFFER+=/..
        else
                LBUFFER+=.
        fi
}
zle -N rationalise-dot
bindkey . rationalise-dot