]> git.madduck.net Git - etc/zsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge branch 'master' of ssh://git.madduck.net/madduck/pub/etc/zsh
authormartin f. krafft <madduck@madduck.net>
Sun, 11 Sep 2011 09:08:04 +0000 (11:08 +0200)
committermartin f. krafft <madduck@madduck.net>
Sun, 11 Sep 2011 09:08:04 +0000 (11:08 +0200)
.zsh/zshrc/20_dirhashes
.zsh/zshrc/30_aliases
.zsh/zshrc/39_tempfuncs
.zsh/zshrc/79_bindkeys [moved from .zsh/zshrc/80_bindkeys with 75% similarity]
.zsh/zshrc/80_abbreviations [new file with mode: 0644]
.zsh/zshrc/80_zle
.zsh/zshrc/85_prompt [moved from .zsh/zshrc/80_prompt with 100% similarity]
.zsh/zshrc/85_termfonts [moved from .zsh/zshrc/80_termfonts with 100% similarity]
.zsh/zshrc/85_xtermtitle [moved from .zsh/zshrc/80_xtermtitle with 100% similarity]
.zsh/zshrc/99_TODO

index 943b8ba3671694dacbba4fbb36dfe8c63f55f7ba..ea1da701e0297861652748cd5f4743330501b22e 100644 (file)
@@ -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
index 982ddbb3f5bc49be168efd5bd8165c48aa3bf7f5..967f804e6a23e3c75fa04fa497f258f7d850124b 100644 (file)
@@ -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 <alias_to_edit>" ; return 1 } || vared aliases'[$1]' ;
+}
+compdef _aliases edalias
+
+edfunc() {
+  [[ -z "$1" ]] && { echo "Usage: edfunc <function_to_edit>" ; 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
index 0350925180837e2fa0b17eeae304bbc1d509a6ab..4b46a17a10b6092baae8a523d248f658466f7af0 100644 (file)
@@ -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 >/dev/tty
   echo $tmpfile
similarity index 75%
rename from .zsh/zshrc/80_bindkeys
rename to .zsh/zshrc/79_bindkeys
index 1959bbd5c9d2b5934bcfa9ac70888473c6cd15bf..5747a2156687612915c0fc2d32af04a31bd908e3 100644 (file)
 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 (file)
index 0000000..06fc9a7
--- /dev/null
@@ -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
index bdcdfd9934a76f4c4d5610eb3d2d03d8eafdc0bb..a7378006980c8c241a5a5e47f41eb3004164ea99 100644 (file)
@@ -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
similarity index 100%
rename from .zsh/zshrc/80_prompt
rename to .zsh/zshrc/85_prompt
index ae9af23c0838add6c74536af5989cb19a46cfb3a..b0084cefba78fe12d0104df371d54e4fd2e4322e 100644 (file)
@@ -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