dotfiles/config/.config/nvim/lua/config/dadbod.lua
2024-09-05 19:14:30 -04:00

30 lines
602 B
Lua

local M = {}
local function db_completion()
require("cmp").setup.buffer { sources = { { name = "vim-dadbod-completion" } } }
end
function M.setup()
vim.g.db_ui_save_location = vim.fn.stdpath "config" .. require("plenary.path").path.sep .. "db_ui"
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"sql",
},
command = [[setlocal omnifunc=vim_dadbod_completion#omni]],
})
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"sql",
"mysql",
"plsql",
},
callback = function()
vim.schedule(db_completion)
end,
})
end
return M