From: martin f. krafft Date: Sun, 18 May 2008 13:40:45 +0000 (+0200) Subject: integrate local changes X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/3cfd3322550b929dd126d509ca4a9ae7024fe71b?hp=ad251c8c9dbdc49a9118417654251ef18039125e integrate local changes --- diff --git a/.zsh/func/TS b/.zsh/func/TS index 0a51ab1..63eb5fb 100755 --- a/.zsh/func/TS +++ b/.zsh/func/TS @@ -14,7 +14,7 @@ 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="%# " script -c "zsh -f" -f -q "$filename" +PS1="%# " PS2= script -c "zsh -f" -f -q "$filename" ret=$? echo "I: typescript is in $filename ." return $ret diff --git a/.zsh/func/vcsh b/.zsh/func/vcsh new file mode 100755 index 0000000..cd6d205 --- /dev/null +++ b/.zsh/func/vcsh @@ -0,0 +1,39 @@ +#!/bin/sh +# +# func/vcsh +# +# set the context for vcs-home operations +# +# Copyright © 1994–2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +local FGIT_BASE="$HOME/.fgits" + +if [ "${1:---help}" = '--help' ] || [ $# -gt 1 ]; then + echo "usage: ${0##*/} reponame" >&2 + echo "usage: ${0##*/} -l" >&2 + [ "$1" = '--help' ] + return $? + +elif [ "$1" = '-l' ]; then + for i in $FGIT_BASE/*.git; do + i="${i#$FGIT_BASE/}" + echo "${i%.git}" + done + return 0 +fi + +if [ ! -d "$FGIT_BASE/${1}.git" ]; then + echo E: no repository found for "$1" >&2 + return 2 +fi + +export GIT_DIR="$FGIT_BASE/${1}.git" +export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)" + +git status + +PS1="%S{${0##*/}:$1}%s$PS1" $SHELL -i diff --git a/.zsh/zshrc/00_varsetup b/.zsh/zshrc/00_varsetup index 68ec386..29be5d1 100644 --- a/.zsh/zshrc/00_varsetup +++ b/.zsh/zshrc/00_varsetup @@ -16,4 +16,9 @@ typeset -ga preexec_functions typeset -ga precmd_functions typeset -ga chpwd_functions +# warn on accidental creation of global variables +# unset for now until we work out the corner cases, like warning about $reply +# and $HISTFILE or $REPORTTIME. +#setopt warn_create_global + # vim:ft=zsh diff --git a/.zsh/zshrc/30_aliases b/.zsh/zshrc/30_aliases index 9df703a..562f4b9 100644 --- a/.zsh/zshrc/30_aliases +++ b/.zsh/zshrc/30_aliases @@ -23,12 +23,11 @@ alias curl='noglob curl' alias apt-cache='noglob apt-cache' alias locate='noglob locate' -_ls_opts=(-bC --color=auto) -ls --group-directories-first >/dev/null 2>&1 \ +typeset -a _ls_opts; _ls_opts=(-bC --color=auto) +command ls --group-directories-first >/dev/null 2>&1 \ && _ls_opts+=--group-directories-first # I prefer POSIX collation for ls alias ls="LC_COLLATE=POSIX ls $_ls_opts" -unset _ls_opts alias ll='ls -l' alias l=ll @@ -117,4 +116,8 @@ for l in ${(k)_LANGUAGES}; do done unset _LANGUAGES +alias dpkg-buildpackage="dpkg-buildpackage -k$DEBKEYID" + +uc() { unicode --max=0 --colour=off "$@" | sensible-pager } + # vim:ft=zsh diff --git a/.zsh/zshrc/60_vcsprompt b/.zsh/zshrc/60_vcsprompt index 4cc18a3..9fa0f44 100644 --- a/.zsh/zshrc/60_vcsprompt +++ b/.zsh/zshrc/60_vcsprompt @@ -144,9 +144,8 @@ __vcs_set_prompt_variables() if [ -d "$GIT_DIR" ]; then # poor man's replace until I find out how to do named dirs properly # here: - _D="${GIT_DIR/$HOME/~}" + local _D="${GIT_DIR/$HOME/~}" set -- "$_D" "$2" "${${1#$_D}%/}" - unset _D fi ;; hg) diff --git a/.zsh/zshrc/80_history b/.zsh/zshrc/80_history index 4a80f06..af0f93b 100644 --- a/.zsh/zshrc/80_history +++ b/.zsh/zshrc/80_history @@ -8,7 +8,8 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -HISTFILE=$ZVARDIR/history +# typeset -g on this one to make warn_create_global happy +typeset -g HISTFILE=$ZVARDIR/history HISTSIZE=10000 SAVEHIST=$HISTSIZE LISTMAX=1000 diff --git a/.zsh/zshrc/80_prompt b/.zsh/zshrc/80_prompt index 95ea67d..54d0e4d 100644 --- a/.zsh/zshrc/80_prompt +++ b/.zsh/zshrc/80_prompt @@ -8,19 +8,19 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -local _MIDDLE="%1v%(2v.|%B%2v%b|.)%(3v.%3v.)" -local _PS1_HL -if is_root; then - _MIDDLE="%25<..<%~%<<" - _PS1_HL=U -fi +if [ "${PS1:-}" = '%m%# ' ]; then + local _MIDDLE="%1v%(2v.|%B%2v%b|.)%(3v.%3v.)" + if is_root; then + _MIDDLE="%25<..<%~%<<" + local _PS1_HL=U + fi -_MACHINE_NAME="${_PS1_HL:=B}%m%${(L)_PS1_HL}" -_MACHINE_NAME="$_MACHINE_NAME${debian_chroot:+/$debian_chroot}" + local _MACHINE_NAME="${_PS1_HL:=B}%m%${(L)_PS1_HL}" + _MACHINE_NAME="$_MACHINE_NAME${debian_chroot:+/%S$debian_chroot%s}" -PS1="%(2L.+.)%${_MACHINE_NAME}:${_MIDDLE}%# " -RPS1="#%(0?..%?,)%!" + PS1="%(2L.+.)%${_MACHINE_NAME}:${_MIDDLE}%# " +fi -unset _MACHINE_NAME +: ${RPS1:="#%(0?..%?,)%!"} # vim:ft=zsh diff --git a/.zsh/zshrc/99_TODO b/.zsh/zshrc/99_TODO index 4fbaa92..7d6536b 100644 --- a/.zsh/zshrc/99_TODO +++ b/.zsh/zshrc/99_TODO @@ -56,7 +56,8 @@ setopt c_bases WORDCHARS="${WORDCHARS//\/}" # report time stats when command takes longer than 5 seconds -REPORTTIME=5 +# typeset -g to make warn_create_global happy +typeset -g REPORTTIME=5 MAILCHECK=0