vi-sql logo

Getting Started

Install

See the Installation page for all install options, version pinning, and build-from-source instructions.

First launch

On the first run — whether via vi-sql or vi-sql --connect — the options page opens so you can configure general settings and UI preferences. Each option includes a description in the right-hand panel, for more details visit Configuration page. Once saved, you can proceed to connecting to a database.

Connect to a database

A connection URI can be either added via Connection Form that can be opened directly from the connection list page or passed directly on the command line:

sh
vi-sql --connect postgres://user:password@localhost:5432/mydb
vi-sql --connect file:/home/user/data.db
# or add it with name that you like, name can be used later as reference
vi-sql --connect dev=postgres://user:password@localhost:5432/mydb
vi-sql --connect prod=mysql://user:password@prod.com/mydb

The driver is detected automatically from the URI scheme. You can also fill in individual fields (host, port, user, password, database) in the connection form, or connect to a saved connection by name:

sh
vi-sql --connection-name mydb

Run vi-sql --help to see all available flags.

Remote databases over SSH

vi-sql has no built-in SSH tunneling — it doesn't need one. Forward the remote database to a local port with plain ssh, then connect to localhost:

sh
# Forward the remote Postgres (on the gateway's network) to localhost:5433
ssh -L 5433:db-host:5432 user@gateway
 
# In another terminal, point vi-sql at the local end of the tunnel
vi-sql --connect postgres://user:password@localhost:5433/mydb

The tunnel stays up as long as the ssh process runs. Add -N to open the forward without a remote shell, and -f to push it into the background.

tip

This works for any backend — swap the ports and URI scheme (MySQL 3306, SQL Server 1433, etc.). Because the database driver only ever sees localhost, no vi-sql config changes are needed.

Basic navigation

Once connected, vi-sql opens the schema browser on the left and a query editor on the right.

tip

Open the help page via F1 or the command palette via Ctrl+Space to explore all available actions.

Some other useful keybindings:

NormalVimAction
Alt+↑/↓/←/→Ctrl+k/j/h/lSwitch panels
kMove up
jMove down
Enter/SpaceEnter/SpaceOpen table from list
Ctrl+sCtrl+sExecute query
Ctrl+Space:Open actions palette
Ctrl+oCtrl+oOpen connections
Ctrl+cCtrl+cQuit

See the Keybindings page for the full default key map, or Vim Mode for the vim profile.