mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-28 03:30:05 +02:00
add: config for database management
This commit is contained in:
parent
17f2ffe48b
commit
9dbcd4b755
9 changed files with 218 additions and 82 deletions
|
@ -133,3 +133,5 @@ vim.g.pcode_columnline = true
|
|||
---| "center" # retain the default telescope theme
|
||||
vim.g.pcode_telescope_theme_find_file = "center"
|
||||
vim.g.pcode_telescope_theme_live_grep = "dropdown"
|
||||
-- https://github.com/kristijanhusak/vim-dadbod-ui
|
||||
vim.g.pcode_database = true
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
return {
|
||||
-- "kristijanhusak/vim-dadbod-ui",
|
||||
-- dependencies = {
|
||||
-- { "tpope/vim-dadbod", lazy = true },
|
||||
-- { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
|
||||
-- },
|
||||
-- init = function()
|
||||
-- -- Your DBUI configuration
|
||||
-- vim.g.db_ui_show_database_icon = 1
|
||||
-- vim.g.db_ui_use_nerd_fonts = 1
|
||||
-- vim.g.db_ui_show_help = 0
|
||||
-- end,
|
||||
-- config = function()
|
||||
-- local function db_completion()
|
||||
-- require("cmp").setup.buffer {
|
||||
-- sources = { { name = "vim-dadbod-completion" } },
|
||||
-- }
|
||||
-- end
|
||||
-- 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(db_completion)
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
-- cmd = {
|
||||
-- "DBUIToggle",
|
||||
-- "DBUI",
|
||||
-- "DBUIAddConnection",
|
||||
-- "DBUIFindBuffer",
|
||||
-- "DBUIRenameBuffer",
|
||||
-- "DBUILastQueryInfo",
|
||||
-- },
|
||||
}
|
60
lua/custom/plugins/filebrowser.lua
Normal file
60
lua/custom/plugins/filebrowser.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
return {
|
||||
-- "nvim-telescope/telescope-file-browser.nvim",
|
||||
-- dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "sf",
|
||||
-- function()
|
||||
-- local telescope = require "telescope"
|
||||
--
|
||||
-- local function telescope_buffer_dir()
|
||||
-- return vim.fn.expand "%:p:h"
|
||||
-- end
|
||||
--
|
||||
-- telescope.extensions.file_browser.file_browser {
|
||||
-- path = "%:p:h",
|
||||
-- cwd = telescope_buffer_dir(),
|
||||
-- respect_gitignore = false,
|
||||
-- hidden = true,
|
||||
-- grouped = true,
|
||||
-- previewer = false,
|
||||
-- initial_mode = "insert",
|
||||
-- layout_config = { height = 40 },
|
||||
-- }
|
||||
-- end,
|
||||
-- desc = "Open File Browser with the path of the current buffer",
|
||||
-- },
|
||||
-- },
|
||||
-- config = function(_, opts)
|
||||
-- local telescope = require "telescope"
|
||||
-- local actions = require "telescope.actions"
|
||||
-- local fb_actions = require("telescope").extensions.file_browser.actions
|
||||
-- opts.extensions = {
|
||||
-- file_browser = {
|
||||
-- theme = "dropdown",
|
||||
-- -- disables netrw and use telescope-file-browser in its place
|
||||
-- hijack_netrw = true,
|
||||
-- mappings = {
|
||||
-- -- your custom insert mode mappings
|
||||
-- ["n"] = {
|
||||
-- -- your custom normal mode mappings
|
||||
-- ["N"] = fb_actions.create,
|
||||
-- ["h"] = fb_actions.goto_parent_dir,
|
||||
-- ["<C-u>"] = function(prompt_bufnr)
|
||||
-- for i = 1, 10 do
|
||||
-- actions.move_selection_previous(prompt_bufnr)
|
||||
-- end
|
||||
-- end,
|
||||
-- ["<C-d>"] = function(prompt_bufnr)
|
||||
-- for i = 1, 10 do
|
||||
-- actions.move_selection_next(prompt_bufnr)
|
||||
-- end
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
-- telescope.setup(opts)
|
||||
-- require("telescope").load_extension "file_browser"
|
||||
-- end,
|
||||
}
|
40
lua/custom/plugins/refactoring.lua
Normal file
40
lua/custom/plugins/refactoring.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
return {
|
||||
-- Incremental rename
|
||||
-- {
|
||||
-- "smjonas/inc-rename.nvim",
|
||||
-- cmd = "IncRename",
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>un",
|
||||
-- function()
|
||||
-- return ":IncRename " .. vim.fn.expand "<cword>"
|
||||
-- end,
|
||||
-- desc = "Incremental rename",
|
||||
-- mode = "n",
|
||||
-- noremap = true,
|
||||
-- expr = true,
|
||||
-- },
|
||||
-- },
|
||||
-- config = true,
|
||||
-- },
|
||||
--
|
||||
-- -- Refactoring tool
|
||||
-- {
|
||||
-- "ThePrimeagen/refactoring.nvim",
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>r",
|
||||
-- function()
|
||||
-- require("refactoring").select_refactor {
|
||||
-- show_success_message = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- mode = "v",
|
||||
-- noremap = true,
|
||||
-- silent = true,
|
||||
-- expr = false,
|
||||
-- },
|
||||
-- },
|
||||
-- opts = {},
|
||||
-- },
|
||||
}
|
52
lua/plugins/database.lua
Normal file
52
lua/plugins/database.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
local M = {}
|
||||
if vim.g.pcode_database then
|
||||
return {
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
dependencies = {
|
||||
{ "tpope/vim-dadbod", lazy = true },
|
||||
{ "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
|
||||
},
|
||||
init = function()
|
||||
-- Your DBUI configuration
|
||||
vim.g.db_ui_show_database_icon = 1
|
||||
vim.g.db_ui_use_nerd_fonts = 1
|
||||
vim.g.db_ui_show_help = 0
|
||||
end,
|
||||
config = function()
|
||||
local function db_completion()
|
||||
require("cmp").setup.buffer {
|
||||
sources = { { name = "vim-dadbod-completion" } },
|
||||
}
|
||||
end
|
||||
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(db_completion)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
cmd = {
|
||||
"DBUIToggle",
|
||||
"DBUI",
|
||||
"DBUIAddConnection",
|
||||
"DBUIFindBuffer",
|
||||
"DBUIRenameBuffer",
|
||||
"DBUILastQueryInfo",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,31 +1,31 @@
|
|||
return {
|
||||
"rcarriga/nvim-notify",
|
||||
lazy = true,
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{
|
||||
"<leader>un",
|
||||
function()
|
||||
require("notify").dismiss({ silent = true, pending = true })
|
||||
end,
|
||||
desc = "Delete all Notifications",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
timeout = 3000,
|
||||
max_height = function()
|
||||
return math.floor(vim.o.lines * 0.75)
|
||||
end,
|
||||
max_width = function()
|
||||
return math.floor(vim.o.columns * 0.75)
|
||||
end,
|
||||
},
|
||||
-- event = "BufWinEnter",
|
||||
config = function()
|
||||
local notify = require("notify")
|
||||
-- this for transparency
|
||||
notify.setup({ background_colour = "#000000" })
|
||||
-- this overwrites the vim notify function
|
||||
vim.notify = notify.notify
|
||||
end,
|
||||
"rcarriga/nvim-notify",
|
||||
lazy = true,
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{
|
||||
"<leader>un",
|
||||
function()
|
||||
require("notify").dismiss { silent = true, pending = true }
|
||||
end,
|
||||
desc = "Delete all Notifications",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
timeout = 3000,
|
||||
max_height = function()
|
||||
return math.floor(vim.o.lines * 0.75)
|
||||
end,
|
||||
max_width = function()
|
||||
return math.floor(vim.o.columns * 0.75)
|
||||
end,
|
||||
},
|
||||
-- event = "BufWinEnter",
|
||||
config = function()
|
||||
local notify = require "notify"
|
||||
-- this for transparency
|
||||
notify.setup { background_colour = "#000000", render = "compact" }
|
||||
-- this overwrites the vim notify function
|
||||
vim.notify = notify.notify
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ elseif substring(tostring(colorscheme), "material") then
|
|||
colorscheme = "material"
|
||||
end
|
||||
|
||||
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
|
||||
if not status_ok then
|
||||
return
|
||||
local ok, _ = pcall(vim.cmd.colorscheme, colorscheme)
|
||||
if not ok then
|
||||
require "notify"("Colorscheme '" .. colorscheme .. "' not found!", "error")
|
||||
end
|
||||
|
|
|
@ -282,6 +282,29 @@ if vim.g.pcode_codeium then
|
|||
table.insert(M.mappings, { ["c"] = { ":call codeium#Chat()<cr>", " Codeium Chat" } })
|
||||
end
|
||||
|
||||
if vim.g.pcode_database then
|
||||
table.insert(M.mappings, {
|
||||
["D"] = {
|
||||
name = " DBUI",
|
||||
d = { "<cmd>NvimTreeClose<cr><cmd>tabnew<cr><bar><bar><cmd>DBUI<cr>", " DBUI Toggle" },
|
||||
q = {
|
||||
"<cmd>DBUIClose<cr><cmd>BufferLineCloseOthers<cr><cmd>bd!<cr><cmd>lua require('user.utils.bufferline').bufremove()<cr><cmd>Alpha<cr>",
|
||||
" DBUI Close",
|
||||
},
|
||||
},
|
||||
})
|
||||
-- table.insert(
|
||||
-- M.mappings,
|
||||
-- { ["D"] = { "<cmd>NvimTreeClose<cr><cmd>tabnew<cr><bar><bar><cmd>DBUI<cr>", " DBUI Toggle" } }
|
||||
-- )
|
||||
-- table.insert(M.mappings, {
|
||||
-- ["x"] = {
|
||||
-- "<cmd>DBUIClose<cr><cmd>lua require('user.utils.bufferline').bufremove()<cr><cmd>Alpha<cr>",
|
||||
-- " DBUI Toggle",
|
||||
-- },
|
||||
-- })
|
||||
end
|
||||
|
||||
M.mappings2 = {
|
||||
["/"] = { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", " Commet Block" },
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue