From: martin f. krafft Date: Sun, 11 Sep 2011 09:08:04 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.madduck.net/madduck/pub/etc/zsh X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/1918b63567401917a02af7deb8f999432ea605a7?hp=4336d34048e4e777bcb988ba19bb9b4d3b90eec4 Merge branch 'master' of ssh://git.madduck.net/madduck/pub/etc/zsh --- diff --git a/.zsh/zshrc/20_dirhashes b/.zsh/zshrc/20_dirhashes index 943b8ba..ea1da70 100644 --- a/.zsh/zshrc/20_dirhashes +++ b/.zsh/zshrc/20_dirhashes @@ -10,5 +10,6 @@ hash -d doc=/usr/share/doc hash -d log=/var/log +hash -d deb=/var/cache/apt/archives # vim:ft=zsh diff --git a/.zsh/zshrc/30_aliases b/.zsh/zshrc/30_aliases index 982ddbb..967f804 100644 --- a/.zsh/zshrc/30_aliases +++ b/.zsh/zshrc/30_aliases @@ -71,8 +71,16 @@ alias ftp=lftp alias mbug='bts show --mbox' alias bug='BROWSER=www-browser bts show' -# handy documentation lookup on Debian -# from http://www.michael-prokop.at/computer/config/.zshrc +edalias() { + [[ -z "$1" ]] && { echo "Usage: edalias " ; return 1 } || vared aliases'[$1]' ; +} +compdef _aliases edalias + +edfunc() { + [[ -z "$1" ]] && { echo "Usage: edfunc " ; return 1 } || zed -f "$1" ; +} +compdef _functions edfunc + doc() { cd /usr/share/doc/$1 } compdef '_files -W /usr/share/doc -/' doc @@ -123,6 +131,13 @@ compdef _pids of function psgrep() { ps aux | grep "[${1[1]}]${1[2,-1]}" } +alias rw-='chmod 600' +alias rwx='chmod 700' +alias r--='chmod 644' +alias r-x='chmod 755' +alias r-s='chmod 2755' +alias rws='chmod 2775' + alias bofh='fortune bofh-excuses' autoload -U baseconv @@ -176,6 +191,9 @@ alias ipl='ip l' alias btd='btdownloadheadless' +function asc () { autossh -t "$@" 'screen -qxp= || screen -qdRR' } +compdef asc=ssh + alias mdtest='swaks -s localhost -t' if whence devtodo >/dev/null; then diff --git a/.zsh/zshrc/39_tempfuncs b/.zsh/zshrc/39_tempfuncs index 0350925..4b46a17 100644 --- a/.zsh/zshrc/39_tempfuncs +++ b/.zsh/zshrc/39_tempfuncs @@ -27,7 +27,7 @@ vit () { ;; esac done - local tmpfile=$(mktemp -t ${prefix}.XXXXXX) + local tmpfile=$(mktemp -t ${prefix:-vit}.XXXXXX) [ -n "$stdin" ] && cat >| $tmpfile sensible-editor $tmpfile /dev/tty echo $tmpfile diff --git a/.zsh/zshrc/80_bindkeys b/.zsh/zshrc/79_bindkeys similarity index 75% rename from .zsh/zshrc/80_bindkeys rename to .zsh/zshrc/79_bindkeys index 1959bbd..5747a21 100644 --- a/.zsh/zshrc/80_bindkeys +++ b/.zsh/zshrc/79_bindkeys @@ -12,11 +12,7 @@ bindkey -e # history expansion on pressing space -bindkey ' ' magic-space - -# prefix search (up to cursor position) -bindkey '^xp' history-beginning-search-backward -bindkey '^xn' history-beginning-search-forward +#bindkey ' ' magic-space # repeat the previous shell-word ($WORDCHARS) bindkey '\e=' copy-prev-shell-word diff --git a/.zsh/zshrc/80_abbreviations b/.zsh/zshrc/80_abbreviations new file mode 100644 index 0000000..06fc9a7 --- /dev/null +++ b/.zsh/zshrc/80_abbreviations @@ -0,0 +1,36 @@ +typeset -Ag abbreviations +abbreviations=( + '...' '../..' + '....' '../../..' + 'BG' '& exit' + 'C' '| wc' + 'G' '|& grep ' + 'H' '| head' + 'HL' ' --help |& less -r' + 'L' '| less' + 'LL' '|& less -r' + 'N' '&>/dev/null' + 'SL' '| sort | less' + 'S' '| sort -u' + 'T' '| tail' + 'V' '|& vim -' +) + +magic-abbrev-expand() { + local MATCH + LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#} + LBUFFER+=${abbreviations[$MATCH]:-$MATCH} + zle self-insert +} + +no-magic-abbrev-expand() { + LBUFFER+=' ' +} + +zle -N magic-abbrev-expand +zle -N no-magic-abbrev-expand +bindkey " " magic-abbrev-expand +bindkey "^x " no-magic-abbrev-expand +bindkey -M isearch " " self-insert + +# vim:ft=zsh diff --git a/.zsh/zshrc/80_zle b/.zsh/zshrc/80_zle index bdcdfd9..a737800 100644 --- a/.zsh/zshrc/80_zle +++ b/.zsh/zshrc/80_zle @@ -21,6 +21,35 @@ bindkey '\ee' edit-command-line _insert_datestamp() { LBUFFER+=${(%):-'%D{%Y.%m.%d}'}:; } zle -N insert-datestamp _insert_datestamp -bindkey '^t' insert-datestamp +bindkey '\et' insert-datestamp + +# prefix search (up to cursor position) +autoload history-search-end +zle -N history-beginning-search-backward-end history-search-end +zle -N history-beginning-search-forward-end history-search-end +bindkey "\e[5~" history-beginning-search-backward-end # PageUp +bindkey "\e[6~" history-beginning-search-forward-end # PageDown + +_insert_last_typed_word() { zle insert-last-word -- 0 -1 }; +zle -N _insert_last_typed_word; +bindkey "\em" _insert_last_typed_word + +autoload insert-unicode-char +zle -N insert-unicode-char +bindkey '^Xi' insert-unicode-char + +# jump behind the first word on the cmdline to add options +function _jump_after_first_word() { + local words + words=(${(z)BUFFER}) + + if (( ${#words} <= 1 )) ; then + CURSOR=${#BUFFER} + else + CURSOR=${#${words[1]}} + fi +} +zle -N _jump_after_first_word +bindkey '^x1' _jump_after_first_word # vim:ft=zsh diff --git a/.zsh/zshrc/80_prompt b/.zsh/zshrc/85_prompt similarity index 100% rename from .zsh/zshrc/80_prompt rename to .zsh/zshrc/85_prompt diff --git a/.zsh/zshrc/80_termfonts b/.zsh/zshrc/85_termfonts similarity index 100% rename from .zsh/zshrc/80_termfonts rename to .zsh/zshrc/85_termfonts diff --git a/.zsh/zshrc/80_xtermtitle b/.zsh/zshrc/85_xtermtitle similarity index 100% rename from .zsh/zshrc/80_xtermtitle rename to .zsh/zshrc/85_xtermtitle diff --git a/.zsh/zshrc/99_TODO b/.zsh/zshrc/99_TODO index ae9af23..b0084ce 100644 --- a/.zsh/zshrc/99_TODO +++ b/.zsh/zshrc/99_TODO @@ -31,6 +31,8 @@ setopt no_bgnice setopt nohup # do alert me of running jobs before exiting setopt checkjobs +# display PID when suspending processes as well +setopt longlistjobs # disable backslashed escape sequences unless -e is given to echo setopt bsd_echo