From 27f4a6016dc7200a640bc8833cd0e11eabcfdea3 Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Sun, 9 Jun 2024 19:04:01 +0700 Subject: [PATCH 1/7] fix: onedark vertical line color --- lazy-lock.json | 4 ++-- lua/plugins/themes/onedarkpro.lua | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index ae0abd1..32531d8 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -11,7 +11,6 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" }, "codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" }, - "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, "friendly-snippets": { "branch": "main", "commit": "e11b09bf10706bb74e16e4c3d11b2274d62e687f" }, "gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" }, @@ -37,11 +36,12 @@ "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "c1e1e24b6433d4539bad9f5daa207df39633071b" }, + "nvim-treesitter": { "branch": "master", "commit": "9ebc589329083522f9594f408fc2652090b41139" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, + "onedarkpro.nvim": { "branch": "main", "commit": "ec07364f3cfa9cc6467bf067a490cfd74011efcd" }, "playground": { "branch": "master", "commit": "bcfab84f98a33f2ad34dda6c842046dca70aabf6" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, 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, From ba64a3073cc6b55cf50e3cdac20e4becac72410d Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Mon, 10 Jun 2024 19:44:20 +0700 Subject: [PATCH 2/7] add: DBUI config example --- db_ui/connections.json | 1 + lazy-lock.json | 10 +++--- lua/custom/plugins/database.lua | 54 +++++++++++++++++++++++++++++ lua/plugins/bufferline.lua | 7 ++++ lua/plugins/themes/dracula.lua | 1 + lua/user/utils/lualine_template.lua | 2 ++ 6 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 db_ui/connections.json create mode 100644 lua/custom/plugins/database.lua 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/lazy-lock.json b/lazy-lock.json index 32531d8..1af6f99 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -11,8 +11,9 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" }, "codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" }, + "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, - "friendly-snippets": { "branch": "main", "commit": "e11b09bf10706bb74e16e4c3d11b2274d62e687f" }, + "friendly-snippets": { "branch": "main", "commit": "700c4a25caacbb4648c9a27972c2fe203948e0c2" }, "gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" }, "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, "lazy.nvim": { "branch": "main", "commit": "fafe1f7c640aed75e70a10e6649612cd96f39149" }, @@ -36,18 +37,17 @@ "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "9ebc589329083522f9594f408fc2652090b41139" }, + "nvim-treesitter": { "branch": "master", "commit": "b47dde81a0a4b9b62e9a73a71ff0df2202323dd9" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, - "onedarkpro.nvim": { "branch": "main", "commit": "ec07364f3cfa9cc6467bf067a490cfd74011efcd" }, "playground": { "branch": "master", "commit": "bcfab84f98a33f2ad34dda6c842046dca70aabf6" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, "smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" }, - "telescope.nvim": { "branch": "master", "commit": "3a743491e5c6be0ed0aa8c31c6905df8f66179ba" }, - "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "13f9391c2bf43df5224924667bdb66cedea37484" }, + "telescope.nvim": { "branch": "master", "commit": "f12b15e1b3a33524eb06a1ae7bc852fb1fd92197" }, + "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "f3f136fd82eded0bd1e1870cf7dfab7e8c36801e" }, "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, diff --git a/lua/custom/plugins/database.lua b/lua/custom/plugins/database.lua new file mode 100644 index 0000000..8423b15 --- /dev/null +++ b/lua/custom/plugins/database.lua @@ -0,0 +1,54 @@ +return { + -- { + -- "tpope/vim-dadbod", + -- dependencies = { + -- "kristijanhusak/vim-dadbod-ui", + -- "kristijanhusak/vim-dadbod-completion", + -- }, + -- keys = { + -- { "du", ":DBUIToggle", desc = "Toggle DB UI" }, + -- { "db", ":DBUIFindBuffer", desc = "DB Find buffer" }, + -- { + -- "dr", + -- ":DBUIRenameBuffer", + -- desc = "DB Rename buffer", + -- }, + -- { "dl", ":DBUILastQueryInfo", desc = "DB Last query" }, + -- }, + -- 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", + -- }, + -- }, +} 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/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/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) From 51bea4df6d9748b15d0a82c1255002bac992d847 Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Mon, 10 Jun 2024 20:19:27 +0700 Subject: [PATCH 3/7] add: custem ui database management --- lua/custom/plugins/database.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lua/custom/plugins/database.lua b/lua/custom/plugins/database.lua index 8423b15..5371303 100644 --- a/lua/custom/plugins/database.lua +++ b/lua/custom/plugins/database.lua @@ -21,7 +21,39 @@ return { -- sources = { { name = "vim-dadbod-completion" } }, -- } -- end + -- vim.g.db_ui_show_database_icon = 1 + -- vim.g.db_ui_use_nerd_fonts = 1 + -- vim.g.db_ui_show_help = 0 + -- local expanded_icon = "▾" + -- local collapsed_icon = "▸" -- + -- vim.g.db_ui_icons = { + -- expanded = { + -- db = expanded_icon .. " 󰆼", + -- buffers = expanded_icon .. " ", + -- saved_queries = expanded_icon .. " ", + -- schemas = expanded_icon .. " ", + -- schema = expanded_icon .. " 󰙅", + -- tables = expanded_icon .. " 󰓱", + -- table = expanded_icon .. " ", + -- }, + -- collapsed = { + -- db = collapsed_icon .. " 󰆼", + -- buffers = collapsed_icon .. " ", + -- saved_queries = collapsed_icon .. " ", + -- schemas = collapsed_icon .. " ", + -- schema = collapsed_icon .. " 󰙅", + -- tables = collapsed_icon .. " 󰓱", + -- table = collapsed_icon .. " ", + -- }, + -- saved_query = " ", + -- new_query = " 󰓰", + -- tables = " 󰓫", + -- buffers = " ", + -- add_connection = " 󰆺", + -- connection_ok = "✓", + -- connection_error = "✕", + -- } -- vim.g.db_ui_save_location = vim.fn.stdpath "config" .. require("plenary.path").path.sep .. "db_ui" -- -- vim.api.nvim_create_autocmd("FileType", { From b5cc229ee8ddedc35acc52d00566f3aa3d10839d Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Mon, 10 Jun 2024 22:30:10 +0700 Subject: [PATCH 4/7] add: eagle config example --- lazy-lock.json | 2 +- lua/custom/plugins/eagle.lua | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 lua/custom/plugins/eagle.lua diff --git a/lazy-lock.json b/lazy-lock.json index 1af6f99..76a4556 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -37,7 +37,7 @@ "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "b47dde81a0a4b9b62e9a73a71ff0df2202323dd9" }, + "nvim-treesitter": { "branch": "master", "commit": "3b5704440f88ecc98fb5afb5378b95acd4b2fa7f" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, 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, +} From 75a484306ba176a5264bfc0e17c64ca9f22126ed Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Tue, 11 Jun 2024 11:52:18 +0700 Subject: [PATCH 5/7] fix: codeium new version --- lazy-lock.json | 6 +++--- lua/plugins/codeium.lua | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 76a4556..521a74a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -10,7 +10,7 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" }, - "codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" }, + "codeium.vim": { "branch": "main", "commit": "decfb541c9fd176f467991dcde8923c7db362e02" }, "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, "friendly-snippets": { "branch": "main", "commit": "700c4a25caacbb4648c9a27972c2fe203948e0c2" }, @@ -37,9 +37,9 @@ "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "3b5704440f88ecc98fb5afb5378b95acd4b2fa7f" }, + "nvim-treesitter": { "branch": "master", "commit": "9a7ad2ff7a7ea81016aca2fc89c9b2c1a5365421" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" }, + "nvim-ts-autotag": { "branch": "main", "commit": "2692808eca8a4ac3311516a1c4a14bb97ecc6482" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, "playground": { "branch": "master", "commit": "bcfab84f98a33f2ad34dda6c842046dca70aabf6" }, 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() From 17f2ffe48be698f24ef9a4e1b9e24abe24c8fac4 Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Tue, 11 Jun 2024 16:35:50 +0700 Subject: [PATCH 6/7] add: example config database ui --- lazy-lock.json | 2 +- lua/custom/plugins/database.lua | 121 +++++++++++--------------------- 2 files changed, 42 insertions(+), 81 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 521a74a..29bb773 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -10,7 +10,7 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" }, - "codeium.vim": { "branch": "main", "commit": "decfb541c9fd176f467991dcde8923c7db362e02" }, + "codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" }, "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, "friendly-snippets": { "branch": "main", "commit": "700c4a25caacbb4648c9a27972c2fe203948e0c2" }, diff --git a/lua/custom/plugins/database.lua b/lua/custom/plugins/database.lua index 5371303..e83e3ac 100644 --- a/lua/custom/plugins/database.lua +++ b/lua/custom/plugins/database.lua @@ -1,86 +1,47 @@ return { - -- { - -- "tpope/vim-dadbod", - -- dependencies = { - -- "kristijanhusak/vim-dadbod-ui", - -- "kristijanhusak/vim-dadbod-completion", - -- }, - -- keys = { - -- { "du", ":DBUIToggle", desc = "Toggle DB UI" }, - -- { "db", ":DBUIFindBuffer", desc = "DB Find buffer" }, - -- { - -- "dr", - -- ":DBUIRenameBuffer", - -- desc = "DB Rename buffer", - -- }, - -- { "dl", ":DBUILastQueryInfo", desc = "DB Last query" }, - -- }, - -- config = function() - -- local function db_completion() - -- require("cmp").setup.buffer { - -- sources = { { name = "vim-dadbod-completion" } }, - -- } - -- end - -- vim.g.db_ui_show_database_icon = 1 - -- vim.g.db_ui_use_nerd_fonts = 1 - -- vim.g.db_ui_show_help = 0 - -- local expanded_icon = "▾" - -- local collapsed_icon = "▸" - -- - -- vim.g.db_ui_icons = { - -- expanded = { - -- db = expanded_icon .. " 󰆼", - -- buffers = expanded_icon .. " ", - -- saved_queries = expanded_icon .. " ", - -- schemas = expanded_icon .. " ", - -- schema = expanded_icon .. " 󰙅", - -- tables = expanded_icon .. " 󰓱", - -- table = expanded_icon .. " ", - -- }, - -- collapsed = { - -- db = collapsed_icon .. " 󰆼", - -- buffers = collapsed_icon .. " ", - -- saved_queries = collapsed_icon .. " ", - -- schemas = collapsed_icon .. " ", - -- schema = collapsed_icon .. " 󰙅", - -- tables = collapsed_icon .. " 󰓱", - -- table = collapsed_icon .. " ", - -- }, - -- saved_query = " ", - -- new_query = " 󰓰", - -- tables = " 󰓫", - -- buffers = " ", - -- add_connection = " 󰆺", - -- connection_ok = "✓", - -- connection_error = "✕", + -- "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" } }, -- } - -- vim.g.db_ui_save_location = vim.fn.stdpath "config" .. require("plenary.path").path.sep .. "db_ui" + -- 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", + -- }, + -- 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", - -- }, + -- 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", -- }, } From 9dbcd4b7559c297a2db2f83c705bcbc8c9fe7d62 Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Wed, 12 Jun 2024 18:38:25 +0700 Subject: [PATCH 7/7] add: config for database management --- lazy-lock.json | 12 ++++-- lua/custom/default.lua | 2 + lua/custom/plugins/database.lua | 47 ----------------------- lua/custom/plugins/filebrowser.lua | 60 ++++++++++++++++++++++++++++++ lua/custom/plugins/refactoring.lua | 40 ++++++++++++++++++++ lua/plugins/database.lua | 52 ++++++++++++++++++++++++++ lua/plugins/notify.lua | 58 ++++++++++++++--------------- lua/user/colorscheme.lua | 6 +-- lua/user/utils/whichkey.lua | 23 ++++++++++++ 9 files changed, 218 insertions(+), 82 deletions(-) delete mode 100644 lua/custom/plugins/database.lua create mode 100644 lua/custom/plugins/filebrowser.lua create mode 100644 lua/custom/plugins/refactoring.lua create mode 100644 lua/plugins/database.lua diff --git a/lazy-lock.json b/lazy-lock.json index 29bb773..f3b8fc2 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -15,6 +15,7 @@ "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, "friendly-snippets": { "branch": "main", "commit": "700c4a25caacbb4648c9a27972c2fe203948e0c2" }, "gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" }, + "inc-rename.nvim": { "branch": "main", "commit": "535b508c0cb14d00c1836ad901b3c531cb1152bb" }, "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, "lazy.nvim": { "branch": "main", "commit": "fafe1f7c640aed75e70a10e6649612cd96f39149" }, "lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" }, @@ -24,7 +25,7 @@ "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, "mini.indentscope": { "branch": "main", "commit": "f0d7faa064c892b96997810afcddfadc3f2a15b3" }, "neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" }, - "noice.nvim": { "branch": "main", "commit": "29c7f030b0920e2f17263a9ab8742cde144b9140" }, + "noice.nvim": { "branch": "main", "commit": "b828b575805f1b303c2f4b768744609835140739" }, "none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" }, "none-ls.nvim": { "branch": "main", "commit": "8691504118b252d64fc5023a104aedd100ab754a" }, "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, @@ -37,18 +38,23 @@ "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "9a7ad2ff7a7ea81016aca2fc89c9b2c1a5365421" }, + "nvim-treesitter": { "branch": "master", "commit": "26171d8f105d97746371d1b6c07c8d88bf13fec2" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "2692808eca8a4ac3311516a1c4a14bb97ecc6482" }, + "nvim-ts-autotag": { "branch": "main", "commit": "06fe07d7523ba8c755fac7c913fceba43b1720ee" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, "playground": { "branch": "master", "commit": "bcfab84f98a33f2ad34dda6c842046dca70aabf6" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, + "refactoring.nvim": { "branch": "master", "commit": "d2786877c91aa409c824f27b4ce8a9f560dda60a" }, "smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "a7ab9a957b17199183388c6f357d614fcaa508e5" }, "telescope.nvim": { "branch": "master", "commit": "f12b15e1b3a33524eb06a1ae7bc852fb1fd92197" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "f3f136fd82eded0bd1e1870cf7dfab7e8c36801e" }, "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, + "vim-dadbod": { "branch": "master", "commit": "6f8b99868fd5560d6eb47f82ca76ec62e3d5ae78" }, + "vim-dadbod-completion": { "branch": "master", "commit": "5d5ad196fcde223509d7dabbade0148f7884c5e3" }, + "vim-dadbod-ui": { "branch": "master", "commit": "0dc68d9225a70d42f8645049482e090c1a8dce25" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, "vim-visual-multi": { "branch": "master", "commit": "b84a6d42c1c10678928b0bf8327f378c8bc8af5a" }, 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/database.lua b/lua/custom/plugins/database.lua deleted file mode 100644 index e83e3ac..0000000 --- a/lua/custom/plugins/database.lua +++ /dev/null @@ -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", - -- }, -} 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/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/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/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" }, }