]> git.netwichtig.de Git - user/henk/vcsh/zsh.git/blob - .zsh_functions
Initial commit
[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   if [[ "$TERM" == screen* ]] ; then
21       local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]}
22       ESC_print ${CMD}
23   fi
24   case $TERM in
25       (xterm*|rxvt*)
26           set_title "${(%):-"%n@%m:"}" "$1"
27           ;;
28   esac
29 }
30
31 precmd () {
32   if [[ $TERM == screen* ]] ; then
33     ESC_print "zsh"
34   fi
35
36   case $TERM in
37     (xterm*|rxvt*)
38       set_title ${(%):-"%n@%m: %~"}
39       ;;
40   esac
41 }
42
43 function vifind () {
44     vi $( find $1 -type f )
45 }
46
47 function shufflevideos () {
48     find $@ -type f -iregex ".*\.\(avi\|flv\|mkv\|mpeg\|mpg\|wmv\|wva\|mp4\|webm\|wva\|m4v\|ogm\|mp4\|mov\)" -exec mpv --shuffle $MPVOPTS \{\} +
49 }
50