diff --git a/db_ui/connections.json b/db_ui/connections.json new file mode 100644 index 0000000..cc1021f --- /dev/null +++ b/db_ui/connections.json @@ -0,0 +1 @@ +[{"url": "mysql://root@127.0.0.1/example", "name": "example"}] diff --git a/lua/custom/default.lua b/lua/custom/default.lua index 0e36729..fbd66f7 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -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 diff --git a/lua/custom/plugins/eagle.lua b/lua/custom/plugins/eagle.lua new file mode 100644 index 0000000..197b87b --- /dev/null +++ b/lua/custom/plugins/eagle.lua @@ -0,0 +1,16 @@ +return { + -- "soulis-1256/eagle.nvim", + -- event = "BufRead", + -- config = function() + -- require("eagle").setup() + -- vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter", "WinEnter" }, { + -- pattern = "*", + -- callback = function() + -- -- Aktifkan mousemoveevent untuk semua buffer kecuali NvimTree + -- if vim.fn.win_gettype() ~= "NvimTree" then + -- vim.o.mousemoveevent = true + -- end + -- end, + -- }) + -- end, +} diff --git a/lua/custom/plugins/filebrowser.lua b/lua/custom/plugins/filebrowser.lua new file mode 100644 index 0000000..e494f25 --- /dev/null +++ b/lua/custom/plugins/filebrowser.lua @@ -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, + -- [""] = function(prompt_bufnr) + -- for i = 1, 10 do + -- actions.move_selection_previous(prompt_bufnr) + -- end + -- end, + -- [""] = 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, +} diff --git a/lua/custom/plugins/refactoring.lua b/lua/custom/plugins/refactoring.lua new file mode 100644 index 0000000..5eb54cb --- /dev/null +++ b/lua/custom/plugins/refactoring.lua @@ -0,0 +1,40 @@ +return { + -- Incremental rename + -- { + -- "smjonas/inc-rename.nvim", + -- cmd = "IncRename", + -- keys = { + -- { + -- "un", + -- function() + -- return ":IncRename " .. vim.fn.expand "" + -- end, + -- desc = "Incremental rename", + -- mode = "n", + -- noremap = true, + -- expr = true, + -- }, + -- }, + -- config = true, + -- }, + -- + -- -- Refactoring tool + -- { + -- "ThePrimeagen/refactoring.nvim", + -- keys = { + -- { + -- "r", + -- function() + -- require("refactoring").select_refactor { + -- show_success_message = true, + -- } + -- end, + -- mode = "v", + -- noremap = true, + -- silent = true, + -- expr = false, + -- }, + -- }, + -- opts = {}, + -- }, +} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua index 87fe90d..65ede75 100644 --- a/lua/plugins/bufferline.lua +++ b/lua/plugins/bufferline.lua @@ -81,6 +81,13 @@ return { text_align = "left", padding = 1, }, + { + filetype = "dbui", + text = "", + highlight = "Directory", + text_align = "left", + padding = 1, + }, }, show_buffer_icons = true, show_buffer_close_icons = true, diff --git a/lua/plugins/codeium.lua b/lua/plugins/codeium.lua index 17c398e..3ae1a6a 100644 --- a/lua/plugins/codeium.lua +++ b/lua/plugins/codeium.lua @@ -3,7 +3,9 @@ if vim.g.pcode_codeium then M.codeium = { "Exafunction/codeium.vim", enabled = true, - version = "1.8.37", + -- for fix notwork new version + -- https://github.com/Exafunction/codeium.vim/issues/376#issuecomment-2159643405 + -- version = "1.8.37", event = "BufWinEnter", -- event = "InsertEnter", config = function() diff --git a/lua/plugins/database.lua b/lua/plugins/database.lua new file mode 100644 index 0000000..b7562c7 --- /dev/null +++ b/lua/plugins/database.lua @@ -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 diff --git a/lua/plugins/notify.lua b/lua/plugins/notify.lua index 6677b57..2dfeeb1 100644 --- a/lua/plugins/notify.lua +++ b/lua/plugins/notify.lua @@ -1,31 +1,31 @@ return { - "rcarriga/nvim-notify", - lazy = true, - event = "VeryLazy", - keys = { - { - "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 = { + { + "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, } diff --git a/lua/plugins/themes/dracula.lua b/lua/plugins/themes/dracula.lua index 8294ac9..dd62dfd 100644 --- a/lua/plugins/themes/dracula.lua +++ b/lua/plugins/themes/dracula.lua @@ -20,6 +20,7 @@ if (color == "dracula") and true or false then ["@keyword"] = { fg = colors.pink, italic = true }, ["@keyword.function"] = { fg = colors.cyan, italic = true }, ["@function"] = { fg = colors.green, italic = true }, + ["@tag.attribute"] = { fg = colors.green, italic = true }, ["@tag.builtin.javascript"] = { fg = colors.pink }, ["@tag.delimiter.javascript"] = { fg = colors.fg }, ["@type.javascript"] = { fg = colors.fg }, diff --git a/lua/plugins/themes/onedarkpro.lua b/lua/plugins/themes/onedarkpro.lua index b53aaf4..38c3f70 100644 --- a/lua/plugins/themes/onedarkpro.lua +++ b/lua/plugins/themes/onedarkpro.lua @@ -118,6 +118,7 @@ if substring(tostring(color), "onedark") and true or false then Normal = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, NormalNC = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, FloatBorder = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, + NonText = { bg = "NONE", fg = "#3E4450" }, }, } end, diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index 68091a2..8d4ac4e 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -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 diff --git a/lua/user/utils/lualine_template.lua b/lua/user/utils/lualine_template.lua index 51e06ac..d0b94a4 100644 --- a/lua/user/utils/lualine_template.lua +++ b/lua/user/utils/lualine_template.lua @@ -29,6 +29,8 @@ M.filetype = { "startuptime", "crunner", "lspinfo", + "mysql", + "dbui", } M.rounded = function(colorscheme) diff --git a/lua/user/utils/whichkey.lua b/lua/user/utils/whichkey.lua index 9ec37b4..b1b3414 100644 --- a/lua/user/utils/whichkey.lua +++ b/lua/user/utils/whichkey.lua @@ -282,6 +282,29 @@ if vim.g.pcode_codeium then table.insert(M.mappings, { ["c"] = { ":call codeium#Chat()", "󰭹 Codeium Chat" } }) end +if vim.g.pcode_database then + table.insert(M.mappings, { + ["D"] = { + name = " 󰆼 DBUI", + d = { "NvimTreeClosetabnewDBUI", "󰆼 DBUI Toggle" }, + q = { + "DBUICloseBufferLineCloseOthersbd!lua require('user.utils.bufferline').bufremove()Alpha", + "󰅙 DBUI Close", + }, + }, + }) + -- table.insert( + -- M.mappings, + -- { ["D"] = { "NvimTreeClosetabnewDBUI", "󰆼 DBUI Toggle" } } + -- ) + -- table.insert(M.mappings, { + -- ["x"] = { + -- "DBUICloselua require('user.utils.bufferline').bufremove()Alpha", + -- "󰆼 DBUI Toggle", + -- }, + -- }) +end + M.mappings2 = { ["/"] = { "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", " 󰆈 Commet Block" }, }