blob: 65ed0405cb6c8d462f23ba8f80d05b27fd960386 (
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
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
146
147
148
149
150
151
|
################################################################################
# aliases
################################################################################
# ls
alias l1='/bin/ls -1hNT 0 --color=auto'
alias ls='ls -hNFT 0 --color=auto'
alias ll='ls -l'
alias lt='ls -ltr'
alias la='ls -a'
alias lla='ls -la'
# interactive cp/mv/rm
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
# misc
alias s='cd ..'
alias c='clear'
alias grep='grep --color=auto'
alias less='less -q'
alias df='df -h'
alias du='du -h'
alias http-server='python -m SimpleHTTPServer'
# C/C++
alias bcpp='bcpp -s -i 2'
alias make='make -j$(echo "scale=0;$(nproc)*1.5/1" | bc)'
# Gentoo
alias emerge='emerge --tree --jobs=$(A=$(nproc) B=$(( A / 2 )); echo $(( B < 1 ? 1 : B )))'
alias unmerge='emerge --unmerge'
alias upgrade='emerge --keep-going --ask --newuse --update --deep @world'
alias build-kernel='genkernel --menuconfig all'
alias dg='ebuild $(ls -1 *.ebuild | head -n1) manifest'
alias chk='for i in `eix "-I*" --format "<installedversions:NAMEVERSION>" --only-in-overlay`; do equery k $i; done'
alias ls-preserved='portageq list_preserved_libs /'
################################################################################
# prompt and completion
################################################################################
# init
autoload -U compinit promptinit
compinit
promptinit
# prompt
prompt gentoo
source /etc/zsh/zshprompt
# completion
zstyle ':completion::complete:*' use-cache 1
# options
setopt nullglob # remove non-matching jokers instead of failing
setopt auto_remove_slash # auto-remove useless slash at end of folders
unsetopt glob_dots # remove hidden folders from completion choice
setopt chase_links # follow symlinks
setopt hist_verify # display history (!) command before execution
################################################################################
# keys
################################################################################
if [[ "$TERM" != emacs ]]; then
bindkey '^[[3~' delete-char # Del
bindkey '^[[2~' overwrite-mode # Insert
bindkey '^[[5~' history-search-backward # PgUp
bindkey '^[[6~' history-search-forward # PgDn
bindkey '^[[H' beginning-of-line # Home
bindkey '^A' beginning-of-line # Ctrl-a
bindkey '^[[F' end-of-line # End
bindkey '^E' end-of-line # Ctrl-e
bindkey '^[[Z' reverse-menu-complete # Shift-Tab
bindkey '^N' forward-word # Ctrl-n
bindkey '^B' backward-word # Ctrl-b
fi
################################################################################
# ls colors
################################################################################
if [ -x /usr/bin/dircolors ]
then
if [ -r ~/.dir_colors ]
then
eval "`dircolors ~/.dir_colors`"
elif [ -r /etc/dir_colors ]
then
eval "`dircolors /etc/dir_colors`"
else
eval "`dircolors`"
fi
fi
################################################################################
# misc options
################################################################################
# no beep
unsetopt beep
unsetopt hist_beep
unsetopt list_beep
# force usage of '>|' when redirect output to existing file
unsetopt clobber
# ctrl+d for logout
unsetopt ignore_eof
# display return value on errors
setopt print_exit_value
# ask confirmation on 'rm *'
unsetopt rm_star_silent
# automaticly do cd if the command correspond to an existing folder name
setopt auto_cd
# use pushd for cd
setopt auto_pushd
# remove duplicate in pushd
setopt pushd_ignore_dups
# do not display stack on pushd and popd
setopt pushd_silent
# pushd go to home without args
setopt pushd_to_home
# background task are niced to 0
unsetopt bg_nice
# do not close backgroud jobs on closing shell
unsetopt hup
################################################################################
# history
################################################################################
setopt HISTIGNOREDUPS HISTIGNORESPACE EXTENDED_HISTORY
export HISTORY=10000
export SAVEHIST=10000
export HISTFILE=$HOME/.history
|