return { "tpope/vim-dadbod", dependencies = { "kristijanhusak/vim-dadbod-ui", "kristijanhusak/vim-dadbod-completion", }, opts = { db_competion = function() ---@diagnostic disable-next-line require("cmp").setup.buffer({ sources = { { name = "vim-dadbod-completion" } } }) end, }, config = function(_, opts) 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(opts.db_completion) end, }) end, init = function() require("utils.remaps").map_virtual({ { "D", group = "database", icon = { icon = " ", hl = "Constant" } }, { "Dt", group = "toggle dadbod", icon = { icon = " ", hl = "Constant" } }, { "Df", group = "find buffer", icon = { icon = " ", hl = "Constant" } }, { "Dr", group = "rename buffer", icon = { icon = "󰑕 ", hl = "Constant" } }, { "Dq", group = "last query", icon = { icon = " ", hl = "Constant" } }, }) end, keys = { { "Dt", "DBUIToggle", desc = "toggle ui" }, { "Df", "DBUIFindBuffer", desc = "find buffer" }, { "Dr", "DBUIRenameBuffer", desc = "rename buffer" }, { "Dq", "DBUILastQueryInfo", desc = "last query " }, }, }