-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
111 lines (90 loc) · 2.86 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
#
# ~/.zshrc
#
# Uncomment to profile zsh startup
#zmodload zsh/zprof
# Source the main configuration for zsh
source $HOME/.zshrc_grml
# Load user settings
source $HOME/.profile
source $HOME/.aliases
# Global aliases
alias -g ...=../..
alias -g ....=../../..
alias -g .....=../../../..
# Manage this file
alias edit_rc='$EDITOR ~/.zshrc'
alias reload='source ~/.zshrc'
# Setup theme
autoload -U colors && colors
autoload -U bashcompinit && bashcompinit
autoload -Uz promptinit && promptinit
prompt grml
# Default items
# zstyle ':prompt:grml:left:setup' items rc change-root user at host path vcs percent
# zstyle ':prompt:grml:right:setup' items sad-smiley
zstyle ':prompt:grml:left:setup' items rc change-root user at host path vcs percent
zstyle ':prompt:grml:right:setup' items
zstyle ':prompt:grml:left:items:percent' token '$ '
zstyle ':prompt:grml:left:items:path' pre '%F{blue}'
zstyle ':prompt:grml:left:items:path' post "%{$reset_color%}"
#zstyle ':prompt:grml:*:items:host' pre "%{$fg_bold[yellow]%}"
#zstyle ':prompt:grml:*:items:host' post "%{$reset_color%}"
# Set LS_COLORS
if [ -f ~/.dircolors ]; then
eval $(dircolors -b ~/.dircolors)
fi
# colored completion - use my LS_COLORS
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Find out what commands you use the most
zsh_stats () {
fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
}
# Set up history completion
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" up-line-or-beginning-search
bindkey "$terminfo[kcud1]" down-line-or-beginning-search
# Vi mode (oh boy)
# bindkey -v
#
# bindkey '^P' up-history
# bindkey '^N' down-history
# bindkey '^?' backward-delete-char
# bindkey '^h' backward-delete-char
# bindkey '^w' backward-kill-word
# bindkey '^r' history-incremental-search-backward
#
# function zle-line-init zle-keymap-select {
# VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
# RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
# zle reset-prompt
# }
#
# zle -N zle-line-init
# zle -N zle-keymap-select
#
# export KEYTIMEOUT=1 # Reduce delay when pressing ESC
# Edit current line with the editor of choice
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
# Prevent Zsh from appending a '%' to delimit unfinished outputs
unsetopt prompt_cr
# Source local zshrc if any
if [ -f ~/.zshrc.local ]; then
source ~/.zshrc.local
fi
function ranger-cd {
local tmpfile="$(mktemp)"
ranger --choosedir=$tmpfile $argv
local rangerpwd=`cat $tmpfile`
if [ "$PWD" != $rangerpwd ]; then
cd $rangerpwd
fi
}
# Uncomment to profile zsh startup
#zprof