FISH-TERMINAL-COMPATIBILITY(1)
ππ FISH-TERMINAL-COMPATIBILITY(1) ππ
okay so bestie, this is FISH-TERMINAL-COMPATIBILITY(1) from fish-shell, and itβs literally the vibe check for your terminal. fish writes various control sequences to the terminal. Some must be implemented to enable basic functionality, while others enable optional features and may be ignored by the terminal. no cap.
Your terminal must be able to parse Control Sequence Introducer (CSI) commands, Operating System Commands (OSC) and optionally Device Control Strings (DCS). These are defined by ECMA-48. If a valid CSI, OSC or DCS sequence does not represent a command implemented by the terminal, the terminal must ignore it. periodt.
Control sequences are denoted in a fish-like syntax. Special characters other than \ are not escaped. Spaces are only added for readability and are not part of the sequence. Placeholders are written as Ps for a number or Pt for an arbitrary printable string.
π NOTE: fish does not rely on your system's terminfo database. In this document, terminfo (TI) codes are included for reference only. iykyk.
β¨ REQUIRED COMMANDS β¨
these are the non-negotiables, bestie β basic functionality is giving main character energy only if your terminal has these. π
\rβ TI:n/aβ move cursor to the beginning of the line.\nβ TI:cud1β move cursor down one line.\e[ Ps Aβ TI:cuuβ move cursor upPscolumns, or one column if no parameter.\e[ Ps Cβ TI:cufβ move cursor to the rightPscolumns, or one column if no parameter.\x08β TI:cub1β move cursor one column to the left.\e[ Ps Dβ TI:cubβ move cursor to the leftPstimes.\e[Hβ TI:cupβ set cursor position (no parameters means: move to row 1, column 1).\e[Kβ TI:elβ clear to end of line.\e[Jβ TI:edβ clear to the end of screen.\e[2Jβ TI:clearβ clear the screen.\e[0cβ TI: (blank) β request Primary Device Attribute. The terminal must respond with a CSI command that starts with the?parameter byte (so a sequence starting with\e[?) and hascas final byte. Failure to implement this will cause a brief pause at startup followed by a warning. For the time being, both can be turned off by turning off thequery-terminalfeature flag<#featureflags>. πn/aβ TI:amβ soft wrap text at screen width.n/aβ TI:xenlβ printing to the last column does not move the cursor to the next line. Verify this by runningprintf %0"$COLUMNS"d 0; sleep 3.
π OPTIONAL COMMANDS π
these are the optional feature flexes, bestie β your terminal may ignore them, but when it ate, it ate. π
\tβ TI:itβ move the cursor to the next tab stop (every 8 columns). This is mainly relevant if your prompt includes tabs.\e[mβ TI:sgr0β turn off bold/dim/italic/underline/strikethrough/reverse attribute modes and select default colors.\e[1mβ TI:boldβ enter bold mode.\e[2mβ TI:dimβ enter dim mode.\e[3mβ TI:sitmβ enter italic mode.\e[4mβ TI:smulβ enter underline mode.\e[4:2mβ TI:Suβ enter double underline mode.\e[4:3mβ TI:Suβ enter curly underline mode.\e[4:4mβSuβ enter dotted underline mode β¨\e[4:5mβSuβ enter dashed underline mode, because apparently one kind of underline was never gonna be enough π\e[7mβrevβ enter reverse video mode (it literally swaps your foreground and background colors, the icon of a glow-up) π\e[9mβsmxxβ enter strikethrough mode\e[23mβritmβ exit italic mode\e[24mβrmulβ exit underline mode\e[29mβrmxxβ exit strikethrough mode\e[38;5; Ps mβsetafβ select foreground color Ps from the 256-color-palette π¨\e[48;5; Ps mβsetabβ select background color Ps from the 256-color-palette\e[58:5: Ps m(note: colons not semicolons π« ) βSuβ select underline color Ps from the 256-color-palette. yes bestie, the underline gets its own color now, we're so back\e[ Ps mβsetafsetabβ select foreground/background color. This one uses a color in the aforementioned 256-color-palette, based on the range that contains the parameter:30-37maps to foreground0-7,40-47maps to background0-7,90-97maps to foreground8-15and100-107maps to background8-15. retro-coded but it slays\e[38;2; Ps ; Ps ; Ps mβ no terminfo cap listed β select foreground color from 24-bit RGB colors π\e[48;2; Ps ; Ps ; Ps mβ no terminfo cap listed β select background color from 24-bit RGB colors\e[39mβ no terminfo cap listed β reset the foreground color back to whatever the terminal's default is, we're going home π\e[49mβ no terminfo cap listed β reset the background color back to the terminal's default\e[58:2:: Ps : Ps : Ps m(note: colons not semicolons, again, iykyk) βSuβ select underline color from 24-bit RGB colors\e[59mβSuβ reset the underline color to the default (which means it follows the foreground color) π«Ά\e[ Ps Sβindnβ scroll up the content (not the viewport!) Ps lines. this one is called SCROLL UP / SU by ECMA-48 and "scroll forward" by terminfo, she's got range π. When fish detects support for this feature,status test-terminal-features scroll-content-upwill return0, which enables the ctrl+l binding to use thescrollback-pushspecial input function. lowkey the fanciest thing on this whole page\e[= Ps u,\e[? Ps uβn/aβ enable the kitty keyboard protocol β¨οΈπ\e[6nβn/aβ request a cursor position report. the response must be of the form\e[ Ps ; Ps Rwhere the first parameter is the row number and the second parameter is the column number. both start at1(not zero, we're not animals). This is used for truncating multiline autosuggestions at the screen's bottom edge, by thescrollback-pushspecial input function, and inside terminals that implement theOSC 133click_eventsfeature π\e[ \x20 qβSeβ reset the cursor style to the terminal's default. This is not used as of today but may be in future, so consider it a coming-soon teaser β\e[ Ps \x20 qβSsβ set cursor style (DECSCUSR); Ps is2,4or6for block, underscore or line shape. pick your fighter π\e[ Ps qβ terminfo:n/aβ asking the terminal for its name and version (XTVERSION β¨). Fr fr this one is only for temporary workarounds when a terminal is being incompatible, okay? iykyk.\e[?25hβ terminfo:cvvisβ cursor visibility: on DECTCEM. your girl is back π\e[?1004hβ terminfo:n/aβ enable focus reporting. π\e[?1004lβ terminfo:n/aβ disable focus reporting. no more watching me π\e[?1049hβ terminfo:n/aβ enable the alternate screen buffer. main character energy β whole new screen, who dis.\e[?1049lβ terminfo:n/aβ disable the alternate screen buffer. back to reality π\e[?2004hβ terminfo: (blank) β enable bracketed paste. π\e[?2004lβ terminfo: (blank) β disable bracketed paste.\e[?2031hβ terminfo: (blank) β enable unsolicited color theme reporting (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/). the way this works is: once it's on, the terminal should send\e[?997;1nor\e[?997;2nwhenever its color theme changes. and that? that's what prompts fish to go query for the background color. lowkey genius π¦\e[?2031lβ terminfo: (blank) β disable unsolicited color theme reporting. ok bestie we get it, no more theme updates π\e]0; Pt \e\\β terminfo:tsβ set the terminal window title (OSC 0). this is the one used infish_titleπ«Ά\e]1; Pt \e\\β terminfo:tsβ set the terminal tab title (OSC 1). yep, tabs get their own. used infish_tab_titleβ¨\e]7;file:// Pt / Pt \e\\β terminfo: (blank) β report the working directory (OSC 7). important detail: since the terminal might be running on a different system than a (remote) shell, that hostname (the first parameter) will not belocalhost. no cap, don't assume π§\e]8;; Pt \e\\β terminfo: (blank) β create a hyperlink (OSC 8) β https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. this is literally what fish's man pages use for links π\e]11;?\e\\β terminfo:n/aβ query the background color. π
a valid response would be of the form \e]11;rgb: Pt / Pt / Pt \e\\ or \e]11;rgba: Pt / Pt / Pt / Pt\e\\, where the first three parameters each consist of one to four hex digits, representing red, blue and green components. (yes that's the order the page says β red, blue and green. not me questioning it, just reporting it π)
this is used to populate the fish_terminal_color_theme environment variable (fish_terminal_color_theme), which in turn is used to select a theme variant (fish-config-theme-files) optimized for the terminal's color theme. so the whole vibe matches, periodt π
\e]52;c; Pt \e\\β terminfo: (blank) β copy to clipboard (OSC 52). used byfish_clipboard_copyπ\e]133;A;click_events=1\e\\β terminfo: (blank) β mark the prompt start (OSC 133), with kitty'sclick_eventsextension. what does theclick_eventsextension even do? it enables mouse clicks to move the cursor or select pager items β assuming cursor position reporting is available. key caveat bestie, don't forget the assumption β\e]133;B\e\\β terminfo: (blank) β mark the prompt end (OSC 133). that's a wrap on the prompt π\e]133;C;cmdline_url= Pt \e\\β terminfo: (blank) β mark the command start (OSC 133), with kitty'scmdline_urlextension, whose parameter is the URL-encoded command line. yes, URL-encoded. encode it π₯\e]133;D; Ps \e\\β terminfo: (blank) β mark the command end (OSC 133).Pshere is the exit status β so that's how the terminal knows if your command ate or flopped π\eP+q Pt \e\\β this is the "hey bestie, what's your terminfo say?" request (XTGETTCAP). The parameter you send is the capability's hex-encoded terminfo code. π
The terminal has to clap back in one of two shapes: \eP1+q Pt \e\\ (that's the "boolean" form) or \eP1+q Pt = Pt \e\\ (that's the "string" form). Either way, the first parameter in the reply must match the parameter you sent. No substitutions, no cap. π«Ά
fish goes shopping for these string capabilities:
indn- the response's second parameter is ignored. literally just vibes, we don't read it. π
query-os-name(forstatus terminal-os<#status-terminal-os>)- terminals running on Unix should respond with the hex encoding of
$(uname -s)as the second parameter. that's the whole assignment, bestie. β¨
- terminals running on Unix should respond with the hex encoding of
π₯οΈ DCS COMMANDS AND GNU SCREEN
okay so this is the part where things get a lil spicy. πΆοΈ
DCS parsing is optional β why? because fish temporarily switches to the alternate screen before printing any DCS commands. cute, right? except. π
GNU screen doesn't allow turning on the alternate screen buffer by default, and it doesn't treat DCS commands in a compatible way either. so fish's initial prompt may get straight-up garbled by a DCS payload like +q696e646e. not the aesthetic we were going for. π
For the time being, fish works around this by checking for the presence of the STY environment variable. If that doesn't work for some reason, you can add this to your ~/.screenrc:
altscreen on
Or add this to your config.fish:
function GNU-screen-workaround --on-event fish_prompt
commandline -f repaint
functions --erase GNU-screen-workaround
end
either one, pick your fighter. π₯
π€ UNICODE CODEPOINTS
By default, fish outputs the following non-ASCII characters:
Γ βΊ ΒΆ β β’ β β¦ ΞΌ β β β β
as well as control pictures (U+2400 through U+241F), and locale-specific ones in translated messages <#variables-locale>. π
so yeah, if you ever wondered why your terminal is serving looks β that's the character set doing it. π
π Author
fish-shell developers
(icons. legends. the main characters.)
Β© Copyright
fish-shell developers
and that's a wrap on the whole page, bestie!! π that was FISH-TERMINAL-COMPATIBILITY(1) from fish 4.9, dated Sep 08, 2026 β go forth and have a terminal that actually behaves, ily, bye πβ¨π¦
π¦ where this page comes from
- arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms