From c80002d50f2830d7cda34df311dd6f09649ded63 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Apr 2021 15:55:01 +0200 Subject: zsh: install up, interactive pipeline previewer --- user/zsh/zshrc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'user/zsh/zshrc') diff --git a/user/zsh/zshrc b/user/zsh/zshrc index b2c76e1a..f9f9c984 100644 --- a/user/zsh/zshrc +++ b/user/zsh/zshrc @@ -55,6 +55,19 @@ sort=${commands[gsort]:-$commands[sort]} ds () { du -hd1 "$@" | $sort -h } +zle-upify() { + buf="$(echo "$BUFFER" | sed 's/[ |]*$//')" + tmp="$(mktemp)" + eval "$buf |& up -o '$tmp' 2>/dev/null" + cmd="$(tail -n +2 "$tmp")" + rm -f "$tmp" + BUFFER="$BUFFER | $cmd" + zle end-of-line +} +zle -N zle-upify + +bindkey '\e^u' zle-upify +bindkey '\e^p' zle-upify # returns the first ghq root, whereas $GHQ_ROOT returns all hash -d p=$ghq_root[0] -- cgit 1.4.1