diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-24 20:35:27 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-24 20:35:27 +0900 |
| commit | c80a54e42b52ce297f0f2f71af23c562832025c7 (patch) | |
| tree | dcce8bb977a770f473325d48f6f70b21d9818a40 /ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua | |
init
Diffstat (limited to 'ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua new file mode 100644 index 0000000..41adb5a --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/dadbod.lua @@ -0,0 +1,52 @@ +return { + "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() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + local home = vim.fn.expand("~") + vim.g.dbs = { + firefox = "sqlite://" .. home .. "/.mozilla/firefox/si.default/places.sqlite", + mysql = "mariadb://user:password@localhost/mysql", + postsql = "postgresql://postgres:mypassword@localhost:5432/postgresql", + sqlite = "sqlite://" .. home .. "/.local/share/db/sqlite.db", + } + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "<localleader>d", group = "DB" }, + }) + end, + config = function() + local function db_completion() + require("cmp").setup.buffer({ sources = { { name = "vim-dadbod-completion" } } }) + end + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + callback = function() + vim.schedule(db_completion) + end, + }) + end, + keys = { + { "<localleader>du", "<cmd>DBUI<cr>", desc = "DB UI" }, + { "<localleader>dt", "<cmd>DBUIToggle<cr>", desc = "Toggle DB UI" }, + { "<localleader>da", "<cmd>DBUIAddConnection<cr>", desc = "Add connection" }, + { "<localleader>df", "<cmd>DBUIFindBuffer<cr>", desc = "Find buffer" }, + { "<localleader>dr", "<cmd>DBUIRenameBuffer<cr>", desc = "Rename buffer" }, + { "<localleader>di", "<cmd>DBUILastQueryInfo<cr>", desc = "Last query info" }, + }, +} |
