]> Sergey Matveev's repositories - schwabrak.git/blob - lib.zsh.rc
Fix unquoted string
[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 relpath() {
14     $PERL -mFile::Spec -le "print File::Spec->abs2rel(@ARGV)" $1:a $2:a
15 }
16
17 endash() {
18     $PERL -npe 's/(-+)/$1-/g ; s/ /-/g'
19 }
20
21 dedash() {
22     $PERL -npe 's/([^-])-([^-])/$1 $2/g ; s/-(-+)/$1/g'
23 }
24
25 supercat() { cat ; }
26 if [[ -z $NO_COLOR ]] && command -v spc > /dev/null 2> /dev/null ; then
27     supercat() { spc $@ ; }
28 fi
29
30 delim() {
31     {
32         local i
33         for i ({1..40}) print -n -- -
34         print
35     } | supercat -e mag,".*"
36 }