]> git.netwichtig.de Git - user/henk/vcsh/zsh.git/blob - .zsh_functions
Change '.' to 'source'
[user/henk/vcsh/zsh.git] / .zsh_functions
1 #function info_print () {
2 #    local esc_begin esc_end
3 #    esc_begin="$1"
4 #    esc_end="$2"
5 #    shift 2
6 #    printf '%s' ${esc_begin}
7 #    printf '%s' "$*"
8 #    printf '%s' "${esc_end}"
9 #}
10 #
11 #function set_title () {
12 #    info_print  $'\e]0;' $'\a' "$@"
13 #}
14 #
15 #function ESC_print () {
16 #    info_print $'\ek' $'\e\\' "$@"
17 #}
18 #
19 #preexec () {
20 #    case $TERM in
21 #        (xterm*|rxvt*)
22 #            set_title "${(%):-"%n@%m:"}" "$1"
23 #        ;;
24 #        (screen*)
25 #            local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]}
26 #            ESC_print ${CMD}
27 #        ;;
28 #    esac
29 #}
30 #
31 #precmd () {
32 #    case $TERM in
33 #        (xterm*|rxvt*)
34 #            set_title ${(%):-"%n@%m: %~"}
35 #        ;;
36 #        (screen*)
37 #            ESC_print "zsh"
38 #        ;;
39 #    esac
40 #
41 #    vcs_info
42 #
43 ##    local INBOXINFO="$(task rc.gc=off rc.verbose=nothing +in +PENDING count) "
44 #
45 #    PS1="${HENKSPROMPTHEADER}%(0?..%F{red}E%?%f )%(1j.%F{yellow}J%j%f .)%(3L.%F{yellow}L%L%f .)%3~ %F{green}$VCSH_REPO_NAME%f%F{yellow}${vcs_info_msg_0_}%f%# "
46 #}
47
48 function vifind () {
49     vi $( find $@)
50 }
51
52 function new_haskell_project () {
53     stack new $1 simple
54     cd $1
55     git init
56 }
57
58 function henkspngpostproc () {
59     local resize_by
60     local img
61     resize_by="$1"
62     shift
63     echo "Creating Directories …"
64     mkdir --parents resized/pngnqed/optipnged optimized
65     for img in $*
66     do
67         echo "Resizing image …"
68         convert -resize $resize_by% "$img" "resized/$img"
69         echo "Running pngnq …"
70         pngnq -s1 -f -d "resized/pngnqed" -e .png "resized/$img"
71         echo "Running optipng …"
72         optipng -force -out "resized/pngnqed/optipnged/$img" "resized/pngnqed/$img"
73         echo "Moving final image to directory 'optimized' …"
74         cp --verbose --interactive --target-directory=optimized/ "resized/pngnqed/optipnged/$img"
75         echo "Removing temporary images …"
76         #rm --verbose --interactive \
77         rm --verbose \
78           "resized/$img" \
79           "resized/pngnqed/$img" \
80           "resized/pngnqed/optipnged/$img"
81     done
82     rmdir --parents resized/pngnqed/optipnged
83 }
84
85 function with () {
86     local prefix="$* " str compcontext=normal:normal:_normal
87     while :
88     do
89       str=$prefix
90       vared str && eval $str
91     done
92 }
93
94 function stardewpause () {
95   while read bar
96   do
97     xdotool \
98       search --class 'StardewValley' \
99       windowactivate --sync \
100       type --delay 100 t/pause\r
101   done
102 }
103