Files
nvim-config/lua/plugins/dadbod.lua

63 lines
1.5 KiB
Lua

-- Database integration with vim-dadbod
-- Supports PostgreSQL, MySQL, SQLite, and more
return {
-- Core dadbod plugin
{
"tpope/vim-dadbod",
cmd = { "DB", "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" },
},
-- UI for dadbod
{
"kristijanhusak/vim-dadbod-ui",
cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" },
dependencies = {
{ "tpope/vim-dadbod", lazy = true },
{ "kristijanhusak/vim-dadbod-completion", ft = { 'sql', 'mysql', 'plsql' }, lazy = true },
},
init = function()
-- UI configuration
vim.g.db_ui_use_nerd_fonts = 1
vim.g.db_ui_show_database_icon = 1
vim.g.db_ui_force_echo_notifications = 1
-- Save location for connections
vim.g.db_ui_save_location = vim.fn.stdpath("data") .. "/db_ui"
-- Execute on save
vim.g.db_ui_execute_on_save = 0
-- Icons
vim.g.db_ui_icons = {
expanded = "",
collapsed = "",
saved_query = "*",
new_query = "+",
tables = "~",
buffers = "»",
connection_ok = "",
connection_error = "",
}
end,
},
-- Completion
{
'saghen/blink.cmp',
opts = {
sources = {
default = { "lsp", "path", "snippets", "buffer" },
per_filetype = {
sql = { 'snippets', 'dadbod', 'buffer' },
},
-- add vim-dadbod-completion to your completion providers
providers = {
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink"}
}
}
}
}
}