vi-sql logo

Configuration

vi-sql stores all configuration in ~/.config/vi-sql/config.yaml. The file is created with defaults on first launch. Run vi-sql --paths to print the exact path on your system.

Full example

yaml
log:
  path: /tmp/vi-sql.log
  level: info
  prettyPrint: true
 
editor:
  env: EDITOR
  command: ""
  enabled: false
 
ui:
  vimMode: false
  mouse: true
  schemaPanelWidth: 30
 
styles:
  currentStyle: default.yaml
  nerdFont: true
 
mcp:
  enabled: false
  port: 9741
  allowRead: false
  allowWrite: false
 
security:
  method: keyring
 
showConnectionPage: true
currentConnection: mydb
 
connections:
  - name: mydb
    driver: postgres
    host: localhost
    port: 5432
    database: mydb
    username: user
    password: ""
    sslMode: disable
    timeout: 30
    options:
      alwaysConfirmActions: true
      limit: 1000

log

FieldDefaultDescription
path/tmp/vi-sql.logPath to the log file
levelinfoLog level: trace, debug, info, warn, error
prettyPrinttrueHuman-readable log output

editor

External editor integration for the terminal SQL editor (Ctrl+e).

FieldDefaultDescription
envEDITOREnvironment variable to read the editor command from
commandEditor command to use directly (takes precedence over env)
enabledfalseEnable $EDITOR integration; built-in editor is always available

ui

FieldDefaultDescription
vimModefalseUse vim-style keybindings (hjkl, gg, dd, yy). See Vim Mode
mousetrueEnable mouse support
schemaPanelWidth30Width of the schema tree panel in columns

styles

FieldDefaultDescription
currentStyledefault.yamlTheme file name from ~/.config/vi-sql/styles/. See Themes
nerdFonttrueUse Nerd Font icons. Set to false if your terminal font lacks them

mcp

FieldDefaultDescription
enabledfalseStart the MCP HTTP server when vi-sql connects to a database
port9741Port the MCP server listens on (127.0.0.1:<port>)
allowReadfalsePermit AI tools to run SELECT / EXPLAIN queries
allowWritefalsePermit AI tools to run INSERT / UPDATE / DELETE / DDL (also requires allowRead: true)

See MCP Server for setup instructions.


security

Controls how connection passwords are encrypted at rest.

FieldDefaultDescription
methodkeyringEncryption method — see below

Methods

MethodDescription
keyringOS secret service (GNOME Keyring, macOS Keychain, Windows Credential Manager). The key is generated automatically and never stored on disk in plaintext.
masterDerive an encryption key from a passphrase via Argon2id. You are prompted for the passphrase on every launch.
envRead the key from the VI_SQL_SECRET_KEY environment variable. Useful for scripts and CI.
offPasswords stored in plaintext in config.yaml. A warning is shown for each affected connection.

The keyringService and keyringAccount fields under security can be set to override the default keyring entry names, but are normally left unset.

To generate a random key for env mode:

sh
vi-sql --gen-key

To reset a forgotten master password (clears all master-encrypted passwords):

sh
vi-sql --reset-master-password

connections

A list of saved database connection profiles.

FieldDescription
nameDisplay name — used in the connection picker and with --connection-name
driverpostgres (default), mysql, mariadb, cockroachdb, or sqlite
dsnFull connection string. If set, individual fields below are ignored. A value starting with $ is expanded as an environment variable (e.g. $DATABASE_URL)
hostDatabase hostname or IP
portDatabase port
databaseDatabase name
usernameUsername
passwordPassword — encrypted at rest according to security.method
sslModeSSL mode (postgres: disable/require/verify-ca/verify-full; mysql/mariadb: true/false)
timeoutConnection timeout in seconds
options.alwaysConfirmActionsPrompt before executing deletes and updates (default true)
options.limitDefault row limit for table queries

Environment variable DSN

If your connection string is in an environment variable, set dsn to the variable reference:

yaml
connections:
  - name: prod
    driver: postgres
    dsn: $DATABASE_URL

Other top-level fields

FieldDefaultDescription
showConnectionPagetrueOpen the connection picker on launch instead of reconnecting to currentConnection
currentConnectionName of the last-used connection