]> git.netwichtig.de Git - user/henk/vcsh/zsh.git/commitdiff
Taskwarrior and media convenience
authorHendrik Jaeger <git-commit@henk.geekmail.org>
Sat, 24 Sep 2016 22:02:32 +0000 (00:02 +0200)
committerHendrik Jaeger <git-commit@henk.geekmail.org>
Sat, 24 Sep 2016 22:02:32 +0000 (00:02 +0200)
.zsh_functions_media [new file with mode: 0644]
.zsh_functions_taskwarrior [new file with mode: 0644]
.zsh_taskwarrior [new file with mode: 0644]

diff --git a/.zsh_functions_media b/.zsh_functions_media
new file mode 100644 (file)
index 0000000..7631282
--- /dev/null
@@ -0,0 +1,36 @@
+function mpvshuffledir () {
+    mpv ${=MPVOPTS} \
+        --shuffle \
+        (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx) \
+       $@
+}
+
+function movies_forgotten () {
+    mpv ${=MPVOPTS} \
+        (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(Oa) \
+       $@
+}
+
+function movies_oldest () {
+    mpv ${=MPVOPTS} \
+        (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(Om) \
+       $@
+}
+
+function movies_newest () {
+    mpv ${=MPVOPTS} \
+        (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(om) \
+       $@
+}
+
+function movies_smallest () {
+    mpv ${=MPVOPTS} \
+        (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(oL) \
+       $@
+}
+
+function movies_biggest () {
+    mpv ${=MPVOPTS} \
+        (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(OL) \
+       $@
+}
diff --git a/.zsh_functions_taskwarrior b/.zsh_functions_taskwarrior
new file mode 100644 (file)
index 0000000..3431d85
--- /dev/null
@@ -0,0 +1,43 @@
+in () {
+    task add +in $@
+}
+
+# taskwarrior
+tickle () {
+    deadline=$1
+    shift
+    in +tickle wait:$deadline $@
+}
+
+think () {
+    tickle +1d $@
+}
+
+rnd () {
+    task add +rnd +in $@
+}
+
+webpage_title (){
+    wget -qO- "$*" | hxselect -s '\n' -c  'title' 2>/dev/null
+}
+
+read_and_review (){
+    local link="$1"
+    local title=$(webpage_title $link)
+    echo $title
+    local descr="\"Read and review: $title\""
+    local id=$(task add +in +read "$descr" | sed -n 's/Created task \(.*\)./\1/p')
+    task "$id" annotate "$link"
+}
+
+rnr () {
+    read_and_review $@
+}
+
+watch_and_review (){
+    task add +in +watch $@
+}
+
+wnr () {
+    watch_and_review $@
+}
diff --git a/.zsh_taskwarrior b/.zsh_taskwarrior
new file mode 100644 (file)
index 0000000..c579511
--- /dev/null
@@ -0,0 +1,34 @@
+### BEGIN task auto-completion ###
+fpath=($fpath /usr/local/share/doc/task/scripts/zsh)
+autoload -Uz compinit
+compinit -i
+
+# OPTIONAL
+# be verbose, i.e. show descriptions
+zstyle ':completion:*' verbose yes
+zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
+
+# group by tag names
+zstyle ':completion:*' group-name ''
+
+# OPTIONAL
+# colors
+autoload colors && colors
+
+# The magic works as follows:
+# * (#b) activates the use of brackets within regular expressions
+# * the part to the next = character is a regular expression to be matched
+# * color codes are separated with = characters
+# * the first code is the default color
+# * the other codes define the colors of the 1st, 2nd, etc. pair of brackets
+# (See http://zshwiki.org/home/examples/compsys/colors for a detailed description.)
+
+# You can use zstyle to configure the completion behaviour.
+# Here is an example of adding colors to the list of suggestions:
+
+# zstyle ':completion:*:*:task:*:arguments' list-colors "=(#b) #([^-]#)*=$color[cyan]=$color[bold];$color[blue]"
+# zstyle ':completion:*:*:task:*:default' list-colors "=(#b) #([^-]#)*=$color[cyan]=$color[green]"
+# zstyle ':completion:*:*:task:*:values' list-colors "=(#b) #([^-]#)*=$color[cyan]=$color[bold];$color[red]"
+# zstyle ':completion:*:*:task:*:commands' list-colors "=(#b) #([^-]#)*=$color[cyan]=$color[yellow]"
+
+### END task auto-completion ###
\ No newline at end of file