diff --git a/lua/lazyvim/plugins/extras/util/database.lua b/lua/lazyvim/plugins/extras/util/database.lua index 131b16e5..293397a7 100644 --- a/lua/lazyvim/plugins/extras/util/database.lua +++ b/lua/lazyvim/plugins/extras/util/database.lua @@ -6,18 +6,15 @@ return { vim.opt.laststatus = 3 vim.opt.splitkeep = "screen" end, - opts = { - right = { - { - ft = "dbui", - pinned = true, - open = "DBUI", - }, - }, - options = { - right = { size = 40 }, - }, - }, + opts = function(_, opts) + table.insert(opts.right, { + title = "Database", + ft = "dbui", + pinned = true, + open = "DBUI", + size = { width = 0.25 }, + }) + end, }, { @@ -27,21 +24,23 @@ return { { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, }, cmd = { - "DBUI", "DBUIToggle", "DBUIAddConnection", - "DBUIFindBuffer", }, init = function() local wk = require("which-key") - local wkopts = function(keymaps, description) - return { keymaps, description, noremap = true, silent = true } + local dbtoggle = function() + if _G.LazyVim.is_loaded("vim-dadbod-ui") then + return { "DBUIToggle", "Database Explorer", silent = true } + else + return { "Lazy load vim-dadbod-ui | DBUIToggle", "Database Explorer", silent = true } + end end wk.register({ uD = { name = "Database UI", - e = wkopts("DBUI", "Database Explorer"), - a = wkopts("DBUIAddConnection", "Add Database Connection"), + e = dbtoggle(), + a = { "DBUIAddConnection", "Add Database Connection", silent = true }, }, }, { prefix = "" }) vim.g.db_ui_use_nerd_fonts = 1