Shell Integration

CheatMD can be embedded into your shell, tmux, or Zellij for instant access.

Shell widget (Bash / Zsh)

The widget inserts CheatMD into your shell’s readline, so the chosen command lands directly on your prompt line.

Setup

# Bash - add to ~/.bashrc
eval "$(cheatmd widget bash)"

# Zsh - add to ~/.zshrc
eval "$(cheatmd widget zsh)"

Usage

Press Ctrl+G (default) to open the selector. Pick a cheat, resolve its variables, and the final command is inserted into your current prompt. Press Enter to run it.

Customizing the trigger key

Set key_widget in your config to any readline keyspec:

key_widget: "\C-g"     # Ctrl+G (default)
key_widget: "\C-n"     # Ctrl+N
key_widget: "\e[24~"   # F12

tmux

Open CheatMD in a split pane; the chosen command is pasted into the previous pane.

Add to ~/.tmux.conf:

bind-key -n C-n split-window "$SHELL --login -i -c 'cheatmd --print | tr -d "\r\n" | tmux load-buffer -b tmp - ; tmux paste-buffer -t {last} -b tmp -d'"

Press Ctrl+N to open. The command is pasted into the pane you came from.

Zellij

Open CheatMD in a floating pane; the chosen command is typed into the previous pane.

Add to your Zellij config:

bind "Ctrl n" {
    Run "sh" "-c" "content=$(cheatmd --print); zellij action toggle-floating-panes; zellij action write-chars "$content"" {
        floating true
        close_on_exit true
    };
}

Press Ctrl+N to open in a floating pane.

Output modes

The integrations above use --print mode (or output: print in config). The three modes:

ModeBehavior
printPrint command to stdout (for piping/capture)
copyCopy to system clipboard
execExecute immediately in the configured shell

Set globally in config or per-invocation with --output:

cheatmd --output exec      # Run immediately
cheatmd --output copy      # Copy to clipboard