summaryrefslogtreecommitdiffstats
path: root/.zshrc
blob: 3dc3393071bc1d428479affc6348180a4aa25b9c (plain) (blame)
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
#!/usr/bin/zsh -i

zmodload zsh/zprof

bindkey -v
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line

HISTFILE="$HOME/.histfile"
HISTSIZE=$((1 << 16))
SAVEHIST=$HISTSIZE
setopt hist_ignore_all_dups hist_save_no_dups hist_reduce_blanks share_history extended_history

fpath=("$HOME/.zfunc" "$HOME/.zfunc/zsh-completions/src" $fpath)

alias diff='diff --color=auto'
alias ls='ls -F --color=auto'
alias grep='grep --color=auto'
alias sudo='sudo '
alias run0='run0 '

autoload -Uz compinit promptinit
zmodload zsh/complist
zstyle ':completion:*' menu select
zstyle ':completion:*' verbose yes
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' complete-options true
zstyle ':completion:*' rehash true
zstyle ':completion:*:*:-command-:*:*' group-order alias builtins functions commands
compinit

bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history

promptinit
prompt marc

setopt no_clobber
setopt extendedglob

setopt auto_cd auto_pushd pushd_silent pushd_to_home pushd_ignore_dups
pushd .

autoload -Uz run-help
(( ${+aliases[run-help]} )) && unalias run-help
alias help=run-help

autoload -Uz e v p bell

zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' formats "(%s)-[%b]%m%u%c"
zstyle ':vcs_info:*' actionformats "(%s)-[%b]%m%u%c"

zstyle ':vcs_info:git*+set-message:*' hooks git-untracked

+vi-git-untracked() {
	if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
		git status --porcelain | grep -m 1 '^??' &>/dev/null
	then
		hook_com[misc]='T'
	fi
}

zstyle ':vcs_info:git*+set-message:*' hooks git-st

function +vi-git-st() {
    local ahead behind
    local -a gitstatus

    ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
    (( $ahead )) && gitstatus+=( "+${ahead}" )

    behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
    (( $behind )) && gitstatus+=( "-${behind}" )

    hook_com[misc]+=${(j:/:)gitstatus}
}