Neovim Database Completion

Configure database completion in Neovim.

alpha2phi
2 min readDec 11, 2021
Neovim Database Completion

This is an updated article on how to configure database completion in Neovim. In the previous articles, I talked about configuring Vim and Neovim to manage databases and setting up database completion using nvim-compe. Since nvim-compe is deprecated, let’s try out nvim-cmp.

Setup

Plugins

  • Using packer.nvim, install vim-dadbod and its related plugins for user interface and completion.
use {
"tpope/vim-dadbod",
requires = {
"kristijanhusak/vim-dadbod-ui",
"kristijanhusak/vim-dadbod-completion"

},
config = function()
require("config.dadbod").setup()
end,
}
  • Create a file called dadbod.lua under lua/config folder with the following content. In this file, I specify the location to save the connection details.
local M = {}function M.setup()
vim.g.db_ui_save_location = "~/.config/nvim/db_ui"
end
return M

Key Mappings

I configure the following key mappings using which-key.nvim.

-- Database
x = {
name = "Database",
u = { "<Cmd>DBUIToggle<Cr>", "Toggle UI" },
f = {…

--

--