From: Don Armstrong Date: Sun, 21 Sep 2014 22:20:08 +0000 (-0700) Subject: Merge remote-tracking branch 'madduck/master' X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=929a2738768030f0e46f3c13a26d9cde7cd38c62;hp=47e33e38ed0ae2e2d57b506399e1feeee7f2f026;p=zsh.git Merge remote-tracking branch 'madduck/master' Conflicts: .zsh/zshrc/30_aliases .zsh/zshrc/79_bindkeys --- diff --git a/.zsh/func/TS b/.zsh/func/TS index 4ef0cb1..d87df4b 100755 --- a/.zsh/func/TS +++ b/.zsh/func/TS @@ -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 index 0000000..aeaeea0 --- /dev/null +++ b/.zsh/zlogin/90_db @@ -0,0 +1,23 @@ +# zlogin/90_db +# +# print today's reminder items +# +# Copyright © 1994–2013 martin f. krafft +# 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 diff --git a/.zsh/zshrc/30_aliases b/.zsh/zshrc/30_aliases index fa97378..522fd4a 100644 --- a/.zsh/zshrc/30_aliases +++ b/.zsh/zshrc/30_aliases @@ -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 diff --git a/.zsh/zshrc/60_vcsprompt b/.zsh/zshrc/60_vcsprompt index b5ab68c..f7f80ca 100644 --- a/.zsh/zshrc/60_vcsprompt +++ b/.zsh/zshrc/60_vcsprompt @@ -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) diff --git a/.zsh/zshrc/79_bindkeys b/.zsh/zshrc/79_bindkeys index 803db91..e3d3b3a 100644 --- a/.zsh/zshrc/79_bindkeys +++ b/.zsh/zshrc/79_bindkeys @@ -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 diff --git a/.zsh/zshrc/85_prompt b/.zsh/zshrc/85_prompt index 4999a34..82ae890 100644 --- a/.zsh/zshrc/85_prompt +++ b/.zsh/zshrc/85_prompt @@ -25,6 +25,6 @@ if [ "${PS1:-}" = '%m%# ' ]; then PS1="%(2L.+.)%${_MACHINE_NAME}:${_MIDDLE}%# " fi -: ${RPS1:="#%(0?..%?,)%!"} +: ${RPS1:="#%(0?..%?,)%! [%l]"} # vim:ft=zsh