updated configuration
This commit is contained in:
40
lua/plugins/sql.lua
Normal file
40
lua/plugins/sql.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
return {
|
||||
-- vim-dadbod with project-local connections
|
||||
{
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
dependencies = {
|
||||
{ "tpope/vim-dadbod", lazy = true },
|
||||
{ "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
|
||||
},
|
||||
cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" },
|
||||
init = function()
|
||||
vim.g.db_ui_use_nerd_fonts = 1
|
||||
|
||||
-- Use project-local connection file
|
||||
vim.g.db_ui_save_location = vim.fn.getcwd() .. "/.db"
|
||||
|
||||
-- Or look for a dadbod.json in project root
|
||||
vim.g.db_ui_env_variable_url = "DATABASE_URL"
|
||||
vim.g.db_ui_env_variable_name = "DATABASE_NAME"
|
||||
|
||||
-- Auto-load connections from .dadbod.json if it exists
|
||||
local project_db_config = vim.fn.getcwd() .. "/.dadbod.json"
|
||||
if vim.fn.filereadable(project_db_config) == 1 then
|
||||
vim.g.dbs = vim.fn.json_decode(vim.fn.readfile(project_db_config))
|
||||
end
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>D", "<cmd>DBUIToggle<CR>", desc = "Toggle DBUI" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
dependencies = { "kristijanhusak/vim-dadbod-completion" },
|
||||
opts = function(_, opts)
|
||||
opts.sources = opts.sources or {}
|
||||
table.insert(opts.sources, { name = "vim-dadbod-completion" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user