]>
Commit | Line | Data |
---|---|---|
1 | ## options | |
2 | setopt autocd extendedglob | |
3 | unsetopt beep | |
4 | ||
5 | ## history | |
6 | setopt appendhistory | |
7 | HISTFILE=~/.histfile | |
8 | HISTSIZE=100 | |
9 | SAVEHIST=100 | |
10 | ||
11 | ## keys | |
12 | bindkey -v | |
13 | KEYTIMEOUT=1 | |
14 | # xorg | |
15 | bindkey "^[[7~" beginning-of-line #Home | |
16 | bindkey -a "^[[7~" beginning-of-line | |
17 | bindkey "^[[8~" end-of-line #End | |
18 | bindkey -a "^[[8~" end-of-line | |
19 | bindkey "^[[3~" delete-char #Del | |
20 | bindkey -a "^[[3~" delete-char | |
21 | # bsd vt | |
22 | bindkey "^[[H" beginning-of-line #Home | |
23 | bindkey -a "^[[H" beginning-of-line | |
24 | bindkey "^[[F" end-of-line #End | |
25 | bindkey -a "^[[F" end-of-line | |
26 | ||
27 | autoload -Uz up-line-or-beginning-search down-line-or-beginning-search | |
28 | zle -N up-line-or-beginning-search | |
29 | zle -N down-line-or-beginning-search | |
30 | [[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search | |
31 | [[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search | |
32 | ||
33 | ## aliases | |
34 | alias h="history -25" | |
35 | alias j="jobs -l" | |
36 | alias l="ls -AF" | |
37 | alias ll="ls -lAFho" | |
38 | local p="ps -aSdxwwouser=USR -ogroup=GRP -opid,nice=N \ | |
39 | -o%cpu,%mem,tt,stat,start=START -oetime,command | ${PAGER:-more} -Se" | |
40 | alias pa="$p" | |
41 | alias spa="sudo $p" | |
42 | unset p | |
43 | function s { sysctl hw.snd.default_unit${1:+=$1} } | |
44 | alias va="source bin/activate" | |
45 | alias vd="deactivate" | |
46 | ||
47 | # be paranoid | |
48 | alias cp='cp -ip' | |
49 | alias mv='mv -i' | |
50 | alias rm='rm -I' | |
51 | ||
52 | # ports | |
53 | function portpkg { | |
54 | case "$1" { | |
55 | build|run) | |
56 | sudo pkg install -AU $(make ${1}-depends-list | | |
57 | sed 's_/usr/ports/_ _' | tr -d '\n') | |
58 | ;; | |
59 | *) echo "Usage: \`portpkg <build|run>' in a port directory" | |
60 | return 1;; | |
61 | } | |
62 | } | |
63 | ||
64 | ## prompt | |
65 | setopt prompt_subst | |
66 | PROMPT='%F{$VICOL}%n%f@%F{$VICOL}%2m%f%(?../%F{red}$?%f)%# ' | |
67 | RPROMPT='%F{yellow}${vcs_info_msg_0_:-%~}%f %T' | |
68 | ||
69 | function zle-line-init zle-keymap-select { | |
70 | VICOL="${${KEYMAP:/vicmd/red}:/(main|viins)/green}" | |
71 | zle reset-prompt | |
72 | } | |
73 | zle -N zle-line-init | |
74 | zle -N zle-keymap-select | |
75 | ||
76 | autoload -Uz vcs_info | |
77 | zstyle ':vcs_info:*' enable git | |
78 | zstyle ':vcs_info:git*' formats "%c%u%%F{green}%r/%b%%f/%%F{yellow}%S%%f" | |
79 | zstyle ':vcs_info:git*' actionformats "%%F{red}(%a)%%f %c%u%%F{green}%r/%b%%f/\ | |
80 | %%F{yellow}%S%%f" | |
81 | #zstyle ':vcs_info:git*' check-for-changes true #too slow | |
82 | zstyle ':vcs_info:git*' check-for-staged-changes true | |
83 | zstyle ':vcs_info:git*' stagedstr "%F{blue}+" | |
84 | zstyle ':vcs_info:git*' unstagedstr "%F{red}*" | |
85 | ||
86 | function precmd { | |
87 | print -Pn "\e]0;%(1j,%j,)%#${SSH_CLIENT+$USER@$HOST:}%~\a" | |
88 | vcs_info | |
89 | if ((SECONDS - _exectime >= 5)) { | |
90 | # bell if exec takes 5s | |
91 | print "\a" | |
92 | } | |
93 | } | |
94 | function preexec { | |
95 | # change Xorg title | |
96 | print -Pnf "\e]0;%s\a" "%#${SSH_CLIENT+$USER@$HOST:}$1" | |
97 | # save last exec time | |
98 | _exectime=$SECONDS | |
99 | } | |
100 | ||
101 | # The following lines were added by compinstall | |
102 | zstyle ':completion:*' auto-description 'specify: %d' | |
103 | zstyle ':completion:*' expand suffix | |
104 | zstyle ':completion:*' format '# %d' | |
105 | zstyle ':completion:*' group-name '' | |
106 | zstyle ':completion:*' ignore-parents parent | |
107 | zstyle ':completion:*' insert-unambiguous false | |
108 | zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} | |
109 | zstyle ':completion:*' list-prompt '%B%i%b' | |
110 | zstyle ':completion:*' list-suffixes true | |
111 | zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._-]=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' | |
112 | zstyle ':completion:*' menu select=1 | |
113 | zstyle ':completion:*' original false | |
114 | zstyle ':completion:*' select-prompt '%B%l%b' | |
115 | zstyle ':completion:*' verbose true | |
116 | zstyle :compinstall filename '/home/ds6/.zshrc' | |
117 | ||
118 | autoload -Uz compinit | |
119 | compinit | |
120 | # End of lines added by compinstall | |
121 | ||
122 | # vim: ts=8:sts=4:sw=4:et:tw=79 |