Vim and Neovim

Vim and Neovim are free and open-source text editor programs that are designed to be highly customizable and extensible. These editors have rich plugin ecosystems, allowing users to customize their editors to do all kinds of things–from source code analysis, to debugging, to (you guessed it!) database interaction.

Connecting to bit.io with Vim or Neovim

In order to connect to bit.io with Vim/Neovim, you'll need to first install the vim-dadbod plugin, which facilitates interaction with many different types of databases. You can install the plugin via Vim's builtin package support, or using a third-party package manager. For example, using the vim-plug package manager, you can add the following to your .vimrc:

call plug#begin()

" ... other plugins
Plug 'tpope/vim-dadbod'

call plug#end()

then install using the :PlugInstall command.

Once the vim-dadbod plugin is installed, you'll need to find your PosgreSQL connection credentials from the bit.io Connect Tab of the database to which you would like to connect. You can find everything you need to know about your PostgreSQL credentials here.

Copy the database's connection string, then within Vim or Neovim simply run the command:

:DB <your-connection-string>

to open an interactive psql shell. You can also run queries directly using the same :DB command and simply writing your query after the connection string. For example:

:DB <your-connection-string> SELECT 'hello from vim :)'

Using bit.io with Vim or Neovim

Once we've set up our connection, we can run queries using the interactive psql shell:

1030