]> git.donarmstrong.com Git - zsh.git/commitdiff
Merge remote-tracking branch 'madduck/master'
authorDon Armstrong <don@donarmstrong.com>
Sun, 21 Sep 2014 22:20:08 +0000 (15:20 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sun, 21 Sep 2014 22:20:08 +0000 (15:20 -0700)
Conflicts:
.zsh/zshrc/30_aliases
.zsh/zshrc/79_bindkeys

.zsh/func/TS
.zsh/zlogin/90_db [new file with mode: 0644]
.zsh/zshrc/30_aliases
.zsh/zshrc/60_vcsprompt
.zsh/zshrc/79_bindkeys
.zsh/zshrc/85_prompt

index 4ef0cb1e2c7516093fce8c92df52686f9171b129..d87df4b83fd87d434349cb8538cdadea90db219e 100755 (executable)
@@ -14,7 +14,8 @@ local topic filename ret
 topic="${(j:_:)@}"
 filename="${TMPDIR:-/tmp}/script.${topic:-$LOGNAME}.$$.$(date +%Y%m%d.%H%M)"
 echo "I: writing typescript to $filename ..." >&2
-PS1="%# " PS2= RPS1= script -c "zsh -f" -f -q "$filename"
+PS1="
+%# " PS2= RPS1= script -c "zsh -f" -f -q "$filename"
 ret=$?
 echo "I: typescript is in $filename ."
 return $ret
diff --git a/.zsh/zlogin/90_db b/.zsh/zlogin/90_db
new file mode 100644 (file)
index 0000000..aeaeea0
--- /dev/null
@@ -0,0 +1,23 @@
+# zlogin/90_db
+#
+# print today's reminder items
+#
+# Copyright © 1994–2013 martin f. krafft <madduck@madduck.net>
+# Released under the terms of the Artistic Licence 2.0
+#
+# Source repository: git://git.madduck.net/etc/zsh.git
+#
+
+cnt=0
+db -md1 | while read line; do
+  [ -n "$line" ] || continue
+  if [ $cnt -eq 0 ]; then
+    cnt=$((cnt+1))
+    echo "*** $line"
+  else
+    echo "$line"
+  fi
+done
+[ $cnt -gt 0 ] && echo
+
+# vim:ft=zsh
index fa973784e0b045ec92f79f2e86cd20f3238c9fee..522fd4ad021e2f60a894d6c4089f309cc394b4ff 100644 (file)
@@ -183,6 +183,8 @@ ptssub() { echo subscribe ${1:?E: no package name given.} | sendmail -f ${2:-$DE
 ptsunsub() { echo unsubscribe ${1:?E: no package name given.} | sendmail -f ${2:-$DEBEMAIL} pts@qa.debian.org }
 qasub() { echo subscribe ${1:?E: no package name given.} ${2:-unspecifed} | sendmail -f $DEBEMAIL ddpo@qa.debian.org }
 qaunsub() { echo unsubscribe ${1:?E: no package name given.} ${2:-unspecifed} | sendmail -f $DEBEMAIL ddpo@qa.debian.org }
+listsub() { echo Subject: subscribe | sendmail -f ${1%@*}=${1#*@}@mass.madduck.net ${1%@*}-request@${1#*@} }
+listunsub() { echo Subject: unsubscribe | sendmail -f ${1%@*}=${1#*@}@mass.madduck.net ${1%@*}-request@${1#*@} }
 
 uc() { unicode --max=0 --colour=off "$@" | sensible-pager }
 
@@ -197,4 +199,44 @@ compdef asc=ssh
 
 alias mdtest='swaks -s localhost -t'
 
+pdfextract() {
+  local i=$1
+  local o=$2
+  shift 2
+  pdftk "$i" cat "${@:-1-end}" output "${o%.pdf}.pdf"
+}
+compdef _files pdfextract
+
+gittestfile() {
+  local annex; annex=false
+  local file
+
+  case "$1" in
+    (-a) annex=true;;
+    (*)
+      if [ -n "$file" ]; then
+        echo >&2 "E: filename already given"
+        return 1
+      fi
+      file="$1";;
+  esac
+
+  if [ -z "$file" ]; then
+    file=$(TMPDIR=${PWD} tempfile -ptest. -s.txt)
+  fi
+
+  echo "Test file created $(date)" >| $file
+
+  case "$annex" in
+    true)
+      git annex add $file
+      git commit -m"Add test file $file to annex"
+      ;;
+    false)
+      git add $file
+      git commit -m"Add test file $file"
+      ;;
+  esac
+}
+
 # vim:ft=zsh
index b5ab68ca5b1d31d902e1262be87fff4a486cbe72..f7f80ca807acf818da50d8ba91d211417d99f561 100644 (file)
@@ -16,13 +16,9 @@ __git_get_reporoot()
 {
   # return the full path to the root of the current git repository
   [ -d "$GIT_DIR" ] && echo "$GIT_DIR" && return 0
-  local relroot
-  relroot="$(git rev-parse --show-cdup 2>/dev/null)" || return 1
-  if [ -n "$relroot" ]; then
-    readlink -f "$relroot"
-  else
-    echo $PWD
-  fi
+  local dir; dir="$PWD/$(git rev-parse --show-cdup)"
+  # do not use --show-toplevel because it resolves symlinks
+  echo $dir:a
 }
 
 __git_get_branch()
@@ -160,12 +156,19 @@ __vcs_set_prompt_variables()
         { error "could not determine git repository root"; return 1 }
       branch="$(__git_get_branch)" ||
         { error "could not determine git branch"; return 1 }
-      eval set -- $(__vcs_get_prompt_path_components "$reporoot" "$branch")
-      if [ -d "$GIT_DIR" ]; then
-        # poor man's replace until I find out how to do named dirs properly
-        # here:
-        local _D="${GIT_DIR/$HOME/~}"
-        set -- "$_D" "$2" "${${1#$_D}%/}"
+      if [ -n "$VCSH_REPO_NAME" ]; then
+        # if vcsh is used to get a subshell, then the repo root is the home
+        # directory, but we want to indicate the vcsh context too:
+        eval set -- $(__vcs_get_prompt_path_components "$HOME" "$branch")
+        set -- "vcsh:$VCSH_REPO_NAME" "$2" "$3"
+      else
+        eval set -- $(__vcs_get_prompt_path_components "$reporoot" "$branch")
+        if [ -d "$GIT_DIR" ]; then
+          # poor man's replace until I find out how to do named dirs properly
+          # here:
+          local _D="${GIT_DIR/$HOME/~}"
+          set -- "$_D" "$2" "${${1#$_D}%/}"
+        fi
       fi
       ;;
     hg)
index 803db91df1532a420af328155d9415c1c8312173..e3d3b3a7316ccc29ac9a764b39456b964b381d55 100644 (file)
@@ -37,5 +37,8 @@ bindkey "\e[1;5D" backward-word
 bindkey "\e[8~" end-of-line
 bindkey "\eOc" forward-word
 bindkey "\eOd" backward-word
+# fix home/end keys (for mosh)
+bindkey "\e[7~" beginning-of-line
+bindkey "\e[8~" end-of-line
 
 # vim:ft=zsh
index 4999a347ad79c65e67677e8b53d973cbd194d692..82ae89074d82e5a9a2aefadc4537a376cde2a012 100644 (file)
@@ -25,6 +25,6 @@ if [ "${PS1:-}" = '%m%# ' ]; then
   PS1="%(2L.+.)%${_MACHINE_NAME}:${_MIDDLE}%# "
 fi
 
-: ${RPS1:="#%(0?..%?,)%!"}
+: ${RPS1:="#%(0?..%?,)%! [%l]"}
 
 # vim:ft=zsh