summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2021-10-22 22:39:06 +0200
committerHendrik Jäger <gitcommit@henk.geekmail.org>2021-10-22 22:39:06 +0200
commit97e0461b3938abc7cf0cff770a87c1f0c90ec507 (patch)
tree0bda3ab96d477e058830e2a4bfeda43457be21df
parenta9c1c1fb6bc039ffc1dc87b244f7987f7e10aa67 (diff)
autoload functions part 1
-rw-r--r--.zsh_functions107
-rw-r--r--.zsh_functions.file8
-rw-r--r--.zshrc18
3 files changed, 24 insertions, 109 deletions
diff --git a/.zsh_functions b/.zsh_functions
deleted file mode 100644
index 5e44334..0000000
--- a/.zsh_functions
+++ /dev/null
@@ -1,107 +0,0 @@
-#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 () {
-# case $TERM in
-# (xterm*|rxvt*)
-# set_title "${(%):-"%n@%m:"}" "$1"
-# ;;
-# (screen*)
-# local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]}
-# ESC_print ${CMD}
-# ;;
-# esac
-#}
-#
-#precmd () {
-# case $TERM in
-# (xterm*|rxvt*)
-# set_title ${(%):-"%n@%m: %~"}
-# ;;
-# (screen*)
-# ESC_print "zsh"
-# ;;
-# esac
-#
-# vcs_info
-#
-## local INBOXINFO="$(task rc.gc=off rc.verbose=nothing +in +PENDING count) "
-#
-# 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%# "
-#}
-
-function vifind () {
- vi $( find $@)
-}
-
-function new_haskell_project () {
- stack new $1 simple
- cd $1
- git init
-}
-
-function henkspngpostproc () {
- local resize_by
- local img
- resize_by="$1"
- shift
- echo "Creating Directories …"
- mkdir --parents resized/pngnqed/optipnged optimized
- for img in $*
- do
- echo "Resizing image …"
- convert -resize $resize_by% "$img" "resized/$img"
- echo "Running pngnq …"
- pngnq -s1 -f -d "resized/pngnqed" -e .png "resized/$img"
- echo "Running optipng …"
- optipng -force -out "resized/pngnqed/optipnged/$img" "resized/pngnqed/$img"
- echo "Moving final image to directory 'optimized' …"
- cp --verbose --interactive --target-directory=optimized/ "resized/pngnqed/optipnged/$img"
- echo "Removing temporary images …"
- #rm --verbose --interactive \
- rm --verbose \
- "resized/$img" \
- "resized/pngnqed/$img" \
- "resized/pngnqed/optipnged/$img"
- done
- rmdir --parents resized/pngnqed/optipnged
-}
-
-function with () {
- local prefix="$* " str compcontext=normal:normal:_normal
- while :
- do
- str=$prefix
- vared str && eval $str
- done
-}
-
-function stardewpause () {
- while read bar
- do
- xdotool \
- search --class 'StardewValley' \
- windowactivate --sync \
- type --delay 100 t/pause
- done
-}
-
-function henkpwgen () {
- echo $( (tr -cd '[:alnum:]' | head -c $1) < /dev/urandom)
-}
-
diff --git a/.zsh_functions.file b/.zsh_functions.file
new file mode 100644
index 0000000..45e1e79
--- /dev/null
+++ b/.zsh_functions.file
@@ -0,0 +1,8 @@
+function with () {
+ local prefix="$* " str compcontext=normal:normal:_normal
+ while :
+ do
+ str=$prefix
+ vared str && eval $str
+ done
+}
diff --git a/.zshrc b/.zshrc
index afa4948..a5157d9 100644
--- a/.zshrc
+++ b/.zshrc
@@ -4,13 +4,27 @@ source ~/.zsh_zinit
source /usr/share/autojump/autojump.sh
+fpath=(~/.zsh_functions $fpath)
+
+autoload henkspngpostproc
+autoload henkspwgen
+autoload new_hs_project
+autoload vifind
+autoload movies_biggest
+autoload movies_forgotten
+autoload movies_newest
+autoload movies_oldest
+autoload movies_smallest
+autoload mpvshuffledir
+autoload pause_stardew
+
autoload -Uz vcs_info
autoload -Uz edit-command-line
source ~/.zsh_taskwarrior
-source ~/.zsh_functions
-source ~/.zsh_functions_media
+# source ~/.zsh_functions
+# source ~/.zsh_functions_media
#source ~/.zsh_functions_taskwarrior
source ~/.zsh_aliases