zsh-sticky-prompt/README.MD
2018-10-05 10:08:59 -05:00

1.5 KiB

zsh-sticky-prompt

Based on the idea of zsh-sticky-prefix this allows for the sticking of the left & right bufers in ZSH so that one can repeatedly execute code/commands in the CLI without having to either retype the whole line, or go back through history and delete/change/tweak in the input.

When the prompt is in sticky mode it will save the input in the line to the left and right of the current place in the line, so that after entering a command the next line will include the stuck prompt and place the line input at the same place where it was in the line when the stickiness was set. Examples demonstrate this behavior below.

Installation

Copy the contents of the zsh-sticky-prompt.zshrc file into the .zshrc file. If the sticking of the prefix doesn't work, place the code at the end of the .zshrc file since there might be other scripts overriding the hooks this script uses. oh-my-zsh is one of those types where oh-my-zsh will need to be sourced before this code snippet.

Usage

CTRL + S activates the sticky prompt feature based on the current line input. Pressing again (without modifying the prompt) it will delete the stickiness, as does pressing Return on an empty line.

Examples

Sticky prompt on the end of a line

Sticking on the end of a line

Sticky prompt in the middle of a line

Sticking in the middle of a line