]> Sergey Matveev's repositories - schwabrak.git/blob - lib.zsh.rc
No Perl dependency for relative path calculation
[schwabrak.git] / lib.zsh.rc
1 setopt ERR_EXIT PIPE_FAIL EXTENDED_GLOB GLOB_STAR_SHORT
2
3 PERL=${PERL:-perl}
4 EDITOR=${EDITOR:-vi}
5
6 die() {
7     print $@ >&2
8     exit 1
9 }
10
11 [[ -d issues ]] || die You must run that command in directory with issues/
12
13 autoload -Uz relative
14
15 endash() {
16     $PERL -npe 's/(-+)/$1-/g ; s/ /-/g'
17 }
18
19 dedash() {
20     $PERL -npe 's/([^-])-([^-])/$1 $2/g ; s/-(-+)/$1/g'
21 }
22
23 supercat() { cat ; }
24 if [[ -z $NO_COLOR ]] && command -v spc > /dev/null 2> /dev/null ; then
25     supercat() { spc $@ ; }
26 fi
27
28 delim() {
29     {
30         local i
31         for i ({1..40}) print -n -- -
32         print
33     } | supercat -e mag,".*"
34 }