docs · sqsh
$ sqsh --docs

docs_

Configuration reference and key bindings for sqsh.

Configuration

Full reference for every key supported in config.toml, followed by three complete example configurations. See the README for how to create and locate the config file.

[settings] — Application settings (optional)

KeyTypeDefaultDescription
languagestring"en"Display language: "en" or "ja"

[settings.layout] — Input area heights and result preview pane (optional)

Controls the height (in terminal rows) of each input area on the connected screen, and the size/position of the preview pane in the result viewer. Omitted keys fall back to their defaults.

KeyTypeDefaultDescription
sql_input_heightinteger5Height of the SQL input area
shell_input_heightinteger5Height of the Shell input area
prompt_input_heightinteger5Height of the PROMPT input area (only shown when an Anthropic API key is configured)
result_preview_widthinteger30Size (in percent) of the preview pane in the result viewer — width when result_preview_position is "left"/"right", height when it is "up"/"down"
result_preview_positionstring"right"Position of the preview pane: "up", "down", "left", or "right"
[settings.layout]
sql_input_height = 10
shell_input_height = 5
prompt_input_height = 5
result_preview_width = 30
result_preview_position = "right"

Note: these keys must be placed under the [settings.layout] section, not directly under [settings] — misplaced keys are silently ignored. An invalid result_preview_position value (anything other than "up", "down", "left", or "right") causes a configuration error at startup.

[[connections]] — Connection entry (one or more required)

KeyTypeDefaultDescription
namestringConnection name (required)
bastionsee belowomittedBastion configuration
readonlyboolfalsePrevent write operations when true

bastion field behavior

ValueEffect
Omitted or falseDirect connection (no bastion)
trueUse [default_bastion] settings
[connections.bastion] tableUse per-connection bastion settings

[connections.bastion] — Per-connection bastion settings

KeyTypeDefaultDescription
hoststringBastion server hostname or IP (required)
portinteger22SSH port
userstringSSH username (required)
key_pathstringPath to SSH private key; omit to use SSH agent

[connections.mysql] — MySQL settings

KeyTypeDefaultDescription
hoststringMySQL hostname or IP (required)
portinteger3306MySQL port
databasestringDatabase name (required)
userstringMySQL username (required)
passwordstringMySQL password (required)
timeoutinteger30Connection timeout in seconds
ssl_modestring"required"TLS/SSL mode: "required", "preferred", or "disabled"

[connections.mysql.pool] — Connection pool settings (optional)

KeyTypeDefaultDescription
max_connectionsinteger10Maximum number of connections
idle_timeoutinteger300Idle connection timeout in seconds

[default_bastion] — Shared bastion settings (optional)

Applied to all connections with bastion = true. Fields are the same as [connections.bastion].

[default_mysql_pool] — Shared pool settings (optional)

Applied to all connections that do not specify their own pool settings. Per-connection settings take precedence. Fields are the same as [connections.mysql.pool].

Example 1: Direct connection (local development)

[[connections]]
name = "local-dev"

[connections.mysql]
host = "localhost"
port = 3306
database = "your_database"
user = "root"
password = "your_password"
ssl_mode = "disabled"  # acceptable for local development

Example 2: Shared bastion (production environments)

Use [default_bastion] when multiple connections share the same bastion server.

[default_bastion]
host = "bastion.example.com"
port = 22
user = "your_ssh_user"
# Omit key_path to use your SSH agent (e.g., 1Password SSH agent)

[default_mysql_pool]
max_connections = 20
idle_timeout = 600

[[connections]]
name = "production"
bastion = true  # uses [default_bastion]

[connections.mysql]
host = "mysql.internal.example.com"
port = 3306
database = "production_db"
user = "app_user"
password = "secure_password"
timeout = 60
ssl_mode = "required"

[[connections]]
name = "staging"
bastion = true  # uses [default_bastion]
readonly = true

[connections.mysql]
host = "mysql-staging.internal.example.com"
port = 3306
database = "staging_db"
user = "app_user"
password = "staging_password"
ssl_mode = "preferred"

Example 3: Per-connection bastion

Use [connections.bastion] when each connection has a different bastion server.

[[connections]]
name = "region-a"

[connections.bastion]
host = "bastion-a.example.com"
port = 22
user = "your_ssh_user"
key_path = "~/.ssh/id_rsa"

[connections.mysql]
host = "mysql-a.internal.example.com"
port = 3306
database = "db_a"
user = "app_user"
password = "password_a"
ssl_mode = "required"

[[connections]]
name = "region-b"

[connections.bastion]
host = "bastion-b.example.com"
port = 2222
user = "your_ssh_user"
key_path = "~/.ssh/id_ed25519"

[connections.mysql]
host = "mysql-b.internal.example.com"
port = 3306
database = "db_b"
user = "app_user"
password = "password_b"
ssl_mode = "required"

See config.example.toml in the repository for a complete annotated example.

Key Bindings

Connection Selection

Connection selection is handled by skim (Rust-native fzf). Standard fzf key bindings apply.

KeyAction
Type to filterIncremental search
Up / DownMove cursor
EnterSelect connection
ESC / Ctrl+CCancel / quit

SQL Input

SQL input is handled directly by sqsh. Press Tab to switch focus between SQL Input and Shell Input.

Execution and Completion

KeyAction
EnterExecute SQL
TabSwitch focus to Shell Input (when completion popup is closed)
Tab / DownNext completion candidate (when completion popup is open)
Shift+Tab / UpPrevious completion candidate
Ctrl+DExecute SHOW DATABASES
Ctrl+TExecute SHOW TABLES
Ctrl+SColumn selection mode (table → column picker)

Editing

KeyAction
Ctrl+ASelect all
Ctrl+CCopy selection / quit (no selection)
Ctrl+JInsert newline (multi-line SQL)
Ctrl+VPaste from clipboard
Ctrl+XCut selection
Ctrl+KDelete from cursor to end of line
Ctrl+UDelete from start of line to cursor
Ctrl+WDelete previous word
Ctrl+YPaste from kill buffer
Ctrl+EMove cursor to end of line
Home / EndMove cursor to start / end of line
Alt+← / Alt+→Move cursor one word left / right
Shift+← / Shift+→Extend selection left / right
Alt+Shift+← / Alt+Shift+→Extend selection one word left / right

Navigation and Other

KeyAction
Up / DownNavigate SQL history
ESCClear input / close completion popup
q (empty input)Quit

Shell Input

Shell Input allows running shell commands without leaving sqsh. Press Tab to switch focus from SQL Input.

When connected via a bastion server, commands execute on the bastion host. For direct connections, commands execute locally.

KeyAction
EnterExecute command
Ctrl+JInsert newline (multi-line command)
TabSwitch focus to SQL Input
Up / DownNavigate shell history
Ctrl+A / HomeMove cursor to start
Ctrl+E / EndMove cursor to end
Ctrl+KDelete from cursor to end
Ctrl+UDelete from start to cursor
Ctrl+WDelete previous word
Alt+← / Alt+→Move cursor one word left / right
ESCClear input
Ctrl+CQuit

Result Viewer

Result display is handled by skim (Rust-native fzf). Standard fzf key bindings apply.

KeyAction
Type to filterIncremental search
Up / DownScroll through results
EnterSelect record (generates WHERE template)
ESC / Ctrl+CReturn to SQL input