cheatbuffer is a zsh plugin that displays command help info in the minibuffer (the buffer below the prompt that is used by tab completion, reverse history search, etc).
When you activate cheatbuffer (ctrl + h by default), it will display help text by:
- reading the current command
- trying a host of help commands (by default it tries to run the command with
--helpand if not successful, thecheatplugin) - displaying the help in the
minibuffer.
Required
Optional
git clone https://github.com/trungng92/cheatbuffer.git "$HOME/.oh-my-zsh/custom/plugins/cheatbuffer"- add the
cheatbufferplugin in the plugins list$HOME/.zshrc:
plugins=(
# other plugins
cheatbuffer
)Note: If you don't install the cheat plugin, this will only perform --help functionality
The current list of environment variables are:
# maximum buffer lines to show
export CHEATBUFFER_MAX_LINES=30
# Space separated function names that will be called when you try to run cheatbuffer
# by default we call _cheatbuffer_help and _cheatbuffer_cheat (which are defined in the cheatbuffer plugin).
# However, you are also able to add your own custom functions by modifying this variable
export CHEATBUFFER_FUNC_ORDER='_cheatbuffer_help _cheatbuffer_cheat'
# key bind to activate cheatbuffer, defaults to ctrl + h
export CHEATBUFFER_KEY_SEQ='^h'You can run these lines to make the minibuffer to show the man page:
# for docs on how to write a custom function, look inside cheatbuffer.plugin.zsh
man_example() {
local BUFFER="$1"
# man prints the help text to stderr
OUTPUT=$(eval "man $BUFFER") 2>&1
echo "$OUTPUT"
}
export CHEATBUFFER_FUNC_ORDER='man_example _cheatbuffer_help _cheatbuffer_cheat'
And when you press ctrl + h (or whatever CHEATBUFFER_KEY_SEQ is set to), it will display the man page instead.
You can find documentation on widgets here.
- cycling through multiple help commands (or aggregating multiple help commands?)
