Skip to main content
ansicode

HTS — Horizontal Tab Set (ESC H)

Set a tab stop at the current cursor column — partner to TBC.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1bH
\\033[\033H
\\e[\eH
ESC [ESC H
hex1b 48

Description

Two-byte ESC `H` sequence (no CSI introducer, no parameters). Places a tab stop at whichever column the cursor occupies right now. Pair with TBC (`\x1b[g` / `\x1b[3g`) which clears tab stops. Workflow: `printf '\033[3g'` to wipe the default 8-column grid, move the cursor to each desired column with HPA / CHA (`\x1b[Nd` / `\x1b[NG`) and emit `\x1bH` once per stop. After that, every `\t` (HT, 0x09) or `\x1b[NI` (CHT) advances to your custom layout. The terminfo capability for HTS is `hts`.

Spec citation: ECMA-48 §8.3.62 (HTS)

Examples

bash
printf '\033[3g'                # clear all\nprintf '\033[10G\033H\033[20G\033H'   # set tab stops at cols 10 and 20
python
import sys; sys.stdout.write('\x1bH')
go
fmt.Print("\x1bH")
javascript
process.stdout.write('\x1bH')
c
printf("\x1bH");

Terminal support

xterm
yes
Linux console (fbcon)
yes
macOS Terminal.app
yes
iTerm2
yes
Windows Terminal
yes
cmd.exe / ConPTY
partial
kitty
yes
alacritty
yes
WezTerm
yes
Ghostty
yes
GNOME Terminal
yes
Konsole
yes
tmux
no
GNU screen
no

Related sequences

In the family cookbook

ESC cookbook · 2. Tab stops — `\x1bH` (HTS) sets, `\x1b[g` (TBC) clears