This project is inspired by akavel/up.
tp is a terminal-based application for display the result of the commands at every keystroke.
Make it easy to chain commands for such as string manipulation.
It provides two displays.
- stdout from last pipe.
- live preview of the command result.
It can be synchronized shell's linebuffer and tp's inputfield.
The below config is the zsh integration.
keymappings: ctrl + |
function transparent-pipe() {
BUFFER="$(tp -c "${BUFFER}|")"
CURSOR=$#BUFFER
}
zle -N transparent-pipe
bindkey "^|" transparent-pipe
tp executes the command at every keystroke. There is possibility to execute dangerous commands such as rm.
So, tp is only supported specific string manipulation commands. Any other commands will be executed when you pressed |, not every keystroke.
Also, tp is not supported redirections(<, >).
supported commands:
awk,cut,egrep,grep,head,jq,nl,sed,sort,tail,tr,uniq,vgrep,wc,yq
$ go install github.com/minefuto/tp@latest
| operation | key |
|---|---|
| Move left(one char) | ← / Ctrl-B |
| Move right(one char) | → / Ctrl-F |
| Move left(one word) | Alt← / Alt-B |
| Move right(one word) | Alt→ / Alt-F |
| Move begin of the line | Home / Ctrl-A |
| Move end of the line | End / Ctrl-E |
| Delete one char before the cursor | Backspace / Ctrl-H |
| Delete one char after the cursor | Delete / Ctrl-D |
| Delete one word before the cursor | Ctrl-W |
| Delete from the cursor to end of the line | Ctrl-K |
| Delete all line | Ctrl-U |
> tp -h
Usage of tp:
-c, --command Return commandline text
-h, --help Show help
-s, --shell string Select a shell to use (default "$SHELL")
-v, --version Show version
macOS, Linux