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