summaryrefslogtreecommitdiff
path: root/.zsh_functions
diff options
context:
space:
mode:
authorHendrik Jaeger <henk@frustcomp>2014-11-10 22:47:15 +0100
committerHendrik Jaeger <henk@frustcomp>2014-11-10 22:47:15 +0100
commitc6f847b4678c616bd09ebfcf3980ffbabef10caf (patch)
tree72374b639cf3aa83c728d1a8fbce103de1dcd49d /.zsh_functions
Initial commit
new file: .zsh_aliases new file: .zsh_functions new file: .zshcomprc new file: .zshrc
Diffstat (limited to '.zsh_functions')
-rw-r--r--.zsh_functions50
1 files changed, 50 insertions, 0 deletions
diff --git a/.zsh_functions b/.zsh_functions
new file mode 100644
index 0000000..d4818ec
--- /dev/null
+++ b/.zsh_functions
@@ -0,0 +1,50 @@
+function info_print () {
+ local esc_begin esc_end
+ esc_begin="$1"
+ esc_end="$2"
+ shift 2
+ printf '%s' ${esc_begin}
+ printf '%s' "$*"
+ printf '%s' "${esc_end}"
+}
+
+function set_title () {
+ info_print $'\e]0;' $'\a' "$@"
+}
+
+function ESC_print () {
+ info_print $'\ek' $'\e\\' "$@"
+}
+
+preexec () {
+ if [[ "$TERM" == screen* ]] ; then
+ local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]}
+ ESC_print ${CMD}
+ fi
+ case $TERM in
+ (xterm*|rxvt*)
+ set_title "${(%):-"%n@%m:"}" "$1"
+ ;;
+ esac
+}
+
+precmd () {
+ if [[ $TERM == screen* ]] ; then
+ ESC_print "zsh"
+ fi
+
+ case $TERM in
+ (xterm*|rxvt*)
+ set_title ${(%):-"%n@%m: %~"}
+ ;;
+ esac
+}
+
+function vifind () {
+ vi $( find $1 -type f )
+}
+
+function shufflevideos () {
+ find $@ -type f -iregex ".*\.\(avi\|flv\|mkv\|mpeg\|mpg\|wmv\|wva\|mp4\|webm\|wva\|m4v\|ogm\|mp4\|mov\)" -exec mpv --shuffle $MPVOPTS \{\} +
+}
+