Variable: ghostel-prompt-regexp
ghostel-prompt-regexp is a customizable variable defined in
ghostel.el.
Value
"^[^#$%>λ❯→➜\n]\\{0,60\\}[#$%>λ❯→➜]+[ ]*"
Documentation
Regexp matching a prompt prefix at the beginning of a line.
Consulted as a fallback by ghostel-input-start-point and
ghostel-beginning-of-input-or-line when the row has no
ghostel-prompt text property (i.e. no OSC 133 shell integration).
The default recognizes:
- Standard shell prompts: $ , # , % , >
- Python and similar REPLs: >>>
- Themed prompts: λ , ❯ (Starship/Pure/Powerlevel10k),
➜ (oh-my-zsh robbyrussell), →
- Prompts padded with a no-break space (U+00A0) instead of a
plain space, e.g. Claude Code's >
The negated character class [^#$%>λ❯→➜\n]\{0,60\} forces the match to
stop at the *first* prompt character on the line, so command lines echoed into
scrollback (e.g. $ echo $foo) are detected by their leading prompt prefix
rather than a $ deeper in the line. The \{0,60\} bound caps that prefix
at 60 columns: a prompt character only counts near the start of a line, so
a stray %/# deep in command output (e.g. the % in a 100% progress line)
is treated as output, not a prompt.
Trade-off: any line that *starts* with one of these characters is
treated as a prompt line. Diff output (> excluded), markdown
headings (# Heading), and lines like 5 > 3 will yield false
positives for column-aware motions. OSC 133 integration is the
robust fix - see the README's shell-integration section.
Customize this variable to add or replace prompt characters for
prompts the default doesn't catch (e.g., ▶ , » , 🦀 ). Set
to nil to disable the regex fallback entirely (OSC 133 only).
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defcustom ghostel-prompt-regexp
"^[^#$%>λ❯→➜\n]\\{0,60\\}[#$%>λ❯→➜]+[ \u00a0]*"
"Regexp matching a prompt prefix at the beginning of a line.
Consulted as a fallback by `ghostel-input-start-point' and
`ghostel-beginning-of-input-or-line' when the row has no
`ghostel-prompt' text property (i.e. no OSC 133 shell integration).
The default recognizes:
- Standard shell prompts: `$ ', `# ', `% ', `> '
- Python and similar REPLs: `>>> '
- Themed prompts: `λ ', `❯ ' (Starship/Pure/Powerlevel10k),
`➜ ' (oh-my-zsh robbyrussell), `→ '
- Prompts padded with a no-break space (U+00A0) instead of a
plain space, e.g. Claude Code's `> '
The negated character class `[^#$%>λ❯→➜\\n]\\{0,60\\}' forces the match to
stop at the *first* prompt character on the line, so command lines echoed into
scrollback (e.g. `$ echo $foo') are detected by their leading prompt prefix
rather than a `$' deeper in the line. The `\\{0,60\\}' bound caps that prefix
at 60 columns: a prompt character only counts near the start of a line, so
a stray `%'/`#' deep in command output (e.g. the `%' in a `100%' progress line)
is treated as output, not a prompt.
Trade-off: any line that *starts* with one of these characters is
treated as a prompt line. Diff output (`> excluded'), markdown
headings (`# Heading'), and lines like `5 > 3' will yield false
positives for column-aware motions. OSC 133 integration is the
robust fix - see the README's shell-integration section.
Customize this variable to add or replace prompt characters for
prompts the default doesn't catch (e.g., `▶ ', `» ', `🦀 '). Set
to nil to disable the regex fallback entirely (OSC 133 only)."
:type '(choice (const :tag "Disable" nil)
(regexp :tag "Regexp")))