Vim/Neovim — Managing Databases

Managing databases and running SQL statements, all within Vim/Neovim.

alpha2phi

--

Photo by Caspar Camille Rubin on Unsplash

Overview

In my previous article, I walked through with you how to manage multiple projects within Vim/Neovim. In this article let’s extend this to see how to manage multiple databases.

Setup

I am going to use PostgreSQL and MySQL as examples. For this to work, on the client machine you will need to install the database clients.

Other databases are also supported. More on this later.

If you want to use Docker for MySQL and PostgreSQL for testing, you can refer to this docker-compose.yml file.

You can find the initialization SQL and .env files from this repository.

Plugins

I am going to leverage the Lua-based dotfiles I developed in my previous article. However, the plugins should work for both Vim and Neovim.

Under lua/plugins.lua, install these 2 plugins.

-- Database
use { 'tpope/vim-dadbod' }…

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.