From ef38e66bf96e6cb5f5b8cc96ceaaf6dbdc5dc134 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 5 Nov 2024 16:15:00 +0700 Subject: [PATCH 01/59] fix: disable laravel.nvim if os windows --- lazy-lock.json | 2 -- lua/pcode/plugins/lang/php.lua | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 68ef19d..f50ffcb 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -56,13 +56,11 @@ "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "e0f9b3efe150724af2d2ed59997d5ece373840e3" }, "smart-splits.nvim": { "branch": "master", "commit": "477a004122ea180b14d3e29544857d572c861668" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, - "vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, diff --git a/lua/pcode/plugins/lang/php.lua b/lua/pcode/plugins/lang/php.lua index 46067b1..e2ed934 100644 --- a/lua/pcode/plugins/lang/php.lua +++ b/lua/pcode/plugins/lang/php.lua @@ -199,7 +199,7 @@ return { -- npm install -g tree-sitter-cli { "adalessa/laravel.nvim", - enabled = is_laravel_project(), -- pastikan membuka laravel project + enabled = is_laravel_project() and vim.fn.has("win32") == 0, -- pastikan membuka laravel project version = "v2.2.1", dependencies = { "tpope/vim-dotenv", From d5da617c07b0c87fb98152158c012c53d07db44d Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 5 Nov 2024 16:56:28 +0700 Subject: [PATCH 02/59] fix: move php-cs-fixcer to pretty-php --- lua/pcode/plugins/lang/php.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/pcode/plugins/lang/php.lua b/lua/pcode/plugins/lang/php.lua index e2ed934..0c05cf7 100644 --- a/lua/pcode/plugins/lang/php.lua +++ b/lua/pcode/plugins/lang/php.lua @@ -64,8 +64,8 @@ return { "pojokcodeid/auto-conform.nvim", event = "VeryLazy", opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { "php-cs-fixer", "blade-formatter" }) - opts.formatters_by_ft.php = { "easy-coding-standard" } + vim.list_extend(opts.ensure_installed, { "pretty-php", "blade-formatter" }) + opts.formatters_by_ft.php = { "pretty-php" } opts.formatters_by_ft.blade = { "blade-formatter" } end, }, From e6e7acc2a000bb958165ac704d559fabda11be80 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 5 Nov 2024 22:04:01 +0700 Subject: [PATCH 03/59] enc: trim white space nvim-cmp --- lazy-lock.json | 4 ++-- lua/pcode/plugins/cmp.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index f50ffcb..b6f0575 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -51,13 +51,13 @@ "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "610a1c189bdb2b9b936169b2ea9d1838f971fa2b" }, - "nvim-treesitter": { "branch": "master", "commit": "509d38fee865eefd38eacf17c8920b68cf67b0fd" }, + "nvim-treesitter": { "branch": "master", "commit": "7dc8aabe86db8c2f23520e8334f7584f83e84342" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "e0f9b3efe150724af2d2ed59997d5ece373840e3" }, - "smart-splits.nvim": { "branch": "master", "commit": "477a004122ea180b14d3e29544857d572c861668" }, + "smart-splits.nvim": { "branch": "master", "commit": "11600d75e1b57e9fe1f3ca880a917485fc399e8c" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, diff --git a/lua/pcode/plugins/cmp.lua b/lua/pcode/plugins/cmp.lua index ffcf97e..bb23ff7 100644 --- a/lua/pcode/plugins/cmp.lua +++ b/lua/pcode/plugins/cmp.lua @@ -86,8 +86,8 @@ return { formatting = { fields = { "kind", "abbr", "menu" }, format = function(entry, vim_item) - vim_item.menu = vim.api.nvim_get_mode().mode == "c" and "" or vim_item.kind - vim_item.kind = string.format("%s", require("pcode.user.icons")["kind"][vim_item.kind]) + vim_item.menu = vim.api.nvim_get_mode().mode == "c" and "" or all_trim(vim_item.kind) + vim_item.kind = string.format("%s", all_trim(require("pcode.user.icons")["kind"][vim_item.kind])) -- vim_item.menu = ({ -- nvim_lsp = "(LSP)", -- luasnip = "(Snippet)", From 0ef35939ded18a04710127c0b786162861393db9 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 5 Nov 2024 22:07:16 +0700 Subject: [PATCH 04/59] enc:change keymapping codeium cycle --- lua/pcode/plugins/extras/codeium.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/pcode/plugins/extras/codeium.lua b/lua/pcode/plugins/extras/codeium.lua index 92d5dc2..17e6af2 100644 --- a/lua/pcode/plugins/extras/codeium.lua +++ b/lua/pcode/plugins/extras/codeium.lua @@ -17,10 +17,10 @@ return { vim.keymap.set("i", "", function() return vim.fn["codeium#Accept"]() end, { expr = true, silent = true }) - vim.keymap.set("i", "", function() + vim.keymap.set("i", "", function() return vim.fn["codeium#CycleCompletions"](1) end, { expr = true, silent = true }) - vim.keymap.set("i", "", function() + vim.keymap.set("i", "", function() return vim.fn["codeium#CycleCompletions"](-1) end, { expr = true, silent = true }) vim.keymap.set("i", "", function() From 16c9fa5a36c02293aab425201950eb8b363db0e1 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Wed, 6 Nov 2024 12:22:10 +0700 Subject: [PATCH 05/59] enc: reformat indentat code --- lazy-lock.json | 14 +- lua/pcode/plugins/cmpcmdline.lua | 265 +++++++++--------- lua/pcode/plugins/extras/autosave.lua | 96 +++---- lua/pcode/plugins/extras/bigfiles.lua | 12 +- lua/pcode/plugins/extras/codeiumnvim.lua | 48 ++-- lua/pcode/plugins/extras/colorizer.lua | 46 +-- lua/pcode/plugins/extras/dap.lua | 118 ++++---- lua/pcode/plugins/extras/deviconcolor.lua | 10 +- lua/pcode/plugins/extras/illuminate.lua | 89 ++++-- lua/pcode/plugins/extras/indentscupe.lua | 58 ++-- lua/pcode/plugins/extras/liveserver.lua | 16 +- lua/pcode/plugins/extras/minianimate.lua | 74 ++--- lua/pcode/plugins/extras/navic.lua | 56 ++-- lua/pcode/plugins/extras/neoscroll.lua | 12 +- lua/pcode/plugins/extras/nvimmenu.lua | 58 ++-- lua/pcode/plugins/extras/nvimufo.lua | 176 ++++++------ .../plugins/extras/rainbowdelimiters.lua | 68 ++--- lua/pcode/plugins/extras/refactoring.lua | 60 ++-- lua/pcode/plugins/extras/rest.lua | 46 +-- lua/pcode/plugins/extras/restnvim.lua | 76 ++--- lua/pcode/plugins/extras/scrollview.lua | 22 +- lua/pcode/plugins/extras/smartsplit.lua | 38 +-- lua/pcode/plugins/extras/transparent.lua | 124 ++++---- lua/pcode/plugins/extras/treesittercontex.lua | 16 +- lua/pcode/plugins/extras/verticalcolumn.lua | 50 ++-- lua/pcode/plugins/extras/visualmulti.lua | 30 +- lua/pcode/plugins/extras/yanky.lua | 34 +-- lua/pcode/plugins/extras/zenmode.lua | 39 ++- lua/pcode/user/custom.lua | 254 ++++++++--------- lua/pcode/user/default.lua | 2 +- lua/pcode/user/options.lua | 2 + 31 files changed, 1025 insertions(+), 984 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index b6f0575..4943946 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,7 +2,7 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "568fdba3a2a3088bec2198e7bb8f28d482629e58" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "4bf40748f6fe939bdcb69325918535b1c5edea51" }, + "LuaSnip": { "branch": "master", "commit": "29417eea5b7c4b6beda105ced072855101d9680e" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, @@ -23,6 +23,7 @@ "dressing.nvim": { "branch": "master", "commit": "6ef1ca479d37d4ff66f13eed44d08912caff483a" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, + "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, "laravel.nvim": { "branch": "main", "commit": "e4f39d942352b03396a9df79896b0a8801675199" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, @@ -30,17 +31,17 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "menu": { "branch": "main", "commit": "9269d8ff5775bb1b9b9cad538d1bcd13fa105fe7" }, + "menu": { "branch": "main", "commit": "a12605e89a5da6c63840104a95362e2bb1e9b847" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, - "minty": { "branch": "main", "commit": "6e5c4cfc66e5dbb248ab78293d1c147de0c33a54" }, + "minty": { "branch": "main", "commit": "1ab2b8334cec1770fef096f0a5697bf0c3afb3ca" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" }, - "noice.nvim": { "branch": "main", "commit": "5a78b42bec5e775f2db03bf93f6d1e0f3636306c" }, + "noice.nvim": { "branch": "main", "commit": "d80136061820765baf70ace7dfb98a52575edc4a" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "e614ff5c26d085a3242e26648e90e56ba5476da2" }, - "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "f134063618a65cad4d7415fddbd96ff7e0c5b4ae" }, + "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, @@ -57,6 +58,7 @@ "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "e0f9b3efe150724af2d2ed59997d5ece373840e3" }, + "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "11600d75e1b57e9fe1f3ca880a917485fc399e8c" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, diff --git a/lua/pcode/plugins/cmpcmdline.lua b/lua/pcode/plugins/cmpcmdline.lua index 0e54a02..b36bed8 100644 --- a/lua/pcode/plugins/cmpcmdline.lua +++ b/lua/pcode/plugins/cmpcmdline.lua @@ -1,133 +1,140 @@ return { - { - "folke/noice.nvim", - lazy = true, - enabled = true, - dependencies = { - { "MunifTanjim/nui.nvim" }, - }, - event = "CmdlineEnter", - opts = { - messages = { - enabled = false, - }, - notify = { - enabled = false, - }, - lsp = { - progress = { - enabled = false, - }, - hover = { - enabled = false, - }, - signature = { - enabled = false, - }, - }, - }, - keys = { - { - "", - function() - require("noice").redirect(vim.fn.getcmdline()) - end, - mode = "c", - desc = "Redirect Cmdline", - }, - { - "snl", - function() - require("noice").cmd("last") - end, - desc = "Noice Last Message", - }, - { - "snh", - function() - require("noice").cmd("history") - end, - desc = "Noice History", - }, - { - "sna", - function() - require("noice").cmd("all") - end, - desc = "Noice All", - }, - { - "", - function() - if not require("noice.lsp").scroll(4) then - return "" - end - end, - silent = true, - expr = true, - desc = "Scroll forward", - mode = { "i", "n", "s" }, - }, - { - "", - function() - if not require("noice.lsp").scroll(-4) then - return "" - end - end, - silent = true, - expr = true, - desc = "Scroll backward", - mode = { "i", "n", "s" }, - }, - }, - }, - { - "hrsh7th/cmp-cmdline", - event = "VeryLazy", - config = function() - local cmp = require("cmp") - local mapping = { - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), - } + { + "folke/noice.nvim", + lazy = true, + enabled = true, + dependencies = { + { "MunifTanjim/nui.nvim" }, + }, + event = "CmdlineEnter", + opts = { + messages = { + enabled = false, + }, + notify = { + enabled = false, + }, + lsp = { + progress = { + enabled = false, + }, + hover = { + enabled = false, + }, + signature = { + enabled = false, + }, + }, + presets = { + -- Preset ini menyesuaikan bentuk cursor pada mode commond + command_bar_cursor = { + enabled = true, + cursor_shape = "ver30", -- "ver" menandakan bar vertikal, 30 adalah tinggi dalam persen + }, + }, + }, + keys = { + { + "", + function() + require("noice").redirect(vim.fn.getcmdline()) + end, + mode = "c", + desc = "Redirect Cmdline", + }, + { + "snl", + function() + require("noice").cmd("last") + end, + desc = "Noice Last Message", + }, + { + "snh", + function() + require("noice").cmd("history") + end, + desc = "Noice History", + }, + { + "sna", + function() + require("noice").cmd("all") + end, + desc = "Noice All", + }, + { + "", + function() + if not require("noice.lsp").scroll(4) then + return "" + end + end, + silent = true, + expr = true, + desc = "Scroll forward", + mode = { "i", "n", "s" }, + }, + { + "", + function() + if not require("noice.lsp").scroll(-4) then + return "" + end + end, + silent = true, + expr = true, + desc = "Scroll backward", + mode = { "i", "n", "s" }, + }, + }, + }, + { + "hrsh7th/cmp-cmdline", + event = "VeryLazy", + config = function() + local cmp = require("cmp") + local mapping = { + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), + } - -- Use buffer source for `/`. - cmp.setup.cmdline("/", { - preselect = "none", - completion = { - completeopt = "menu,preview,menuone,noselect", - }, - mapping = mapping, - sources = { - { name = "buffer" }, - }, - experimental = { - ghost_text = true, - native_menu = false, - }, - }) + -- Use buffer source for `/`. + cmp.setup.cmdline("/", { + preselect = "none", + completion = { + completeopt = "menu,preview,menuone,noselect", + }, + mapping = mapping, + sources = { + { name = "buffer" }, + }, + experimental = { + ghost_text = true, + native_menu = false, + }, + }) - -- Use cmdline & path source for ':'. - cmp.setup.cmdline(":", { - preselect = "none", - completion = { - completeopt = "menu,preview,menuone,noselect", - }, - mapping = mapping, - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), - experimental = { - ghost_text = true, - native_menu = false, - }, - }) - end, - }, + -- Use cmdline & path source for ':'. + cmp.setup.cmdline(":", { + preselect = "none", + completion = { + completeopt = "menu,preview,menuone,noselect", + }, + mapping = mapping, + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + experimental = { + ghost_text = true, + native_menu = false, + }, + }) + end, + }, } diff --git a/lua/pcode/plugins/extras/autosave.lua b/lua/pcode/plugins/extras/autosave.lua index 90f3351..cdc58ba 100644 --- a/lua/pcode/plugins/extras/autosave.lua +++ b/lua/pcode/plugins/extras/autosave.lua @@ -1,53 +1,49 @@ return { - "okuuva/auto-save.nvim", - version = "^1.0.0", -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release - cmd = "ASToggle", -- optional for lazy loading on command - event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events - opts = { - enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it) - trigger_events = { -- See :h events - immediate_save = { "BufLeave", "FocusLost" }, -- vim events that trigger an immediate save - defer_save = { "InsertLeave", "TextChanged" }, -- vim events that trigger a deferred save (saves after `debounce_delay`) - cancel_deferred_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save - }, - -- function that takes the buffer handle and determines whether to save the current buffer or not - -- return true: if buffer is ok to be saved - -- return false: if it's not ok to be saved - -- if set to `nil` then no specific condition is applied - condition = nil, - write_all_buffers = false, -- write all buffers when the current one meets `condition` - noautocmd = false, -- do not execute autocmds when saving - lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details - debounce_delay = 1500, -- delay after which a pending save is executed - -- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable - debug = false, - }, - config = function(_, opts) - require("auto-save").setup(opts) - local group = vim.api.nvim_create_augroup("autosave", {}) + "okuuva/auto-save.nvim", + version = "^1.0.0", -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release + cmd = "ASToggle", -- optional for lazy loading on command + event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events + opts = { + enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it) + trigger_events = { -- See :h events + immediate_save = { "BufLeave", "FocusLost" }, -- vim events that trigger an immediate save + defer_save = { "InsertLeave", "TextChanged" }, -- vim events that trigger a deferred save (saves after `debounce_delay`) + cancel_deferred_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save + }, + -- function that takes the buffer handle and determines whether to save the current buffer or not + -- return true: if buffer is ok to be saved + -- return false: if it's not ok to be saved + -- if set to `nil` then no specific condition is applied + condition = nil, + write_all_buffers = false, -- write all buffers when the current one meets `condition` + noautocmd = false, -- do not execute autocmds when saving + lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details + debounce_delay = 1500, -- delay after which a pending save is executed + -- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable + debug = false, + }, + config = function(_, opts) + require("auto-save").setup(opts) + local group = vim.api.nvim_create_augroup("autosave", {}) - vim.api.nvim_create_autocmd("User", { - pattern = "AutoSaveWritePost", - group = group, - callback = function(opts) - local ftype = vim.bo.filetype - if - opts.data.saved_buffer ~= nil - and ftype ~= "TelescopePrompt" - and not substring(tostring(ftype), "dap") - then - local filename = vim.api.nvim_buf_get_name(opts.data.saved_buffer) - local is_ok = pcall(require, "notify") - if is_ok then - require("notify")("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S")) - else - print("AutoSave: saved " .. filename .. " at " .. vim.fn.strftime("%H:%M:%S")) - end - end - end, - }) - end, - keys = { - { "n", ":ASToggle", desc = "󰨚 Toggle auto-save" }, - }, + vim.api.nvim_create_autocmd("User", { + pattern = "AutoSaveWritePost", + group = group, + callback = function(opts) + local ftype = vim.bo.filetype + if opts.data.saved_buffer ~= nil and ftype ~= "TelescopePrompt" and not substring(tostring(ftype), "dap") then + local filename = vim.api.nvim_buf_get_name(opts.data.saved_buffer) + local is_ok = pcall(require, "notify") + if is_ok then + require("notify")("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S")) + else + print("AutoSave: saved " .. filename .. " at " .. vim.fn.strftime("%H:%M:%S")) + end + end + end, + }) + end, + keys = { + { "n", ":ASToggle", desc = "󰨚 Toggle auto-save" }, + }, } diff --git a/lua/pcode/plugins/extras/bigfiles.lua b/lua/pcode/plugins/extras/bigfiles.lua index 042dc1c..52bf3e5 100644 --- a/lua/pcode/plugins/extras/bigfiles.lua +++ b/lua/pcode/plugins/extras/bigfiles.lua @@ -1,8 +1,8 @@ return { - "LunarVim/bigfile.nvim", - lazy = true, - event = "BufReadPre", - opts = { - file_size = 2, - }, + "LunarVim/bigfile.nvim", + lazy = true, + event = "BufReadPre", + opts = { + file_size = 2, + }, } diff --git a/lua/pcode/plugins/extras/codeiumnvim.lua b/lua/pcode/plugins/extras/codeiumnvim.lua index 9877fc8..0070991 100644 --- a/lua/pcode/plugins/extras/codeiumnvim.lua +++ b/lua/pcode/plugins/extras/codeiumnvim.lua @@ -1,26 +1,26 @@ return { - -- codeium cmp source - { - "nvim-cmp", - dependencies = { - -- codeium - { - "Exafunction/codeium.nvim", - cmd = "Codeium", - enabled = false, - build = ":Codeium Auth", - opts = { - enable_chat = true, - }, - }, - }, - --@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "codeium", - group_index = 1, - priority = 100, - }) - end, - }, + -- codeium cmp source + { + "nvim-cmp", + dependencies = { + -- codeium + { + "Exafunction/codeium.nvim", + cmd = "Codeium", + enabled = false, + build = ":Codeium Auth", + opts = { + enable_chat = true, + }, + }, + }, + --@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "codeium", + group_index = 1, + priority = 100, + }) + end, + }, } diff --git a/lua/pcode/plugins/extras/colorizer.lua b/lua/pcode/plugins/extras/colorizer.lua index eacd2b1..850a9e1 100644 --- a/lua/pcode/plugins/extras/colorizer.lua +++ b/lua/pcode/plugins/extras/colorizer.lua @@ -1,25 +1,25 @@ return { - "NvChad/nvim-colorizer.lua", - lazy = true, - event = { "BufRead", "InsertEnter", "BufNewFile" }, - opts = { - user_default_options = { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = true, -- "Name" codes like Blue - RRGGBBAA = true, -- #RRGGBBAA hex codes - rgb_fn = true, -- CSS rgb() and rgba() functions - hsl_fn = true, -- CSS hsl() and hsla() functions - css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn - -- Available modes: foreground, background - mode = "background", -- Set the display mode. - tailwind = true, - }, - filetypes = { - "*", -- Highlight all files, but customize some others. - css = { rgb_fn = true }, -- Enable parsing rgb(...) functions in css. - html = { names = false }, -- Disable parsing "names" like Blue or Gray - }, - }, + "NvChad/nvim-colorizer.lua", + lazy = true, + event = { "BufRead", "InsertEnter", "BufNewFile" }, + opts = { + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = true, -- "Name" codes like Blue + RRGGBBAA = true, -- #RRGGBBAA hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Available modes: foreground, background + mode = "background", -- Set the display mode. + tailwind = true, + }, + filetypes = { + "*", -- Highlight all files, but customize some others. + css = { rgb_fn = true }, -- Enable parsing rgb(...) functions in css. + html = { names = false }, -- Disable parsing "names" like Blue or Gray + }, + }, } diff --git a/lua/pcode/plugins/extras/dap.lua b/lua/pcode/plugins/extras/dap.lua index a90f6c6..5c31a83 100644 --- a/lua/pcode/plugins/extras/dap.lua +++ b/lua/pcode/plugins/extras/dap.lua @@ -1,62 +1,62 @@ return { - { - "rcarriga/nvim-dap-ui", - lazy = true, - event = "BufRead", - dependencies = { - { "mfussenegger/nvim-dap", lazy = true }, - { "nvim-neotest/nvim-nio", lazy = true }, - { - "theHamsta/nvim-dap-virtual-text", - opts = { - virt_text_win_col = 80, - }, - }, - }, - config = function() - require("pcode.user.dapui") - end, - keys = { - { "d", "", desc = "  Debug" }, - { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, - { "db", "lua require'dap'.step_back()", desc = "Step Back" }, - { "dc", "lua require'dap'.continue()", desc = "Continue" }, - { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, - { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, - { "dg", "lua require'dap'.session()", desc = "Get Session" }, - { "di", "lua require'dap'.step_into()", desc = "Step Into" }, - { "do", "lua require'dap'.step_over()", desc = "Step Over" }, - { "du", "lua require'dap'.step_out()", desc = "Step Out" }, - { "dp", "lua require'dap'.pause()", desc = "Pause" }, - { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, - { "ds", "lua require'dap'.continue()", desc = "Start" }, - { "dq", "lua require'dap'.close()", desc = "Quit" }, - { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, - }, - }, - { - "jay-babu/mason-nvim-dap.nvim", - lazy = true, - event = "BufRead", - dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" }, - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, {}) - opts.automatic_setup = true - opts.handlers = { - function(config) - -- all sources with no handler get passed here + { + "rcarriga/nvim-dap-ui", + lazy = true, + event = "BufRead", + dependencies = { + { "mfussenegger/nvim-dap", lazy = true }, + { "nvim-neotest/nvim-nio", lazy = true }, + { + "theHamsta/nvim-dap-virtual-text", + opts = { + virt_text_win_col = 80, + }, + }, + }, + config = function() + require("pcode.user.dapui") + end, + keys = { + { "d", "", desc = "  Debug" }, + { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, + { "db", "lua require'dap'.step_back()", desc = "Step Back" }, + { "dc", "lua require'dap'.continue()", desc = "Continue" }, + { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, + { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, + { "dg", "lua require'dap'.session()", desc = "Get Session" }, + { "di", "lua require'dap'.step_into()", desc = "Step Into" }, + { "do", "lua require'dap'.step_over()", desc = "Step Over" }, + { "du", "lua require'dap'.step_out()", desc = "Step Out" }, + { "dp", "lua require'dap'.pause()", desc = "Pause" }, + { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, + { "ds", "lua require'dap'.continue()", desc = "Start" }, + { "dq", "lua require'dap'.close()", desc = "Quit" }, + { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, + }, + }, + { + "jay-babu/mason-nvim-dap.nvim", + lazy = true, + event = "BufRead", + dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" }, + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, {}) + opts.automatic_setup = true + opts.handlers = { + function(config) + -- all sources with no handler get passed here - -- Keep original functionality - require("mason-nvim-dap").default_setup(config) - end, - } - return opts - end, - -- enabled = vim.fn.has("win32") == 0, - config = function(_, opts) - require("mason").setup() - require("mason-nvim-dap").setup(opts) - end, - }, + -- Keep original functionality + require("mason-nvim-dap").default_setup(config) + end, + } + return opts + end, + -- enabled = vim.fn.has("win32") == 0, + config = function(_, opts) + require("mason").setup() + require("mason-nvim-dap").setup(opts) + end, + }, } diff --git a/lua/pcode/plugins/extras/deviconcolor.lua b/lua/pcode/plugins/extras/deviconcolor.lua index 62c1855..600efb7 100644 --- a/lua/pcode/plugins/extras/deviconcolor.lua +++ b/lua/pcode/plugins/extras/deviconcolor.lua @@ -1,7 +1,7 @@ return { - "rachartier/tiny-devicons-auto-colors.nvim", - event = "VeryLazy", - config = function() - require("tiny-devicons-auto-colors").setup() - end, + "rachartier/tiny-devicons-auto-colors.nvim", + event = "VeryLazy", + config = function() + require("tiny-devicons-auto-colors").setup() + end, } diff --git a/lua/pcode/plugins/extras/illuminate.lua b/lua/pcode/plugins/extras/illuminate.lua index abe7e80..6efd303 100644 --- a/lua/pcode/plugins/extras/illuminate.lua +++ b/lua/pcode/plugins/extras/illuminate.lua @@ -1,36 +1,65 @@ local M = { - "RRethy/vim-illuminate", - event = "VeryLazy", + "RRethy/vim-illuminate", + event = "VeryLazy", } -function M.config() - require("illuminate").configure({ - filetypes_denylist = { - "mason", - "harpoon", - "DressingInput", - "NeogitCommitMessage", - "qf", - "dirvish", - "oil", - "minifiles", - "fugitive", - "alpha", - "NvimTree", - "lazy", - "NeogitStatus", - "Trouble", - "netrw", - "lir", - "DiffviewFiles", - "Outline", - "Jaq", - "spectre_panel", - "toggleterm", - "DressingSelect", - "TelescopePrompt", - }, - }) +M.opts = { + delay = 200, + large_file_cutoff = 2000, + large_file_overrides = { + providers = { "lsp" }, + }, + filetypes_denylist = { + "mason", + "harpoon", + "DressingInput", + "NeogitCommitMessage", + "qf", + "dirvish", + "oil", + "minifiles", + "fugitive", + "alpha", + "NvimTree", + "lazy", + "NeogitStatus", + "Trouble", + "netrw", + "lir", + "DiffviewFiles", + "Outline", + "Jaq", + "spectre_panel", + "toggleterm", + "DressingSelect", + "TelescopePrompt", + }, +} + +function M.config(_, opts) + require("illuminate").configure(opts) + local function map(key, dir, buffer) + vim.keymap.set("n", key, function() + require("illuminate")["goto_" .. dir .. "_reference"](false) + end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) + end + + map("]]", "next") + map("[[", "prev") + + -- also set it after loading ftplugins, since a lot overwrite [[ and ]] + vim.api.nvim_create_autocmd("FileType", { + callback = function() + local buffer = vim.api.nvim_get_current_buf() + map("]]", "next", buffer) + map("[[", "prev", buffer) + end, + }) end +M.keys = { + { "]]", desc = "Next Reference" }, + { "[[", desc = "Prev Reference" }, +} + return M diff --git a/lua/pcode/plugins/extras/indentscupe.lua b/lua/pcode/plugins/extras/indentscupe.lua index 51b6f93..6bde87b 100644 --- a/lua/pcode/plugins/extras/indentscupe.lua +++ b/lua/pcode/plugins/extras/indentscupe.lua @@ -1,32 +1,32 @@ local icons = require("pcode.user.icons") return { - "echasnovski/mini.indentscope", - version = false, -- wait till new 0.7.0 release to put it back on semver - event = "BufReadPre", - opts = { - symbol = icons.ui.LineMiddle, - options = { try_as_border = true }, - }, - init = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = { - "alpha", - "dashboard", - "fzf", - "help", - "lazy", - "lazyterm", - "mason", - "neo-tree", - "NvimTree", - "notify", - "toggleterm", - "Trouble", - "trouble", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - end, + "echasnovski/mini.indentscope", + version = false, -- wait till new 0.7.0 release to put it back on semver + event = "BufReadPre", + opts = { + symbol = icons.ui.LineMiddle, + options = { try_as_border = true }, + }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "alpha", + "dashboard", + "fzf", + "help", + "lazy", + "lazyterm", + "mason", + "neo-tree", + "NvimTree", + "notify", + "toggleterm", + "Trouble", + "trouble", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, } diff --git a/lua/pcode/plugins/extras/liveserver.lua b/lua/pcode/plugins/extras/liveserver.lua index 3950368..c54a910 100644 --- a/lua/pcode/plugins/extras/liveserver.lua +++ b/lua/pcode/plugins/extras/liveserver.lua @@ -1,10 +1,10 @@ return { - "barrett-ruth/live-server.nvim", - build = "npm i -g live-server", - cmd = { "LiveServerStart", "LiveServerStop", "LiveServerToggle" }, - config = true, - keys = { - -- open http://localhost:5555/ jika menggunakan wsl - { "rl", "LiveServerToggle", desc = "LiveServer" }, - }, + "barrett-ruth/live-server.nvim", + build = "npm i -g live-server", + cmd = { "LiveServerStart", "LiveServerStop", "LiveServerToggle" }, + config = true, + keys = { + -- open http://localhost:5555/ jika menggunakan wsl + { "rl", "LiveServerToggle", desc = "LiveServer" }, + }, } diff --git a/lua/pcode/plugins/extras/minianimate.lua b/lua/pcode/plugins/extras/minianimate.lua index 621fc4d..0799b80 100644 --- a/lua/pcode/plugins/extras/minianimate.lua +++ b/lua/pcode/plugins/extras/minianimate.lua @@ -1,40 +1,40 @@ return { - -- animations - { - "echasnovski/mini.animate", - event = "BufRead", - opts = function() - -- don't use animate when scrolling with the mouse - local mouse_scrolled = false - for _, scroll in ipairs({ "Up", "Down" }) do - local key = "" - vim.keymap.set({ "", "i" }, key, function() - mouse_scrolled = true - return key - end, { expr = true }) - end + -- animations + { + "echasnovski/mini.animate", + event = "BufRead", + opts = function() + -- don't use animate when scrolling with the mouse + local mouse_scrolled = false + for _, scroll in ipairs({ "Up", "Down" }) do + local key = "" + vim.keymap.set({ "", "i" }, key, function() + mouse_scrolled = true + return key + end, { expr = true }) + end - local animate = require("mini.animate") - return { - resize = { - timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), - }, - scroll = { - timing = animate.gen_timing.linear({ duration = 150, unit = "total" }), - subscroll = animate.gen_subscroll.equal({ - predicate = function(total_scroll) - if mouse_scrolled then - mouse_scrolled = false - return false - end - return total_scroll > 1 - end, - }), - }, - } - end, - config = function(_, opts) - require("mini.animate").setup(opts) - end, - }, + local animate = require("mini.animate") + return { + resize = { + timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), + }, + scroll = { + timing = animate.gen_timing.linear({ duration = 150, unit = "total" }), + subscroll = animate.gen_subscroll.equal({ + predicate = function(total_scroll) + if mouse_scrolled then + mouse_scrolled = false + return false + end + return total_scroll > 1 + end, + }), + }, + } + end, + config = function(_, opts) + require("mini.animate").setup(opts) + end, + }, } diff --git a/lua/pcode/plugins/extras/navic.lua b/lua/pcode/plugins/extras/navic.lua index 0f7766d..e65a5f0 100644 --- a/lua/pcode/plugins/extras/navic.lua +++ b/lua/pcode/plugins/extras/navic.lua @@ -1,35 +1,35 @@ local M = { - "SmiteshP/nvim-navic", - event = "VeryLazy", - dependencies = { - "LunarVim/breadcrumbs.nvim", - opts = {}, - config = true, - }, + "SmiteshP/nvim-navic", + event = "VeryLazy", + dependencies = { + "LunarVim/breadcrumbs.nvim", + opts = {}, + config = true, + }, } function M.config() - local icons = require("pcode.user.icons").kind - for key, value in pairs(icons) do - icons[key] = value .. " " - end - require("nvim-navic").setup({ - icons = icons, - lsp = { - auto_attach = false, - preference = nil, - }, - highlight = false, - separator = " > ", - depth_limit = 0, - depth_limit_indicator = "..", - safe_output = true, - lazy_update_context = false, - click = false, - format_text = function(text) - return text - end, - }) + local icons = require("pcode.user.icons").kind + for key, value in pairs(icons) do + icons[key] = value .. " " + end + require("nvim-navic").setup({ + icons = icons, + lsp = { + auto_attach = false, + preference = nil, + }, + highlight = false, + separator = " > ", + depth_limit = 0, + depth_limit_indicator = "..", + safe_output = true, + lazy_update_context = false, + click = false, + format_text = function(text) + return text + end, + }) end return M diff --git a/lua/pcode/plugins/extras/neoscroll.lua b/lua/pcode/plugins/extras/neoscroll.lua index f7d6b2a..3d5acf2 100644 --- a/lua/pcode/plugins/extras/neoscroll.lua +++ b/lua/pcode/plugins/extras/neoscroll.lua @@ -1,8 +1,8 @@ return { - "karb94/neoscroll.nvim", - event = "VeryLazy", - lazy = true, - config = function() - require("neoscroll").setup({}) - end, + "karb94/neoscroll.nvim", + event = "VeryLazy", + lazy = true, + config = function() + require("neoscroll").setup({}) + end, } diff --git a/lua/pcode/plugins/extras/nvimmenu.lua b/lua/pcode/plugins/extras/nvimmenu.lua index 957f50a..a9dbf00 100644 --- a/lua/pcode/plugins/extras/nvimmenu.lua +++ b/lua/pcode/plugins/extras/nvimmenu.lua @@ -1,33 +1,33 @@ return { - { - "nvchad/menu", - lazy = true, - event = { "VeryLazy" }, - dependencies = { - { "nvchad/volt", lazy = true }, - { - "nvchad/minty", - cmd = { "Shades", "Huefy" }, - lazy = true, - }, - }, - opts = { - mouse = true, - border = true, - }, - config = function(_, opts) - -- Keyboard users - vim.keymap.set("n", "", function() - require("menu").open("default") - end, {}) + { + "nvchad/menu", + lazy = true, + event = { "VeryLazy" }, + dependencies = { + { "nvchad/volt", lazy = true }, + { + "nvchad/minty", + cmd = { "Shades", "Huefy" }, + lazy = true, + }, + }, + opts = { + mouse = true, + border = true, + }, + config = function(_, opts) + -- Keyboard users + vim.keymap.set("n", "", function() + require("menu").open("default") + end, {}) - -- mouse users + nvimtree users! - vim.keymap.set("n", "", function() - vim.cmd.exec('"normal! \\"') + -- mouse users + nvimtree users! + vim.keymap.set("n", "", function() + vim.cmd.exec('"normal! \\"') - local options = vim.bo.ft == "NvimTree" and "nvimtree" or "default" - require("menu").open(options, opts) - end, {}) - end, - }, + local options = vim.bo.ft == "NvimTree" and "nvimtree" or "default" + require("menu").open(options, opts) + end, {}) + end, + }, } diff --git a/lua/pcode/plugins/extras/nvimufo.lua b/lua/pcode/plugins/extras/nvimufo.lua index 478d57c..eb63709 100644 --- a/lua/pcode/plugins/extras/nvimufo.lua +++ b/lua/pcode/plugins/extras/nvimufo.lua @@ -1,107 +1,107 @@ local M = { "kevinhwang91/nvim-ufo" } M.event = "VeryLazy" M.dependencies = { - "kevinhwang91/promise-async", - "luukvbaal/statuscol.nvim", + "kevinhwang91/promise-async", + "luukvbaal/statuscol.nvim", } M.config = function() - local builtin = require("statuscol.builtin") - local cfg = { - setopt = true, - relculright = true, - segments = { + local builtin = require("statuscol.builtin") + local cfg = { + setopt = true, + relculright = true, + segments = { - { text = { builtin.foldfunc, " " }, click = "v:lua.ScFa", hl = "Comment" }, + { text = { builtin.foldfunc, " " }, click = "v:lua.ScFa", hl = "Comment" }, - { text = { "%s" }, click = "v:lua.ScSa" }, - { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, - }, - } + { text = { "%s" }, click = "v:lua.ScSa" }, + { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, + }, + } - require("statuscol").setup(cfg) + require("statuscol").setup(cfg) - vim.o.foldcolumn = "1" -- '0' is not bad - vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value - vim.o.foldlevelstart = 99 - vim.o.foldenable = true - vim.o.fillchars = [[eob: ,fold: ,foldopen:▾,foldsep: ,foldclose:▸]] + vim.o.foldcolumn = "1" -- '0' is not bad + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + vim.o.fillchars = [[eob: ,fold: ,foldopen:▾,foldsep: ,foldclose:▸]] - -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself - vim.keymap.set("n", "zR", require("ufo").openAllFolds) - vim.keymap.set("n", "zM", require("ufo").closeAllFolds) + -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + vim.keymap.set("n", "zR", require("ufo").openAllFolds) + vim.keymap.set("n", "zM", require("ufo").closeAllFolds) - local handler = function(virtText, lnum, endLnum, width, truncate) - local newVirtText = {} - local suffix = (" 󰡏 %d "):format(endLnum - lnum) - local sufWidth = vim.fn.strdisplaywidth(suffix) - local targetWidth = width - sufWidth - local curWidth = 0 - for _, chunk in ipairs(virtText) do - local chunkText = chunk[1] - local chunkWidth = vim.fn.strdisplaywidth(chunkText) - if targetWidth > curWidth + chunkWidth then - table.insert(newVirtText, chunk) - else - chunkText = truncate(chunkText, targetWidth - curWidth) - local hlGroup = chunk[2] - table.insert(newVirtText, { chunkText, hlGroup }) - chunkWidth = vim.fn.strdisplaywidth(chunkText) - -- str width returned from truncate() may less than 2nd argument, need padding - if curWidth + chunkWidth < targetWidth then - suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) - end - break - end - curWidth = curWidth + chunkWidth - end - table.insert(newVirtText, { suffix, "MoreMsg" }) - return newVirtText - end + local handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local suffix = (" 󰡏 %d "):format(endLnum - lnum) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, { chunkText, hlGroup }) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + table.insert(newVirtText, { suffix, "MoreMsg" }) + return newVirtText + end - local ftMap = { - -- typescriptreact = { "lsp", "treesitter" }, - -- python = { "indent" }, - -- git = "", - } + local ftMap = { + -- typescriptreact = { "lsp", "treesitter" }, + -- python = { "indent" }, + -- git = "", + } - require("ufo").setup({ - fold_virt_text_handler = handler, - close_fold_kinds = {}, - -- close_fold_kinds = { "imports", "comment" }, - provider_selector = function(bufnr, filetype, buftype) - -- if you prefer treesitter provider rather than lsp, - -- return ftMap[filetype] or {'treesitter', 'indent'} - return ftMap[filetype] - -- return { "treesitter", "indent" } + require("ufo").setup({ + fold_virt_text_handler = handler, + close_fold_kinds = {}, + -- close_fold_kinds = { "imports", "comment" }, + provider_selector = function(bufnr, filetype, buftype) + -- if you prefer treesitter provider rather than lsp, + -- return ftMap[filetype] or {'treesitter', 'indent'} + return ftMap[filetype] + -- return { "treesitter", "indent" } - -- refer to ./doc/example.lua for detail - end, + -- refer to ./doc/example.lua for detail + end, - preview = { - win_config = { - border = { "", "─", "", "", "", "─", "", "" }, - winhighlight = "Normal:Folded", - winblend = 0, - }, - mappings = { - scrollU = "", - scrollD = "", - jumpTop = "[", - jumpBot = "]", - }, - }, - }) + preview = { + win_config = { + border = { "", "─", "", "", "", "─", "", "" }, + winhighlight = "Normal:Folded", + winblend = 0, + }, + mappings = { + scrollU = "", + scrollD = "", + jumpTop = "[", + jumpBot = "]", + }, + }, + }) - vim.keymap.set("n", "zR", require("ufo").openAllFolds) - vim.keymap.set("n", "zM", require("ufo").closeAllFolds) - vim.keymap.set("n", "zr", require("ufo").openFoldsExceptKinds) - vim.keymap.set("n", "zm", require("ufo").closeFoldsWith) -- closeAllFolds == closeFoldsWith(0) - vim.keymap.set("n", "K", function() - local winid = require("ufo").peekFoldedLinesUnderCursor() - if not winid then - vim.lsp.buf.hover() - end - end) + vim.keymap.set("n", "zR", require("ufo").openAllFolds) + vim.keymap.set("n", "zM", require("ufo").closeAllFolds) + vim.keymap.set("n", "zr", require("ufo").openFoldsExceptKinds) + vim.keymap.set("n", "zm", require("ufo").closeFoldsWith) -- closeAllFolds == closeFoldsWith(0) + vim.keymap.set("n", "K", function() + local winid = require("ufo").peekFoldedLinesUnderCursor() + if not winid then + vim.lsp.buf.hover() + end + end) end return M diff --git a/lua/pcode/plugins/extras/rainbowdelimiters.lua b/lua/pcode/plugins/extras/rainbowdelimiters.lua index 419fced..ebc7c1a 100644 --- a/lua/pcode/plugins/extras/rainbowdelimiters.lua +++ b/lua/pcode/plugins/extras/rainbowdelimiters.lua @@ -1,36 +1,36 @@ return { - "hiphish/rainbow-delimiters.nvim", - lazy = true, - event = "BufRead", - config = function() - -- Modul ini berisi beberapa definisi default - local rainbow_delimiters = require("rainbow-delimiters") - vim.g.rainbow_delimiters = { - strategy = { - [""] = rainbow_delimiters.strategy["global"], - vim = rainbow_delimiters.strategy["local"], - }, - query = { - [""] = "rainbow-delimiters", - -- lua = "rainbow-blocks", - }, - priority = { - [""] = 110, - lua = 210, - }, - highlight = { - "RainbowDelimiterRed", - "RainbowDelimiterYellow", - "RainbowDelimiterBlue", - "RainbowDelimiterOrange", - "RainbowDelimiterGreen", - "RainbowDelimiterViolet", - "RainbowDelimiterCyan", - }, - blacklist = { - "html", - "tsx", - }, - } - end, + "hiphish/rainbow-delimiters.nvim", + lazy = true, + event = "BufRead", + config = function() + -- Modul ini berisi beberapa definisi default + local rainbow_delimiters = require("rainbow-delimiters") + vim.g.rainbow_delimiters = { + strategy = { + [""] = rainbow_delimiters.strategy["global"], + vim = rainbow_delimiters.strategy["local"], + }, + query = { + [""] = "rainbow-delimiters", + -- lua = "rainbow-blocks", + }, + priority = { + [""] = 110, + lua = 210, + }, + highlight = { + "RainbowDelimiterRed", + "RainbowDelimiterYellow", + "RainbowDelimiterBlue", + "RainbowDelimiterOrange", + "RainbowDelimiterGreen", + "RainbowDelimiterViolet", + "RainbowDelimiterCyan", + }, + blacklist = { + "html", + "tsx", + }, + } + end, } diff --git a/lua/pcode/plugins/extras/refactoring.lua b/lua/pcode/plugins/extras/refactoring.lua index 4e611f9..a521863 100644 --- a/lua/pcode/plugins/extras/refactoring.lua +++ b/lua/pcode/plugins/extras/refactoring.lua @@ -1,8 +1,8 @@ return { - -- Incremental rename - { - "smjonas/inc-rename.nvim", - cmd = "IncRename", + -- Incremental rename + { + "smjonas/inc-rename.nvim", + cmd = "IncRename", -- stylua: ignore keys = { {"u","",desc="  Edit"}, @@ -17,27 +17,33 @@ return { 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, - desc = "  Refactoring", - }, - }, - opts = {}, - }, + config = true, + }, + { + "folke/noice.nvim", + optional = true, + opts = { + presets = { inc_rename = 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, + desc = "  Refactoring", + }, + }, + opts = {}, + }, } diff --git a/lua/pcode/plugins/extras/rest.lua b/lua/pcode/plugins/extras/rest.lua index 9e7c052..2b887f0 100644 --- a/lua/pcode/plugins/extras/rest.lua +++ b/lua/pcode/plugins/extras/rest.lua @@ -1,27 +1,27 @@ vim.filetype.add({ - extension = { - ["http"] = "http", - }, + extension = { + ["http"] = "http", + }, }) return { - { - "mistweaverco/kulala.nvim", - ft = "http", - keys = { - { "R", "", desc = " 󰖟 Rest" }, - { "Rs", "lua require('kulala').run()", desc = "Send the request" }, - { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body" }, - { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request" }, - { "Rn", "lua require('kulala').jump_next()", desc = "Jump to next request" }, - }, - opts = {}, - }, - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "http", "graphql" }) - return opts - end, - }, + { + "mistweaverco/kulala.nvim", + ft = "http", + keys = { + { "R", "", desc = " 󰖟 Rest" }, + { "Rs", "lua require('kulala').run()", desc = "Send the request" }, + { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body" }, + { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request" }, + { "Rn", "lua require('kulala').jump_next()", desc = "Jump to next request" }, + }, + opts = {}, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "http", "graphql" }) + return opts + end, + }, } diff --git a/lua/pcode/plugins/extras/restnvim.lua b/lua/pcode/plugins/extras/restnvim.lua index e8ac129..3c3b305 100644 --- a/lua/pcode/plugins/extras/restnvim.lua +++ b/lua/pcode/plugins/extras/restnvim.lua @@ -5,42 +5,42 @@ -- manual penggunaan -- https://www.jetbrains.com/help/idea/exploring-http-syntax.html return { - "rest-nvim/rest.nvim", - -- NOTE: Follow https://github.com/rest-nvim/rest.nvim/issues/306 - -- commit = "91badd46c60df6bd9800c809056af2d80d33da4c", - event = "VeryLazy", - enabled = vim.fn.executable("luarocks") == 1, - dependencies = { - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { "http" }) - end, - }, - }, - config = function() - require("rest-nvim").setup() - vim.api.nvim_create_autocmd("FileType", { - pattern = { "http", "httpResult" }, - callback = function() - local opt = vim.opt - opt.number = false -- Print line number - opt.preserveindent = false -- Preserve indent structure as much as possible - opt.relativenumber = false - end, - }) - end, - ft = "http", - keys = { - { - "rh", - "Rest run", - desc = "Run http request under cursor", - }, - { - "rH", - "Rest last", - desc = "Run last http request", - }, - }, + "rest-nvim/rest.nvim", + -- NOTE: Follow https://github.com/rest-nvim/rest.nvim/issues/306 + -- commit = "91badd46c60df6bd9800c809056af2d80d33da4c", + event = "VeryLazy", + enabled = vim.fn.executable("luarocks") == 1, + dependencies = { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { "http" }) + end, + }, + }, + config = function() + require("rest-nvim").setup() + vim.api.nvim_create_autocmd("FileType", { + pattern = { "http", "httpResult" }, + callback = function() + local opt = vim.opt + opt.number = false -- Print line number + opt.preserveindent = false -- Preserve indent structure as much as possible + opt.relativenumber = false + end, + }) + end, + ft = "http", + keys = { + { + "rh", + "Rest run", + desc = "Run http request under cursor", + }, + { + "rH", + "Rest last", + desc = "Run last http request", + }, + }, } diff --git a/lua/pcode/plugins/extras/scrollview.lua b/lua/pcode/plugins/extras/scrollview.lua index ddbc298..73b0543 100644 --- a/lua/pcode/plugins/extras/scrollview.lua +++ b/lua/pcode/plugins/extras/scrollview.lua @@ -1,13 +1,13 @@ return { - "dstein64/nvim-scrollview", - lazy = true, - event = { "BufRead", "InsertEnter", "BufNewFile" }, - opts = { - bg = "LightCyan", - ctermbg = 160, - }, - config = function(_, opts) - require("scrollview").setup(opts) - vim.g.scrollview_excluded_filetypes = { "NvimTree", "vista_kind", "Outline", "neo-tree" } - end, + "dstein64/nvim-scrollview", + lazy = true, + event = { "BufRead", "InsertEnter", "BufNewFile" }, + opts = { + bg = "LightCyan", + ctermbg = 160, + }, + config = function(_, opts) + require("scrollview").setup(opts) + vim.g.scrollview_excluded_filetypes = { "NvimTree", "vista_kind", "Outline", "neo-tree" } + end, } diff --git a/lua/pcode/plugins/extras/smartsplit.lua b/lua/pcode/plugins/extras/smartsplit.lua index ebc4b83..42da51e 100644 --- a/lua/pcode/plugins/extras/smartsplit.lua +++ b/lua/pcode/plugins/extras/smartsplit.lua @@ -1,21 +1,21 @@ return { - "mrjones2014/smart-splits.nvim", - lazy = true, - event = { "BufRead", "InsertEnter", "BufNewFile" }, - opts = { - ignored_filetypes = { - "nofile", - "quickfix", - "qf", - "prompt", - }, - ignored_buftypes = { "nofile" }, - }, - config = function(_, opts) - require("smart-splits").setup(opts) - vim.keymap.set("n", "", require("smart-splits").resize_left) - vim.keymap.set("n", "", require("smart-splits").resize_down) - vim.keymap.set("n", "", require("smart-splits").resize_right) - end, + "mrjones2014/smart-splits.nvim", + lazy = true, + event = { "BufRead", "InsertEnter", "BufNewFile" }, + opts = { + ignored_filetypes = { + "nofile", + "quickfix", + "qf", + "prompt", + }, + ignored_buftypes = { "nofile" }, + }, + config = function(_, opts) + require("smart-splits").setup(opts) + vim.keymap.set("n", "", require("smart-splits").resize_left) + vim.keymap.set("n", "", require("smart-splits").resize_down) + vim.keymap.set("n", "", require("smart-splits").resize_right) + end, } diff --git a/lua/pcode/plugins/extras/transparent.lua b/lua/pcode/plugins/extras/transparent.lua index 0661863..b0970e0 100644 --- a/lua/pcode/plugins/extras/transparent.lua +++ b/lua/pcode/plugins/extras/transparent.lua @@ -1,64 +1,64 @@ return { - -- transparant config - { - "xiyaowong/transparent.nvim", - lazy = true, - event = "BufWinEnter", - cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" }, - config = function() - require("transparent").setup({ - extra_groups = { - "Normal", - "NormalNC", - "NormalFloat", - "FloatBorder", - "Comment", - "Folded", - "GitSignsAdd", - "GitSignsDelete", - "GitSignsChange", - "FoldColumn", - "WinBar", - "WinBarNC", - "NotifyBackground", - }, - exclude_groups = { - -- disable active selection backgroun - "CursorLine", - "CursorLineNR", - "CursorLineSign", - "CursorLineFold", - -- disable nvimtree CursorLine - "NvimTreeCursorLine", - -- disable Neotree CursorLine - "NeoTreeCursorLine", - -- disable Telescope active selection background - "TelescopeSelection", - -- disable lualine background color - "LualineNormal", - }, - }) - require("transparent").clear_prefix("BufferLine") - -- clear prefix for which-key - require("transparent").clear_prefix("WhichKey") - -- clear prefix for lazy.nvim - require("transparent").clear_prefix("Lazy") - -- clear prefix for NvimTree - require("transparent").clear_prefix("NvimTree") - -- clear prefix for NeoTree - require("transparent").clear_prefix("NeoTree") - -- clear prefix for Telescope - require("transparent").clear_prefix("Telescope") - require("transparent").clear_prefix("mason") - -- create auto command to set transparent - vim.cmd("TransparentDisable") - vim.cmd("TransparentEnable") - end, - }, - { - "rcarriga/nvim-notify", - opts = function(_, opts) - opts.background_colour = "#00000000" - end, - }, + -- transparant config + { + "xiyaowong/transparent.nvim", + lazy = true, + event = "BufWinEnter", + cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" }, + config = function() + require("transparent").setup({ + extra_groups = { + "Normal", + "NormalNC", + "NormalFloat", + "FloatBorder", + "Comment", + "Folded", + "GitSignsAdd", + "GitSignsDelete", + "GitSignsChange", + "FoldColumn", + "WinBar", + "WinBarNC", + "NotifyBackground", + }, + exclude_groups = { + -- disable active selection backgroun + "CursorLine", + "CursorLineNR", + "CursorLineSign", + "CursorLineFold", + -- disable nvimtree CursorLine + "NvimTreeCursorLine", + -- disable Neotree CursorLine + "NeoTreeCursorLine", + -- disable Telescope active selection background + "TelescopeSelection", + -- disable lualine background color + "LualineNormal", + }, + }) + require("transparent").clear_prefix("BufferLine") + -- clear prefix for which-key + require("transparent").clear_prefix("WhichKey") + -- clear prefix for lazy.nvim + require("transparent").clear_prefix("Lazy") + -- clear prefix for NvimTree + require("transparent").clear_prefix("NvimTree") + -- clear prefix for NeoTree + require("transparent").clear_prefix("NeoTree") + -- clear prefix for Telescope + require("transparent").clear_prefix("Telescope") + require("transparent").clear_prefix("mason") + -- create auto command to set transparent + vim.cmd("TransparentDisable") + vim.cmd("TransparentEnable") + end, + }, + { + "rcarriga/nvim-notify", + opts = function(_, opts) + opts.background_colour = "#00000000" + end, + }, } diff --git a/lua/pcode/plugins/extras/treesittercontex.lua b/lua/pcode/plugins/extras/treesittercontex.lua index 46ac2fd..7871d22 100644 --- a/lua/pcode/plugins/extras/treesittercontex.lua +++ b/lua/pcode/plugins/extras/treesittercontex.lua @@ -1,10 +1,10 @@ return { - "nvim-treesitter/nvim-treesitter-context", - lazy = true, - event = { "BufRead", "VeryLazy" }, - opts = {}, - keys = { - { "T", "", desc = "  TS Context" }, - { "Tt", "TSContextToggle", desc = "Toggle Context" }, - }, + "nvim-treesitter/nvim-treesitter-context", + lazy = true, + event = { "BufRead", "VeryLazy" }, + opts = {}, + keys = { + { "T", "", desc = "  TS Context" }, + { "Tt", "TSContextToggle", desc = "Toggle Context" }, + }, } diff --git a/lua/pcode/plugins/extras/verticalcolumn.lua b/lua/pcode/plugins/extras/verticalcolumn.lua index 0bedae9..8214e58 100644 --- a/lua/pcode/plugins/extras/verticalcolumn.lua +++ b/lua/pcode/plugins/extras/verticalcolumn.lua @@ -1,27 +1,27 @@ return { - { - "lukas-reineke/virt-column.nvim", - event = "BufRead", - opts = {}, - config = function() - local icons = require("pcode.user.icons") - require("virt-column").overwrite({ - exclude = { - filetypes = { "help", "text", "markdown" }, - }, - char = icons.ui.LineMiddle, - }) - -- Mengatur colum color max 80 caracter - vim.api.nvim_create_autocmd("BufWinEnter", { - pattern = "*", - callback = function() - vim.opt.formatoptions = "croql" - vim.opt.textwidth = 80 - vim.opt.colorcolumn = "+1" - vim.opt.lazyredraw = false - -- vim.cmd "hi ColorColumn guibg=#1B2430 ctermbg=246" - end, - }) - end, - }, + { + "lukas-reineke/virt-column.nvim", + event = "BufRead", + opts = {}, + config = function() + local icons = require("pcode.user.icons") + require("virt-column").overwrite({ + exclude = { + filetypes = { "help", "text", "markdown" }, + }, + char = icons.ui.LineMiddle, + }) + -- Mengatur colum color max 80 caracter + vim.api.nvim_create_autocmd("BufWinEnter", { + pattern = "*", + callback = function() + vim.opt.formatoptions = "croql" + vim.opt.textwidth = 80 + vim.opt.colorcolumn = "+1" + vim.opt.lazyredraw = false + -- vim.cmd "hi ColorColumn guibg=#1B2430 ctermbg=246" + end, + }) + end, + }, } diff --git a/lua/pcode/plugins/extras/visualmulti.lua b/lua/pcode/plugins/extras/visualmulti.lua index f52e20d..0717bfd 100644 --- a/lua/pcode/plugins/extras/visualmulti.lua +++ b/lua/pcode/plugins/extras/visualmulti.lua @@ -1,17 +1,17 @@ return { - "mg979/vim-visual-multi", - event = { "BufRead", "InsertEnter", "BufNewFile" }, - branch = "master", - lazy = true, - init = function() - vim.g.VM_mouse_mappings = 1 -- equal CTRL + Left Click on VSCODE - vim.g.VM_maps = { - ["Find Under"] = "", -- equal CTRL+D on VSCODE - ["Find Subword Under"] = "", -- equal CTRL+D on VSCODE - ["Select Cursor Down"] = "", -- equal CTRL+ALT+DOWN on VSCODE - ["Select Cursor Up"] = "", -- equal CTRL+ALT+UP on VSCODE - ["Undo"] = "u", -- undo - ["Redo"] = "", -- redo - } - end, + "mg979/vim-visual-multi", + event = { "BufRead", "InsertEnter", "BufNewFile" }, + branch = "master", + lazy = true, + init = function() + vim.g.VM_mouse_mappings = 1 -- equal CTRL + Left Click on VSCODE + vim.g.VM_maps = { + ["Find Under"] = "", -- equal CTRL+D on VSCODE + ["Find Subword Under"] = "", -- equal CTRL+D on VSCODE + ["Select Cursor Down"] = "", -- equal CTRL+ALT+DOWN on VSCODE + ["Select Cursor Up"] = "", -- equal CTRL+ALT+UP on VSCODE + ["Undo"] = "u", -- undo + ["Redo"] = "", -- redo + } + end, } diff --git a/lua/pcode/plugins/extras/yanky.lua b/lua/pcode/plugins/extras/yanky.lua index 3e05197..fbdd6b9 100644 --- a/lua/pcode/plugins/extras/yanky.lua +++ b/lua/pcode/plugins/extras/yanky.lua @@ -1,19 +1,19 @@ return { - "gbprod/yanky.nvim", - event = "BufReadPre", - opts = { - ring = { - history_length = 50, - storage = "memory", - }, - preserve_cursor_position = { - enabled = false, - }, - }, - config = function(_, opts) - require("yanky").setup(opts) - -- cycle through the yank history, only work after paste - vim.keymap.set("n", "[y", "(YankyCycleForward)") - vim.keymap.set("n", "]y", "(YankyCycleBackward)") - end, + "gbprod/yanky.nvim", + event = "BufReadPre", + opts = { + ring = { + history_length = 50, + storage = "memory", + }, + preserve_cursor_position = { + enabled = false, + }, + }, + config = function(_, opts) + require("yanky").setup(opts) + -- cycle through the yank history, only work after paste + vim.keymap.set("n", "[y", "(YankyCycleForward)") + vim.keymap.set("n", "]y", "(YankyCycleBackward)") + end, } diff --git a/lua/pcode/plugins/extras/zenmode.lua b/lua/pcode/plugins/extras/zenmode.lua index bb12e6c..79f4eee 100644 --- a/lua/pcode/plugins/extras/zenmode.lua +++ b/lua/pcode/plugins/extras/zenmode.lua @@ -1,22 +1,21 @@ return { - "folke/zen-mode.nvim", - event = "VeryLazy", - opts = { - plugins = { - options = { - -- hide statusline - laststatus = 0, - }, - }, - on_open = function(win) - require("notify")("Zen Mode ON") - end, - on_close = function() - require("notify")("Zen Mode OFF") - end, - }, - keys = { - { "z", "ZenMode", desc = "󰤼 Toggle Zen Mode" }, - }, + "folke/zen-mode.nvim", + event = "VeryLazy", + opts = { + plugins = { + options = { + -- hide statusline + laststatus = 0, + }, + }, + on_open = function(win) + require("notify")("Zen Mode ON") + end, + on_close = function() + require("notify")("Zen Mode OFF") + end, + }, + keys = { + { "z", "ZenMode", desc = "󰤼 Toggle Zen Mode" }, + }, } - diff --git a/lua/pcode/user/custom.lua b/lua/pcode/user/custom.lua index f3b1257..095ee2e 100644 --- a/lua/pcode/user/custom.lua +++ b/lua/pcode/user/custom.lua @@ -1,129 +1,129 @@ return { - -- overidse dashboard - { - "goolord/alpha-nvim", - opts = { - dash_model = { - [[ _ __ __ ]], - [[ ___ ___ (____ / /__ _______ ___/ ___ ]], - [[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]], - [[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]], - [[ /_/ |___/ ]], - }, - }, - }, - -- overide lualine - { - "pojokcodeid/auto-lualine.nvim", - opts = { - -- for more options check out https://github.com/pojokcodeid/auto-lualine.nvim - setColor = "auto", - setOption = "roundedall", - setMode = 5, - }, - }, - -- overide formatting - { - "pojokcodeid/auto-conform.nvim", - opts = { - format_on_save = true, - format_timeout_ms = 5000, - }, - }, - -- install treesitter - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { "lua", "c" }) - end, - }, - -- install mason (lsp, dap, linters, formatters) - { - "williamboman/mason.nvim", - opts = { ensure_installed = { "stylua" } }, - }, - -- overide lsp config - { - "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - vim.list_extend(opts.skip_config, { "jdtls" }) - opts.virtual_text = true - end, - }, - -- add whichkey mappings - { - "folke/which-key.nvim", - opts = function(_, opts) - opts.mappings = opts.mappings or {} - vim.list_extend(opts.mappings, { - { "h", "nohlsearch", desc = "󱪿 No Highlight", mode = "n" }, - }) - end, - }, - -- overide telescope - { - "nvim-telescope/telescope.nvim", - opts = function(_, opts) - opts.pickers = { - find_files = { - hidden = true, - }, - live_grep = { - theme = "dropdown", - only_sort_text = true, - additional_args = function() - return { "--multiline" } - end, - }, - } - end, - }, - -- add code runner - { - "CRAG666/code_runner.nvim", - opts = function(_, opts) - vim.list_extend(opts.filetype, { go = "go run $fileName" }) - end, - }, - -- custem nvimtree - { - "nvim-tree/nvim-tree.lua", - opts = function(_, opts) - -- set nvimtree float view (default left side) - -- opts.view = { - -- adaptive_size = false, - -- centralize_selection = true, - -- side = "left", - -- preserve_window_proportions = false, - -- number = false, - -- relativenumber = false, - -- signcolumn = "yes", - -- float = { - -- enable = true, - -- open_win_config = function() - -- local screen_w = vim.opt.columns:get() - -- local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() - -- local window_w = screen_w * 0.5 - -- local window_h = screen_h * 0.9 - -- local window_w_int = math.floor(window_w) - -- local window_h_int = math.floor(window_h) - -- local center_x = (screen_w - window_w) / 2 - -- local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() - -- return { - -- border = "rounded", - -- relative = "editor", - -- row = center_y, - -- col = center_x, - -- width = window_w_int, - -- height = window_h_int, - -- } - -- end, - -- }, - -- width = function() - -- return math.floor(vim.opt.columns:get() * 0.5) - -- end, - -- } - return opts - end, - }, + -- overidse dashboard + { + "goolord/alpha-nvim", + opts = { + dash_model = { + [[ _ __ __ ]], + [[ ___ ___ (____ / /__ _______ ___/ ___ ]], + [[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]], + [[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]], + [[ /_/ |___/ ]], + }, + }, + }, + -- overide lualine + { + "pojokcodeid/auto-lualine.nvim", + opts = { + -- for more options check out https://github.com/pojokcodeid/auto-lualine.nvim + setColor = "auto", + setOption = "roundedall", + setMode = 5, + }, + }, + -- overide formatting + { + "pojokcodeid/auto-conform.nvim", + opts = { + format_on_save = true, + format_timeout_ms = 5000, + }, + }, + -- install treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { "lua", "c" }) + end, + }, + -- install mason (lsp, dap, linters, formatters) + { + "williamboman/mason.nvim", + opts = { ensure_installed = { "stylua" } }, + }, + -- overide lsp config + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + vim.list_extend(opts.skip_config, { "jdtls" }) + opts.virtual_text = true + end, + }, + -- add whichkey mappings + { + "folke/which-key.nvim", + opts = function(_, opts) + opts.mappings = opts.mappings or {} + vim.list_extend(opts.mappings, { + { "h", "nohlsearch", desc = "󱪿 No Highlight", mode = "n" }, + }) + end, + }, + -- overide telescope + { + "nvim-telescope/telescope.nvim", + opts = function(_, opts) + opts.pickers = { + find_files = { + hidden = true, + }, + live_grep = { + theme = "dropdown", + only_sort_text = true, + additional_args = function() + return { "--multiline" } + end, + }, + } + end, + }, + -- add code runner + { + "CRAG666/code_runner.nvim", + opts = function(_, opts) + vim.list_extend(opts.filetype, { go = "go run $fileName" }) + end, + }, + -- custem nvimtree + { + "nvim-tree/nvim-tree.lua", + opts = function(_, opts) + -- set nvimtree float view (default left side) + -- opts.view = { + -- adaptive_size = false, + -- centralize_selection = true, + -- side = "left", + -- preserve_window_proportions = false, + -- number = false, + -- relativenumber = false, + -- signcolumn = "yes", + -- float = { + -- enable = true, + -- open_win_config = function() + -- local screen_w = vim.opt.columns:get() + -- local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() + -- local window_w = screen_w * 0.5 + -- local window_h = screen_h * 0.9 + -- local window_w_int = math.floor(window_w) + -- local window_h_int = math.floor(window_h) + -- local center_x = (screen_w - window_w) / 2 + -- local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() + -- return { + -- border = "rounded", + -- relative = "editor", + -- row = center_y, + -- col = center_x, + -- width = window_w_int, + -- height = window_h_int, + -- } + -- end, + -- }, + -- width = function() + -- return math.floor(vim.opt.columns:get() * 0.5) + -- end, + -- } + return opts + end, + }, } diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 5e698d6..d0beb40 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -24,7 +24,7 @@ pcode.extras = { minianimate = false, neoscroll = false, nvimufo = false, - refactoring = false, + refactoring = true, rest = false, treesittercontex = false, codeium = true, diff --git a/lua/pcode/user/options.lua b/lua/pcode/user/options.lua index c900c7a..7f8888c 100644 --- a/lua/pcode/user/options.lua +++ b/lua/pcode/user/options.lua @@ -69,3 +69,5 @@ vim.api.nvim_create_autocmd("FileType", { opt.relativenumber = false end, }) + +vim.opt.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20" From 299c94137df0b082a533ae55be007b1d95f2b22f Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Wed, 6 Nov 2024 12:26:52 +0700 Subject: [PATCH 06/59] fix: conflik key mapping with increment rename --- lua/pcode/plugins/notify.lua | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lua/pcode/plugins/notify.lua b/lua/pcode/plugins/notify.lua index 183a8e9..639d0de 100644 --- a/lua/pcode/plugins/notify.lua +++ b/lua/pcode/plugins/notify.lua @@ -1,30 +1,30 @@ 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, - render = "wrapped-compact", - -- background_colour = "#00000000", - }, - config = function(_, opts) - local notify = require("notify") - notify.setup(opts) - 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, + render = "wrapped-compact", + -- background_colour = "#00000000", + }, + config = function(_, opts) + local notify = require("notify") + notify.setup(opts) + vim.notify = notify.notify + end, } From 80f8ade2a554a23bf958058836bdf4117cf24e63 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Wed, 6 Nov 2024 13:48:58 +0700 Subject: [PATCH 07/59] qa: testing php laravel --- lazy-lock.json | 6 ++++-- lua/pcode/plugins/lang/php.lua | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 4943946..8410862 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,7 +25,7 @@ "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, - "laravel.nvim": { "branch": "main", "commit": "e4f39d942352b03396a9df79896b0a8801675199" }, + "laravel.nvim": { "branch": "main", "commit": "a436bc4ded60d7c93e289e25ad5994e49bc15630" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, "lualine.nvim": { "branch": "master", "commit": "640260d7c2d98779cab89b1e7088ab14ea354a02" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, @@ -45,7 +45,7 @@ "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "bc6ada4b0892b7f10852c0b8ca7209fd39a6d754" }, + "nvim-lspconfig": { "branch": "master", "commit": "fb30a8603d8b6eb26a87d88474a313a637c0bfd9" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, @@ -57,12 +57,14 @@ "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "e0f9b3efe150724af2d2ed59997d5ece373840e3" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "11600d75e1b57e9fe1f3ca880a917485fc399e8c" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, + "vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, diff --git a/lua/pcode/plugins/lang/php.lua b/lua/pcode/plugins/lang/php.lua index 0c05cf7..b660561 100644 --- a/lua/pcode/plugins/lang/php.lua +++ b/lua/pcode/plugins/lang/php.lua @@ -199,9 +199,11 @@ return { -- npm install -g tree-sitter-cli { "adalessa/laravel.nvim", - enabled = is_laravel_project() and vim.fn.has("win32") == 0, -- pastikan membuka laravel project - version = "v2.2.1", + -- enabled = is_laravel_project() and vim.fn.has("win32") == 0, -- pastikan membuka laravel project + -- version = "v2.2.1", dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", "tpope/vim-dotenv", "nvim-telescope/telescope.nvim", "MunifTanjim/nui.nvim", From 11875c382d6eed79e24de028a653923a8c1132c5 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Wed, 6 Nov 2024 15:19:48 +0700 Subject: [PATCH 08/59] fix: laravel project for error treesitter --- lazy-lock.json | 8 ++++---- lua/pcode/plugins/lang/php.lua | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 8410862..b1477ad 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,15 +25,15 @@ "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, - "laravel.nvim": { "branch": "main", "commit": "a436bc4ded60d7c93e289e25ad5994e49bc15630" }, + "laravel.nvim": { "branch": "main", "commit": "2e7c08c0511234d5816166c1204e2240edac99b5" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, "lualine.nvim": { "branch": "master", "commit": "640260d7c2d98779cab89b1e7088ab14ea354a02" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "menu": { "branch": "main", "commit": "a12605e89a5da6c63840104a95362e2bb1e9b847" }, + "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, - "minty": { "branch": "main", "commit": "1ab2b8334cec1770fef096f0a5697bf0c3afb3ca" }, + "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" }, "noice.nvim": { "branch": "main", "commit": "d80136061820765baf70ace7dfb98a52575edc4a" }, @@ -45,7 +45,7 @@ "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "fb30a8603d8b6eb26a87d88474a313a637c0bfd9" }, + "nvim-lspconfig": { "branch": "master", "commit": "52302604e3c667cfdf33aadf89088e96eb3c5da3" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, diff --git a/lua/pcode/plugins/lang/php.lua b/lua/pcode/plugins/lang/php.lua index b660561..f9e671f 100644 --- a/lua/pcode/plugins/lang/php.lua +++ b/lua/pcode/plugins/lang/php.lua @@ -199,7 +199,7 @@ return { -- npm install -g tree-sitter-cli { "adalessa/laravel.nvim", - -- enabled = is_laravel_project() and vim.fn.has("win32") == 0, -- pastikan membuka laravel project + enabled = is_laravel_project(), -- pastikan membuka laravel project -- version = "v2.2.1", dependencies = { "nvim-lua/plenary.nvim", From 3f5a3a6439c694c2dbd424dfb651c537cbd76089 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 7 Nov 2024 06:19:54 +0700 Subject: [PATCH 09/59] enc: move evatheme overide hilight to std template list --- lua/pcode/plugins/theme/evatheme.lua | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lua/pcode/plugins/theme/evatheme.lua b/lua/pcode/plugins/theme/evatheme.lua index da0506c..dd932b5 100644 --- a/lua/pcode/plugins/theme/evatheme.lua +++ b/lua/pcode/plugins/theme/evatheme.lua @@ -14,20 +14,16 @@ return { pattern = "*", callback = function() local hi = vim.api.nvim_set_hl - -- hi(0, "LspInfoBorder", { fg = "#2F3F5C" }) - -- hi(0, "LspInfoBorder", { fg = "#598DEF" }) - hi(0, "LspInfoBorder", { fg = "#8A97C3" }) - -- hi(0, "FloatBorder", { fg = "#2F3F5C" }) - -- hi(0, "FloatBorder", { fg = "#598DEF" }) - hi(0, "FloatBorder", { fg = "#8A97C3" }) + hi(0, "LspInfoBorder", { fg = color.comment }) + hi(0, "FloatBorder", { fg = color.comment }) hi(0, "StatusLine", { bg = color.background }) hi(0, "StatusLineNC", { bg = color.background }) hi(0, "WinBar", { bg = color.background }) hi(0, "WinBarNC", { bg = color.background }) hi(0, "NormalFloat", { bg = color.background }) hi(0, "NormalNC", { bg = color.background }) - hi(0, "@tag.delimiter.javascript", { fg = "#838FA7" }) - hi(0, "@tag.delimiter.tsx", { fg = "#838FA7" }) + hi(0, "@tag.delimiter.javascript", { fg = color.punctuation }) + hi(0, "@tag.delimiter.tsx", { fg = color.punctuation }) -- git hi(0, "NvimTreeGitNewIcon", { bg = color.dark, fg = color.git.added }) hi(0, "NvimTreeGitRenamedIcon", { bg = color.dark, fg = color.git.added }) @@ -40,11 +36,11 @@ return { hi(0, "MiniIndentscopeSymbol", { bg = color.dark, fg = color.parameter }) -- cursor -- hi(0, "Cursor", { bg = "#838FA7", fg = "#838FA7" }) - hi(0, "CursorColumn", { bg = color.dark, fg = "#838FA7" }) - hi(0, "TermCursor", { bg = "#FF9070", fg = color.dark }) - hi(0, "TermCursorNC", { bg = "#FF9070", fg = color.dark }) - hi(0, "MiniIndentscopeSymbol", { fg = "#FF9070" }) - hi(0, "MiniIndentscopeSymbolOff", { fg = "#FF9070" }) + hi(0, "CursorColumn", { bg = color.dark, fg = color.punctuation }) + hi(0, "TermCursor", { bg = color.digit, fg = color.dark }) + hi(0, "TermCursorNC", { bg = color.digit, fg = color.dark }) + hi(0, "MiniIndentscopeSymbol", { fg = color.digit }) + hi(0, "MiniIndentscopeSymbolOff", { fg = color.digit }) end, }) end, From 5200fa75aa7e41c2951cd8f50101c75fcc8d73b9 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 7 Nov 2024 06:44:58 +0700 Subject: [PATCH 10/59] enc: add dark and light varian theme --- lua/pcode/plugins/theme/evatheme.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lua/pcode/plugins/theme/evatheme.lua b/lua/pcode/plugins/theme/evatheme.lua index dd932b5..b96d429 100644 --- a/lua/pcode/plugins/theme/evatheme.lua +++ b/lua/pcode/plugins/theme/evatheme.lua @@ -5,10 +5,19 @@ return { config = function() require("Eva-Theme").setup({}) local color = {} + local theme = vim.g.colors_name or "Eva-Dark" if pcode.localcode then - color = require("Eva-Theme.palette").dark_base + if substring(theme, "Dark") then + color = require("Eva-Theme.palette").dark_base + else + color = require("Eva-Theme.palette").light_base + end else - color = require("Eva-Theme.palette").dark + if substring(theme, "Dark") then + color = require("Eva-Theme.palette").dark + else + color = require("Eva-Theme.palette").light + end end vim.api.nvim_create_autocmd("ColorScheme", { pattern = "*", From ea602aba6e96846e19a3f68d726ef19c5958b6fb Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 7 Nov 2024 07:29:22 +0700 Subject: [PATCH 11/59] enc: add sublime text theme juliana --- lazy-lock.json | 12 +++++------- lua/pcode/plugins/theme/sublimetext.lua | 18 ++++++++++++++++++ lua/pcode/user/default.lua | 5 ++++- 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 lua/pcode/plugins/theme/sublimetext.lua diff --git a/lazy-lock.json b/lazy-lock.json index b1477ad..300d4a9 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,8 +1,7 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "Eva-Theme.nvim": { "branch": "master", "commit": "568fdba3a2a3088bec2198e7bb8f28d482629e58" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "29417eea5b7c4b6beda105ced072855101d9680e" }, + "LuaSnip": { "branch": "master", "commit": "2737edc9e674e537dc0a97e3405658d57d2d31ed" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, @@ -36,7 +35,7 @@ "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" }, - "noice.nvim": { "branch": "main", "commit": "d80136061820765baf70ace7dfb98a52575edc4a" }, + "noice.nvim": { "branch": "main", "commit": "73d38cc939db6553b87e5f72ff732447046bced1" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, @@ -44,6 +43,7 @@ "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, + "nvim-juliana": { "branch": "master", "commit": "fa1d6e8b816e25f269a44807e702750de0da0413" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, "nvim-lspconfig": { "branch": "master", "commit": "52302604e3c667cfdf33aadf89088e96eb3c5da3" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, @@ -52,25 +52,23 @@ "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "610a1c189bdb2b9b936169b2ea9d1838f971fa2b" }, - "nvim-treesitter": { "branch": "master", "commit": "7dc8aabe86db8c2f23520e8334f7584f83e84342" }, + "nvim-treesitter": { "branch": "master", "commit": "0722f23886d7de2c702ca54a72d94d6171715cb7" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "e0f9b3efe150724af2d2ed59997d5ece373840e3" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "11600d75e1b57e9fe1f3ca880a917485fc399e8c" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, - "vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, "volt": { "branch": "main", "commit": "ff954757fdaf72da0dedd77bdf74718ea846f989" }, "vscode-php-debug": { "branch": "main", "commit": "6193fbc1c819437325df3dad43e254d8e5c416e5" }, - "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }, + "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, "yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" }, "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } } diff --git a/lua/pcode/plugins/theme/sublimetext.lua b/lua/pcode/plugins/theme/sublimetext.lua new file mode 100644 index 0000000..e49479e --- /dev/null +++ b/lua/pcode/plugins/theme/sublimetext.lua @@ -0,0 +1,18 @@ +return { + "pojokcodeid/nvim-juliana", + lazy = false, + priority = 1000, + opts = {}, + config = function() + vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = function() + -- get colors + local colors = require("nvim-juliana").colors() + -- custom hilights + local hi = vim.api.nvim_set_hl + hi(0, "FoldColumn", { bg = colors.bg2 }) + end, + }) + end, +} diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index d0beb40..e700cff 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -47,7 +47,7 @@ pcode.extras = { pcode.themes = { -- note: open remark only one -- **:: Eva Theme ::** -- - evatheme = "Eva-Dark", + -- evatheme = "Eva-Dark", -- evatheme = "Eva-Dark-Italic", -- evatheme = "Eva-Dark-Bold", -- evatheme = "Eva-Light", @@ -63,6 +63,9 @@ pcode.themes = { -- -- **:: Jetbrains Theme ::** -- -- jetbrains = "darcula-dark", + -- + -- **:: Sublimetext Theme ::** -- + sublimetext = "juliana", } -- activate config transparent_bg pcode.transparent = false From 541a0dac953dc8d93744bb3d210eecd447f0f817 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 7 Nov 2024 08:17:09 +0700 Subject: [PATCH 12/59] enc: add tokyonight theme --- lazy-lock.json | 2 +- lua/pcode/plugins/theme/tokyonight.lua | 77 ++++++++++++++++++++++++++ lua/pcode/user/default.lua | 8 ++- 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 lua/pcode/plugins/theme/tokyonight.lua diff --git a/lazy-lock.json b/lazy-lock.json index 300d4a9..493b0f2 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -43,7 +43,6 @@ "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, - "nvim-juliana": { "branch": "master", "commit": "fa1d6e8b816e25f269a44807e702750de0da0413" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, "nvim-lspconfig": { "branch": "master", "commit": "52302604e3c667cfdf33aadf89088e96eb3c5da3" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, @@ -63,6 +62,7 @@ "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, + "tokyonight.nvim": { "branch": "main", "commit": "ce91ba480070c95f40753e4663e32b4632ac6db3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, diff --git a/lua/pcode/plugins/theme/tokyonight.lua b/lua/pcode/plugins/theme/tokyonight.lua new file mode 100644 index 0000000..5dd30a3 --- /dev/null +++ b/lua/pcode/plugins/theme/tokyonight.lua @@ -0,0 +1,77 @@ +return { + "folke/tokyonight.nvim", + priority = 1000, + config = function() + local status_ok, tokyonight = pcall(require, "tokyonight") + if not status_ok then + return + end + local transp = false + local sidebar = "normal" --"dark , transparent, normal" + local hilight = "#292e42" + local tras = pcode.transparent_mode or 0 + if tras == 1 then + transp = true + sidebar = "transparent" + -- hilight = "#3E4254" + -- hilight = "#353a56" + hilight = "#292e42" + end + + tokyonight.setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day` + light_style = "day", -- The theme is used when the background is set to light + transparent = transp, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + -- comments = { italic = true }, + comments = { italic = true }, + keywords = {}, + functions = {}, + variables = {}, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = sidebar, -- style for sidebars, see below + floats = sidebar, -- style for floating windows + }, + sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` + day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors + hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. + dim_inactive = false, -- dims inactive windows + lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold + + --- You can override specific color groups to use other groups or a hex color + --- function will be called with a ColorScheme table + -- @param colors ColorScheme + on_colors = function(colors) + colors.bg_highlight = hilight + colors.bg_statusline = colors.none + end, + + --- You can override specific highlights to use other groups or a hex color + --- function will be called with a Highlights and ColorScheme table + --@param highlights Highlights + -- @param colors ColorScheme + on_highlights = function(highlights, colors) + highlights.NvimTreeFolderIcon = { + bg = colors.none, + fg = "#e0af68", + } + highlights.Underlined = { + underline = false, + } + highlights.NvimTreeWinSeparator = { + fg = colors.border, + } + highlights.BufferLineFill = { bg = colors.bg } + highlights.NvimTreeSpecialFile = { fg = colors.purple, underline = false } + highlights["@tag.attribute"] = { fg = colors.green1, italic = true } + -- highlights["@keyword.function"] = { fg = colors.blue, italic = true } + -- highlights["@function"] = { fg = colors.blue, italic = true } + end, + }) + end, +} diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index e700cff..b86467c 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -65,7 +65,13 @@ pcode.themes = { -- jetbrains = "darcula-dark", -- -- **:: Sublimetext Theme ::** -- - sublimetext = "juliana", + -- sublimetext = "juliana", + -- + -- **:: Tokyonight Theme ::** -- + -- tokyonight = "tokyonight-night", + -- tokyonight = "tokyonight-storm", + -- tokyonight = "tokyonight-day", + tokyonight = "tokyonight-moon", } -- activate config transparent_bg pcode.transparent = false From b5f544bc2708846b52accaf8e7c4fdfaa4257229 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 7 Nov 2024 08:35:30 +0700 Subject: [PATCH 13/59] enc: add catppucin theme --- lazy-lock.json | 2 +- lua/pcode/plugins/theme/catppuccin.lua | 76 ++++++++++++++++++++++++++ lua/pcode/user/default.lua | 11 +++- 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 lua/pcode/plugins/theme/catppuccin.lua diff --git a/lazy-lock.json b/lazy-lock.json index 493b0f2..0f7c4d1 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,5 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "Eva-Theme.nvim": { "branch": "master", "commit": "80d9229ea010774610cec71921afc0defbbd3822" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "2737edc9e674e537dc0a97e3405658d57d2d31ed" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, @@ -62,7 +63,6 @@ "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, - "tokyonight.nvim": { "branch": "main", "commit": "ce91ba480070c95f40753e4663e32b4632ac6db3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, diff --git a/lua/pcode/plugins/theme/catppuccin.lua b/lua/pcode/plugins/theme/catppuccin.lua new file mode 100644 index 0000000..e9afeee --- /dev/null +++ b/lua/pcode/plugins/theme/catppuccin.lua @@ -0,0 +1,76 @@ +return { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function() + local transparent = false + require("catppuccin").setup({ + flavour = "auto", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = transparent, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = "dark", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = { "italic" }, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + color_overrides = {}, + custom_highlights = function(colors) + return { + NvimTreeNormal = { fg = colors.text, bg = transparent and colors.none or colors.base }, + NvimTreeWinSeparator = { fg = colors.mantle, bg = transparent and colors.none or colors.none }, + Pmenu = { fg = colors.text, bg = transparent and colors.none or colors.base }, + WhichKeyFloat = { fg = colors.text, bg = transparent and colors.none or colors.base }, + WhichKey = { fg = colors.text, bg = transparent and colors.none or colors.base }, + WhichKeyBorder = { fg = colors.text, bg = transparent and colors.none or colors.base }, + NormalFloat = { fg = colors.text, bg = transparent and colors.none or colors.base }, + Normal = { fg = colors.text, bg = transparent and colors.none or colors.base }, + NormalNC = { fg = colors.text, bg = transparent and colors.none or colors.base }, + StatusLine = { fg = colors.text, bg = colors.none }, + } + end, + highlight_overrides = { + all = function(colors) + return { + ["@markup.link.url"] = { fg = colors.rosewater, style = { "italic" } }, + } + end, + }, + default_integrations = true, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = "", + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, + }) + end, +} diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index b86467c..b69709d 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -48,7 +48,7 @@ pcode.themes = { -- note: open remark only one -- **:: Eva Theme ::** -- -- evatheme = "Eva-Dark", - -- evatheme = "Eva-Dark-Italic", + evatheme = "Eva-Dark-Italic", -- evatheme = "Eva-Dark-Bold", -- evatheme = "Eva-Light", -- @@ -71,7 +71,14 @@ pcode.themes = { -- tokyonight = "tokyonight-night", -- tokyonight = "tokyonight-storm", -- tokyonight = "tokyonight-day", - tokyonight = "tokyonight-moon", + -- tokyonight = "tokyonight-moon", + -- + -- **:: Catppuccin Theme ::** -- + -- catppuccin = "catppuccin", + -- catppuccin = "catppuccin-latte", + -- catppuccin = "catppuccin-frappe", + -- catppuccin = "catppuccin-macchiato", + -- catppuccin = "catppuccin-macchiato", } -- activate config transparent_bg pcode.transparent = false From 8a5c2dd3987d9f703e8179af9c55a627fc656d84 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 7 Nov 2024 08:41:48 +0700 Subject: [PATCH 14/59] fix: evatheme load not proverly --- lua/pcode/plugins/theme/evatheme.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lua/pcode/plugins/theme/evatheme.lua b/lua/pcode/plugins/theme/evatheme.lua index b96d429..dd932b5 100644 --- a/lua/pcode/plugins/theme/evatheme.lua +++ b/lua/pcode/plugins/theme/evatheme.lua @@ -5,19 +5,10 @@ return { config = function() require("Eva-Theme").setup({}) local color = {} - local theme = vim.g.colors_name or "Eva-Dark" if pcode.localcode then - if substring(theme, "Dark") then - color = require("Eva-Theme.palette").dark_base - else - color = require("Eva-Theme.palette").light_base - end + color = require("Eva-Theme.palette").dark_base else - if substring(theme, "Dark") then - color = require("Eva-Theme.palette").dark - else - color = require("Eva-Theme.palette").light - end + color = require("Eva-Theme.palette").dark end vim.api.nvim_create_autocmd("ColorScheme", { pattern = "*", From c8d51254d4a93c3297f053360fa0c5d4f702e763 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 7 Nov 2024 15:52:28 +0700 Subject: [PATCH 15/59] enc: disable php by default --- lazy-lock.json | 5 ----- lua/pcode/user/default.lua | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 0f7c4d1..725c65f 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "80d9229ea010774610cec71921afc0defbbd3822" }, - "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "2737edc9e674e537dc0a97e3405658d57d2d31ed" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, @@ -25,7 +24,6 @@ "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, - "laravel.nvim": { "branch": "main", "commit": "2e7c08c0511234d5816166c1204e2240edac99b5" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, "lualine.nvim": { "branch": "master", "commit": "640260d7c2d98779cab89b1e7088ab14ea354a02" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, @@ -34,8 +32,6 @@ "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, - "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, - "neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" }, "noice.nvim": { "branch": "main", "commit": "73d38cc939db6553b87e5f72ff732447046bced1" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, @@ -67,7 +63,6 @@ "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, "volt": { "branch": "main", "commit": "ff954757fdaf72da0dedd77bdf74718ea846f989" }, - "vscode-php-debug": { "branch": "main", "commit": "6193fbc1c819437325df3dad43e254d8e5c416e5" }, "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, "yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" }, "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index b69709d..60dd38a 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -9,7 +9,7 @@ pcode.lang = { javascript = false, kotlin = false, markdown = false, - php = true, + php = false, prisma = false, python = false, rust = false, From fe846f291e5c24478ed1727a9c0e364d940c7e0e Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Fri, 8 Nov 2024 09:08:04 +0700 Subject: [PATCH 16/59] fix: LSP mapping key --- lazy-lock.json | 15 +-- lua/pcode/plugins/_lsp.lua | 200 +++++++++++++++++-------------------- 2 files changed, 100 insertions(+), 115 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 725c65f..cd18c17 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,12 +1,12 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "Eva-Theme.nvim": { "branch": "master", "commit": "80d9229ea010774610cec71921afc0defbbd3822" }, + "Eva-Theme.nvim": { "branch": "master", "commit": "ad37d0aec43cc1e745ed66e688de3e24b2b9048a" }, "LuaSnip": { "branch": "master", "commit": "2737edc9e674e537dc0a97e3405658d57d2d31ed" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, - "auto-lsp.nvim": { "branch": "main", "commit": "352e1a55a10026525f6b7489055b5fbe56d15703" }, + "auto-lsp.nvim": { "branch": "main", "commit": "4fab265af6207e24c0be4b88e4343178e3755625" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, "breadcrumbs.nvim": { "branch": "master", "commit": "9f764278784ce2f10dbe2f555ba14be2451d36a0" }, "bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" }, @@ -25,14 +25,14 @@ "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, - "lualine.nvim": { "branch": "master", "commit": "640260d7c2d98779cab89b1e7088ab14ea354a02" }, + "lualine.nvim": { "branch": "master", "commit": "ef3f2ee04140aeca037bdcabafab4339da4d5b5f" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, - "noice.nvim": { "branch": "main", "commit": "73d38cc939db6553b87e5f72ff732447046bced1" }, + "noice.nvim": { "branch": "main", "commit": "4d48c360a19b3920a4041868530fd4b99919fa0c" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, @@ -41,21 +41,22 @@ "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "52302604e3c667cfdf33aadf89088e96eb3c5da3" }, + "nvim-lspconfig": { "branch": "master", "commit": "d01864641c6e43c681c3e9f6cf4745c75fdd9dcc" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "610a1c189bdb2b9b936169b2ea9d1838f971fa2b" }, - "nvim-treesitter": { "branch": "master", "commit": "0722f23886d7de2c702ca54a72d94d6171715cb7" }, + "nvim-treesitter": { "branch": "master", "commit": "eab2005cb5a839abb4af9961a76bbf819650a1a9" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "e0f9b3efe150724af2d2ed59997d5ece373840e3" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "a25248a9e5cbfa117043f6740b10248dd596b576" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "11600d75e1b57e9fe1f3ca880a917485fc399e8c" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, diff --git a/lua/pcode/plugins/_lsp.lua b/lua/pcode/plugins/_lsp.lua index c2d85a4..1dc2e4e 100644 --- a/lua/pcode/plugins/_lsp.lua +++ b/lua/pcode/plugins/_lsp.lua @@ -1,111 +1,95 @@ return { - { - "williamboman/mason-lspconfig.nvim", - event = { "VeryLazy", "BufReadPre", "BufNewFile", "BufRead" }, - dependencies = { - { "pojokcodeid/auto-lsp.nvim", lazy = true }, - { - "neovim/nvim-lspconfig", - lazy = true, - cmd = { - "LspInfo", - "LspInstall", - "LspUninstall", - }, - config = function() - require("lspconfig.ui.windows").default_options.border = "rounded" - end, - }, - { - "williamboman/mason.nvim", - lazy = true, - build = ":MasonUpdate", - opts_extend = { "ensure_installed" }, - cmd = { - "Mason", - "MasonInstall", - "MasonUninstall", - "MasonUninstallAll", - "MasonLog", - }, - opts = function(_, opts) - local icons = require("pcode.user.icons").ui - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "stylua" }) - opts.ui = { - -- border = "none", - border = icons.Border, - icons = { - package_pending = icons.Pending, - package_installed = icons.CheckCircle, - package_uninstalled = icons.BlankCircle, - }, - keymaps = { - toggle_server_expand = "", - install_server = "i", - update_server = "u", - check_server_version = "c", - update_all_servers = "U", - check_outdated_servers = "C", - uninstall_server = "X", - }, - } - opts.log_level = vim.log.levels.INFO - opts.max_concurrent_installers = 4 - return opts - end, - config = function(_, opts) - require("mason").setup(opts) - local mr = require("mason-registry") - mr:on("package:install:success", function() - vim.defer_fn(function() - -- trigger FileType event to possibly load this newly installed LSP server - require("lazy.core.handler.event").trigger({ - event = "FileType", - buf = vim.api.nvim_get_current_buf(), - }) - end, 100) - end) + { + "williamboman/mason-lspconfig.nvim", + event = { "VeryLazy", "BufReadPre", "BufNewFile", "BufRead" }, + dependencies = { + { "pojokcodeid/auto-lsp.nvim", lazy = true }, + { + "neovim/nvim-lspconfig", + lazy = true, + cmd = { + "LspInfo", + "LspInstall", + "LspUninstall", + }, + config = function() + require("lspconfig.ui.windows").default_options.border = "rounded" + end, + }, + { + "williamboman/mason.nvim", + lazy = true, + build = ":MasonUpdate", + opts_extend = { "ensure_installed" }, + cmd = { + "Mason", + "MasonInstall", + "MasonUninstall", + "MasonUninstallAll", + "MasonLog", + }, + opts = function(_, opts) + local icons = require("pcode.user.icons").ui + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "stylua" }) + opts.ui = { + -- border = "none", + border = icons.Border, + icons = { + package_pending = icons.Pending, + package_installed = icons.CheckCircle, + package_uninstalled = icons.BlankCircle, + }, + keymaps = { + toggle_server_expand = "", + install_server = "i", + update_server = "u", + check_server_version = "c", + update_all_servers = "U", + check_outdated_servers = "C", + uninstall_server = "X", + }, + } + opts.log_level = vim.log.levels.INFO + opts.max_concurrent_installers = 4 + return opts + end, + config = function(_, opts) + require("mason").setup(opts) + local mr = require("mason-registry") + mr:on("package:install:success", function() + vim.defer_fn(function() + -- trigger FileType event to possibly load this newly installed LSP server + require("lazy.core.handler.event").trigger({ + event = "FileType", + buf = vim.api.nvim_get_current_buf(), + }) + end, 100) + end) - mr.refresh(function() - for _, tool in ipairs(opts.ensure_installed) do - local p = mr.get_package(tool) - if not p:is_installed() then - p:install() - end - end - end) - end, - }, - }, - opts = function(_, opts) - opts.skip_config = opts.skip_config or {} - opts.ensure_installed = opts.ensure_installed or {} - opts.automatic_installation = true - vim.list_extend(opts.ensure_installed, { "lua_ls" }) - opts.format_on_save = true -- if use none-ls set true - opts.virtual_text = true - opts.timeout_ms = 5000 - return opts - end, - config = function(_, opts) - require("auto-lsp").setup(opts) - end, - -- stylua: ignore - keys = { - { "l", "", desc = "  LSP", mode = "n" }, - { "la", "lua vim.lsp.buf.code_action()", desc = "Code Action", mode = "n" }, - { "ld", "Telescope diagnostics bufnr=0", desc = "Document Diagnostics", mode = "n" }, - { "lw", "Telescope diagnostics", desc = "Workspace Diagnostics", mode = "n" }, - { "li", "LspInfo", desc = "Info", mode = "n" }, - { "lI", "Mason", desc = "Mason", mode = "n" }, - { "lj", "lua vim.lsp.diagnostic.goto_next()", desc = "Next Diagnostic", mode = "n" }, - { "lk", "lua vim.lsp.diagnostic.goto_prev()", desc = "Prev Diagnostic", mode = "n" }, - { "ll", "lua vim.lsp.codelens.run()", desc = "Code Lens Action", mode = "n" }, - { "lq", "lua vim.diagnostic.setloclist()", desc = "Quickfix", mode = "n" }, - { "lr", "lua vim.lsp.buf.rename()", desc = "Rename", mode = "n" }, - { "ls", "Telescope lsp_document_symbols", desc = "Document Symbols", mode = "n" }, - { "lS", "Telescope lsp_dynamic_workspace_symbols", desc = "Workspace Symbols", mode = "n"}, - }, - }, + mr.refresh(function() + for _, tool in ipairs(opts.ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end + end + end) + end, + }, + }, + opts = function(_, opts) + opts.skip_config = opts.skip_config or {} + opts.ensure_installed = opts.ensure_installed or {} + opts.automatic_installation = true + vim.list_extend(opts.ensure_installed, { "lua_ls" }) + opts.format_on_save = true -- if use none-ls set true + opts.virtual_text = true + opts.timeout_ms = 5000 + return opts + end, + config = function(_, opts) + require("auto-lsp").setup(opts) + end, + }, } From 5a64a2e380672a5f551eb2298ce6e29913b83910 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Fri, 8 Nov 2024 13:08:06 +0700 Subject: [PATCH 17/59] enc: disable numbering if lazyload plugins first time --- lazy-lock.json | 3 +-- lua/pcode/config/lazy_lib.lua | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index cd18c17..167c36d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,7 +25,7 @@ "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, - "lualine.nvim": { "branch": "master", "commit": "ef3f2ee04140aeca037bdcabafab4339da4d5b5f" }, + "lualine.nvim": { "branch": "master", "commit": "70fef2406909e6a7beaa98d529c8a8f7183dab9e" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, @@ -56,7 +56,6 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "a25248a9e5cbfa117043f6740b10248dd596b576" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "11600d75e1b57e9fe1f3ca880a917485fc399e8c" }, - "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, diff --git a/lua/pcode/config/lazy_lib.lua b/lua/pcode/config/lazy_lib.lua index 985c124..ab355f9 100644 --- a/lua/pcode/config/lazy_lib.lua +++ b/lua/pcode/config/lazy_lib.lua @@ -14,6 +14,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end end vim.opt.rtp:prepend(vim.env.LAZY or lazypath) +vim.opt.number = false local icons = require("pcode.user.icons").ui -- Make sure to setup `mapleader` and `maplocalleader` before From b3d4f8b8a16c374be6df621e1f07a4a8db672c7c Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Fri, 8 Nov 2024 21:10:34 +0700 Subject: [PATCH 18/59] enc: move default theme to Eva-Dark --- lazy-lock.json | 8 ++++---- lua/pcode/user/custom.lua | 2 +- lua/pcode/user/default.lua | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 167c36d..44b551c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "Eva-Theme.nvim": { "branch": "master", "commit": "ad37d0aec43cc1e745ed66e688de3e24b2b9048a" }, + "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, "LuaSnip": { "branch": "master", "commit": "2737edc9e674e537dc0a97e3405658d57d2d31ed" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, @@ -25,14 +25,14 @@ "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, - "lualine.nvim": { "branch": "master", "commit": "70fef2406909e6a7beaa98d529c8a8f7183dab9e" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, - "noice.nvim": { "branch": "main", "commit": "4d48c360a19b3920a4041868530fd4b99919fa0c" }, + "noice.nvim": { "branch": "main", "commit": "81013884522c1715c370bb15a65831d3253813b9" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, @@ -48,7 +48,7 @@ "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "610a1c189bdb2b9b936169b2ea9d1838f971fa2b" }, - "nvim-treesitter": { "branch": "master", "commit": "eab2005cb5a839abb4af9961a76bbf819650a1a9" }, + "nvim-treesitter": { "branch": "master", "commit": "425b58968340bd5b4621c2a0d626c73556516d3d" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, diff --git a/lua/pcode/user/custom.lua b/lua/pcode/user/custom.lua index 095ee2e..cd0e85c 100644 --- a/lua/pcode/user/custom.lua +++ b/lua/pcode/user/custom.lua @@ -46,7 +46,7 @@ return { { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) - vim.list_extend(opts.skip_config, { "jdtls" }) + vim.list_extend(opts.skip_config, {}) opts.virtual_text = true end, }, diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 60dd38a..743155d 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -47,8 +47,8 @@ pcode.extras = { pcode.themes = { -- note: open remark only one -- **:: Eva Theme ::** -- - -- evatheme = "Eva-Dark", - evatheme = "Eva-Dark-Italic", + evatheme = "Eva-Dark", + -- evatheme = "Eva-Dark-Italic", -- evatheme = "Eva-Dark-Bold", -- evatheme = "Eva-Light", -- From 177cf190df48c9fd6dfdab0b619612a8d5c8ea47 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Fri, 8 Nov 2024 21:37:42 +0700 Subject: [PATCH 19/59] enc: add keymapping gradle run if file type java --- lazy-lock.json | 2 +- lua/pcode/user/autocmd.lua | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lazy-lock.json b/lazy-lock.json index 44b551c..0ca65e0 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,7 @@ "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, - "auto-lsp.nvim": { "branch": "main", "commit": "4fab265af6207e24c0be4b88e4343178e3755625" }, + "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, "breadcrumbs.nvim": { "branch": "master", "commit": "9f764278784ce2f10dbe2f555ba14be2451d36a0" }, "bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" }, diff --git a/lua/pcode/user/autocmd.lua b/lua/pcode/user/autocmd.lua index b793758..c082a5a 100644 --- a/lua/pcode/user/autocmd.lua +++ b/lua/pcode/user/autocmd.lua @@ -115,3 +115,12 @@ vim.api.nvim_create_autocmd("ExitPre", { command = "set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175,a:ver90", desc = "Set cursor back to beam when leaving Neovim.", }) + +-- Create an autocmd to set keymap for Java files +vim.api.nvim_create_augroup("java_gradle_run", { clear = true }) +vim.api.nvim_create_autocmd("FileType", { + pattern = "java", + callback = function() + vim.api.nvim_set_keymap("n", "rg", "terminalgradle run", { noremap = true, silent = true }) + end, +}) From 826cbfe9f81ec4e1cdea86f394e632ef8baed807 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Sat, 9 Nov 2024 07:14:26 +0700 Subject: [PATCH 20/59] enc: add gruvbox color scheme --- lazy-lock.json | 6 +++--- lua/pcode/plugins/theme/gruvbox.lua | 28 ++++++++++++++++++++++++++++ lua/pcode/user/default.lua | 3 +++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 lua/pcode/plugins/theme/gruvbox.lua diff --git a/lazy-lock.json b/lazy-lock.json index 0ca65e0..af60d52 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -32,7 +32,7 @@ "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, - "noice.nvim": { "branch": "main", "commit": "81013884522c1715c370bb15a65831d3253813b9" }, + "noice.nvim": { "branch": "main", "commit": "eac7e84b16765066dc235a4d6cf8102d7436f6cd" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, @@ -53,9 +53,9 @@ "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "a25248a9e5cbfa117043f6740b10248dd596b576" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, - "smart-splits.nvim": { "branch": "master", "commit": "11600d75e1b57e9fe1f3ca880a917485fc399e8c" }, + "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, diff --git a/lua/pcode/plugins/theme/gruvbox.lua b/lua/pcode/plugins/theme/gruvbox.lua new file mode 100644 index 0000000..909d896 --- /dev/null +++ b/lua/pcode/plugins/theme/gruvbox.lua @@ -0,0 +1,28 @@ +return { + "ellisonleao/gruvbox.nvim", + priority = 1000, + opts = function() + local color = require("gruvbox").palette + return { + terminal_colors = true, -- add neovim terminal colors + undercurl = false, + underline = false, + bold = false, + contrast = "", -- can be "hard", "soft" or empty string + palette_overrides = {}, + overrides = { + ["NormalFloat"] = { bg = "NONE" }, + ["NormalNC"] = { bg = "NONE" }, + ["MiniIndentscopeSymbol"] = { fg = color.bright_yellow }, + ["StatusLine"] = { bg = "NONE" }, + ["FoldColumn"] = { bg = "NONE" }, + ["Folded"] = { bg = "NONE" }, + ["SignColumn"] = { bg = "NONE" }, + }, + } + end, + config = function(_, opts) + vim.o.background = "dark" + require("gruvbox").setup(opts) + end, +} diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 743155d..234b545 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -79,6 +79,9 @@ pcode.themes = { -- catppuccin = "catppuccin-frappe", -- catppuccin = "catppuccin-macchiato", -- catppuccin = "catppuccin-macchiato", + -- + -- **:: Gruvbox Theme ::** -- + -- gruvbox = "gruvbox", } -- activate config transparent_bg pcode.transparent = false From 35348c069a957245888abd170554d6a647ee15b2 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Sat, 9 Nov 2024 12:20:45 +0700 Subject: [PATCH 21/59] enc: add gitub theme --- lazy-lock.json | 2 +- lua/pcode/plugins/theme/github.lua | 108 +++++++++++++++++++++++++++++ lua/pcode/user/default.lua | 3 + 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 lua/pcode/plugins/theme/github.lua diff --git a/lazy-lock.json b/lazy-lock.json index af60d52..69f5714 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -47,7 +47,7 @@ "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, - "nvim-tree.lua": { "branch": "master", "commit": "610a1c189bdb2b9b936169b2ea9d1838f971fa2b" }, + "nvim-tree.lua": { "branch": "master", "commit": "c7639482a1598f4756798df1b2d72f79fe5bb34f" }, "nvim-treesitter": { "branch": "master", "commit": "425b58968340bd5b4621c2a0d626c73556516d3d" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, diff --git a/lua/pcode/plugins/theme/github.lua b/lua/pcode/plugins/theme/github.lua new file mode 100644 index 0000000..99f226c --- /dev/null +++ b/lua/pcode/plugins/theme/github.lua @@ -0,0 +1,108 @@ +return { + "projekt0n/github-nvim-theme", + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + local is_transparent = false + local palette = require("github-theme.palette").load(pcode.themes.github or "github_dark_dimmed") + require("github-theme").setup({ + options = { + -- Compiled file's destination location + compile_path = vim.fn.stdpath("cache") .. "/github-theme", + compile_file_suffix = "_compiled", -- Compiled file suffix + hide_end_of_buffer = true, -- Hide the '~' character at the end of the buffer for a cleaner look + hide_nc_statusline = true, -- Override the underline style for non-active statuslines + transparent = is_transparent, -- Disable setting background + terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = false, -- Non focused panes set to alternative background + module_default = true, -- Default enable value for modules + styles = { -- Style to be applied to different syntax groups + comments = "italic", -- Value is any valid attr-list value `:help attr-list` + functions = "italic", + keywords = "NONE", + variables = "NONE", + conditionals = "NONE", + constants = "NONE", + numbers = "NONE", + operators = "NONE", + strings = "NONE", + types = "NONE", + }, + inverse = { -- Inverse highlight for different types + match_paren = false, + visual = false, + search = false, + }, + darken = { -- Darken floating windows and sidebar-like windows + floats = false, + sidebars = { + enable = true, + list = {}, -- Apply dark background to specific windows + }, + }, + modules = { -- List of various plugins and additional options + -- ... + }, + }, + palettes = { + github_dark_dimmed = { + bg0 = is_transparent and "NONE" or "bg1", + bg1 = is_transparent and "NONE" or "bg", + }, + }, + specs = {}, + groups = { + all = { + illuminatedWord = { bg = "#3b4261" }, + illuminatedCurWord = { bg = "#3b4261" }, + IlluminatedWordText = { bg = "#3b4261" }, + IlluminatedWordRead = { bg = "#3b4261" }, + IlluminatedWordWrite = { bg = "#3b4261" }, + ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" }, + ["@text.uri"] = { fg = palette.const, style = "italic" }, + ["@keyword.return"] = { fg = "#fa7970", style = "italic" }, + -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" }, + -- ["@operator.html"] = { fg = "#faa356" }, + -- ["@tag.html"] = { fg = "#fa7970" }, + -- ["@tag.delimiter.html"] = { fg = "#faa356" }, + -- ["@tag.javascript"] = { fg = "#faa356" }, + -- ["@tag.javascript"] = { fg = "#8ddb8c" }, + ["@tag.builtin.javascript"] = { fg = "#8ddb8c" }, + -- ["@tag.tsx"] = { fg = "#8ddb8c" }, + ["@string.special.url"] = { fg = palette.const, style = "italic" }, + ["@tag.delimiter.javascript"] = { fg = "fg1" }, + ["@tag.tsx"] = { fg = "#faa356" }, + ["@lsp.type.parameter"] = { fg = "#91cbff" }, + ["@property.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" }, + ["@lsp.type.property.lua"] = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, + ["@lsp.type.variable.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" }, + -- sparator new all + NvimTreeNormal = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, + NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, + NvimTreeIndentMarker = { fg = "#3E4450" }, + BufferLineFill = { bg = is_transparent and "NONE" or "bg1" }, + BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" }, + LualineNormal = { bg = is_transparent and "NONE" or "bg1" }, + StatusLine = { bg = is_transparent and "NONE" or "bg1" }, + StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" }, + Pmenu = { bg = is_transparent and "NONE" or "bg1" }, + PmenuSel = { link = "CursorLine" }, + WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" }, + LazyNormal = { bg = is_transparent and "NONE" or "bg1" }, + LazyBackground = { bg = is_transparent and "NONE" or "bg1" }, + NormalSB = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, -- normal text + NormalFloat = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, + IblIndent = { fg = "#3E4450" }, + WinBar = { bg = is_transparent and "NONE" or "bg1" }, + WinBarNC = { bg = is_transparent and "NONE" or "bg1" }, + }, + github_dark_high_contrast = { + NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, + }, + github_dark_dimmed = { + -- As with specs and palettes, a specific style's value will be used over the `all`'s value. + }, + }, + }) + end, +} diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 234b545..6628904 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -82,6 +82,9 @@ pcode.themes = { -- -- **:: Gruvbox Theme ::** -- -- gruvbox = "gruvbox", + -- + -- **:: Github Theme ::** -- + -- github = "github_dark_dimmed", } -- activate config transparent_bg pcode.transparent = false From 5146726772617e11e6b61f4dd82d07d32883ab8d Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Sun, 10 Nov 2024 00:15:26 +0700 Subject: [PATCH 22/59] enc: add java config project --- lazy-lock.json | 15 +++++++++++---- lua/pcode/user/autocmd.lua | 14 +++++++------- lua/pcode/user/custom.lua | 23 +++++++++++++++++++++++ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 69f5714..0dee908 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,6 +25,7 @@ "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, + "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, @@ -32,7 +33,7 @@ "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, - "noice.nvim": { "branch": "main", "commit": "eac7e84b16765066dc235a4d6cf8102d7436f6cd" }, + "noice.nvim": { "branch": "main", "commit": "2087bbf8cd64482b47fb5f33b5e0eabf329ab14b" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, @@ -40,6 +41,11 @@ "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, + "nvim-java": { "branch": "main", "commit": "905013eb83c58bda992724b3ecbe20f60b58513f" }, + "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, + "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, + "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, + "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, "nvim-lspconfig": { "branch": "master", "commit": "d01864641c6e43c681c3e9f6cf4745c75fdd9dcc" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, @@ -48,7 +54,7 @@ "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "c7639482a1598f4756798df1b2d72f79fe5bb34f" }, - "nvim-treesitter": { "branch": "master", "commit": "425b58968340bd5b4621c2a0d626c73556516d3d" }, + "nvim-treesitter": { "branch": "master", "commit": "0603b3e3d21ebe2fa82dc5361a3d500e0d3ad3a8" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, @@ -56,13 +62,14 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, + "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, - "toggleterm.nvim": { "branch": "main", "commit": "5969229c0352ff1ed7f6e24aba9c6554e1842939" }, + "toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, - "volt": { "branch": "main", "commit": "ff954757fdaf72da0dedd77bdf74718ea846f989" }, + "volt": { "branch": "main", "commit": "1df6698f7e5d19db578063412d12322e53376f5e" }, "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, "yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" }, "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } diff --git a/lua/pcode/user/autocmd.lua b/lua/pcode/user/autocmd.lua index c082a5a..54ff66b 100644 --- a/lua/pcode/user/autocmd.lua +++ b/lua/pcode/user/autocmd.lua @@ -117,10 +117,10 @@ vim.api.nvim_create_autocmd("ExitPre", { }) -- Create an autocmd to set keymap for Java files -vim.api.nvim_create_augroup("java_gradle_run", { clear = true }) -vim.api.nvim_create_autocmd("FileType", { - pattern = "java", - callback = function() - vim.api.nvim_set_keymap("n", "rg", "terminalgradle run", { noremap = true, silent = true }) - end, -}) +-- vim.api.nvim_create_augroup("java_gradle_run", { clear = true }) +-- vim.api.nvim_create_autocmd("FileType", { +-- pattern = "java", +-- callback = function() +-- vim.api.nvim_set_keymap("n", "rg", "terminalgradle run", { noremap = true, silent = true }) +-- end, +-- }) diff --git a/lua/pcode/user/custom.lua b/lua/pcode/user/custom.lua index cd0e85c..2477664 100644 --- a/lua/pcode/user/custom.lua +++ b/lua/pcode/user/custom.lua @@ -126,4 +126,27 @@ return { return opts end, }, + { + "nvim-java/nvim-java", + event = "VeryLazy", + config = function() + require("java").setup({ + notifications = { + -- enable 'Configuring DAP' & 'DAP configured' messages on start up + dap = false, + }, + }) + end, + keys = { + { "rg", "", desc = "Gradle" }, + { "rgp", "JavaProfile", desc = "Java Profile" }, + { "rgg", "terminalgradle run", desc = "Run Gradle" }, + { "rgb", "JavaBuildBuildWorkspace", desc = "Java Build Workspace" }, + { "rgd", "JavaDapConfig", desc = "Java Configure DAP" }, + { "T", "", desc = "Test" }, + { "Tc", "JavaTestRunCurrentClass", desc = "Test Current Class" }, + { "Tm", "JavaTestRunCurrentMethod", desc = "Test Current Method" }, + { "Th", "JavaTestViewLastReport", desc = "View Test Last Report" }, + }, + }, } From 17aee6c301ce89e0eefb5cb8873a70646d7b2740 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Mon, 11 Nov 2024 06:21:02 +0700 Subject: [PATCH 23/59] enc: add config java model 2 --- lazy-lock.json | 12 +++++----- lua/pcode/plugins/lang/java2.lua | 40 ++++++++++++++++++++++++++++++++ lua/pcode/user/custom.lua | 23 ------------------ lua/pcode/user/default.lua | 1 + 4 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 lua/pcode/plugins/lang/java2.lua diff --git a/lazy-lock.json b/lazy-lock.json index 0dee908..76dd51a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -18,13 +18,13 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "code_runner.nvim": { "branch": "main", "commit": "dcedccbf969a0f3bc00db446172b4966e83101dd" }, "codeium.vim": { "branch": "main", "commit": "8c01979323b2b480c8bf160d3ff85bd1668baa49" }, - "conform.nvim": { "branch": "master", "commit": "d28ccf945374edd9f1c34a82f6c22261dbd8ab98" }, + "conform.nvim": { "branch": "master", "commit": "e3263eabbfc1bdbc5b6a60ba8431b64e8dca0a79" }, "dressing.nvim": { "branch": "master", "commit": "6ef1ca479d37d4ff66f13eed44d08912caff483a" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, - "indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" }, - "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, + "indent-blankline.nvim": { "branch": "master", "commit": "e51b651ca26cba250ef3a1150c8d35045eee2a84" }, + "lazy.nvim": { "branch": "main", "commit": "60cf258a9ae7fffe04bb31141141a91845158dcc" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, @@ -47,14 +47,14 @@ "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "d01864641c6e43c681c3e9f6cf4745c75fdd9dcc" }, + "nvim-lspconfig": { "branch": "master", "commit": "4cb925e96288a71409a86c84fd97f4434a95453e" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, - "nvim-tree.lua": { "branch": "master", "commit": "c7639482a1598f4756798df1b2d72f79fe5bb34f" }, - "nvim-treesitter": { "branch": "master", "commit": "0603b3e3d21ebe2fa82dc5361a3d500e0d3ad3a8" }, + "nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" }, + "nvim-treesitter": { "branch": "master", "commit": "8e40904e49bbad5812798eb54be8c00d77cdd301" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, diff --git a/lua/pcode/plugins/lang/java2.lua b/lua/pcode/plugins/lang/java2.lua new file mode 100644 index 0000000..6db9d45 --- /dev/null +++ b/lua/pcode/plugins/lang/java2.lua @@ -0,0 +1,40 @@ +return { + "nvim-java/nvim-java", + event = "VeryLazy", + config = function() + require("java").setup({ + notifications = { + dap = false, + }, + jdk = { + auto_install = false, + }, + }) + require("lspconfig").jdtls.setup({ + settings = { + java = { + configuration = { + runtimes = { + { + name = "JavaSE-17", + path = os.getenv("JAVA_HOME") or "", + default = true, + }, + }, + }, + }, + }, + }) + end, + keys = { + { "rg", "", desc = "Gradle" }, + { "rgp", "JavaProfile", desc = "Java Profile" }, + { "rgg", "terminalgradle run", desc = "Run Gradle" }, + { "rgb", "JavaBuildBuildWorkspace", desc = "Java Build Workspace" }, + { "rgd", "JavaDapConfig", desc = "Java Configure DAP" }, + { "T", "", desc = "Test" }, + { "Tc", "JavaTestRunCurrentClass", desc = "Test Current Class" }, + { "Tm", "JavaTestRunCurrentMethod", desc = "Test Current Method" }, + { "Th", "JavaTestViewLastReport", desc = "View Test Last Report" }, + }, +} diff --git a/lua/pcode/user/custom.lua b/lua/pcode/user/custom.lua index 2477664..cd0e85c 100644 --- a/lua/pcode/user/custom.lua +++ b/lua/pcode/user/custom.lua @@ -126,27 +126,4 @@ return { return opts end, }, - { - "nvim-java/nvim-java", - event = "VeryLazy", - config = function() - require("java").setup({ - notifications = { - -- enable 'Configuring DAP' & 'DAP configured' messages on start up - dap = false, - }, - }) - end, - keys = { - { "rg", "", desc = "Gradle" }, - { "rgp", "JavaProfile", desc = "Java Profile" }, - { "rgg", "terminalgradle run", desc = "Run Gradle" }, - { "rgb", "JavaBuildBuildWorkspace", desc = "Java Build Workspace" }, - { "rgd", "JavaDapConfig", desc = "Java Configure DAP" }, - { "T", "", desc = "Test" }, - { "Tc", "JavaTestRunCurrentClass", desc = "Test Current Class" }, - { "Tm", "JavaTestRunCurrentMethod", desc = "Test Current Method" }, - { "Th", "JavaTestViewLastReport", desc = "View Test Last Report" }, - }, - }, } diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 6628904..a88bd17 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -6,6 +6,7 @@ pcode.lang = { deno = false, golang = false, java = false, + java2 = true, javascript = false, kotlin = false, markdown = false, From 292e79137f169b7363f002c4ce38df3abd474355 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Mon, 11 Nov 2024 22:47:41 +0700 Subject: [PATCH 24/59] enc: add dynamic project gradle and maven --- lazy-lock.json | 22 +- lua/pcode/plugins/lang/java.lua | 546 ++++++++++++++++---------------- lua/pcode/user/default.lua | 2 +- 3 files changed, 287 insertions(+), 283 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 76dd51a..18f86c5 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,7 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "2737edc9e674e537dc0a97e3405658d57d2d31ed" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, @@ -18,14 +19,13 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "code_runner.nvim": { "branch": "main", "commit": "dcedccbf969a0f3bc00db446172b4966e83101dd" }, "codeium.vim": { "branch": "main", "commit": "8c01979323b2b480c8bf160d3ff85bd1668baa49" }, - "conform.nvim": { "branch": "master", "commit": "e3263eabbfc1bdbc5b6a60ba8431b64e8dca0a79" }, - "dressing.nvim": { "branch": "master", "commit": "6ef1ca479d37d4ff66f13eed44d08912caff483a" }, + "conform.nvim": { "branch": "master", "commit": "8c354323201d04530727d8bdcc4669791ee082ef" }, + "dressing.nvim": { "branch": "master", "commit": "43b8f74e0b1e3f41e51f640f8efa3bcd401cea0d" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, - "indent-blankline.nvim": { "branch": "master", "commit": "e51b651ca26cba250ef3a1150c8d35045eee2a84" }, - "lazy.nvim": { "branch": "main", "commit": "60cf258a9ae7fffe04bb31141141a91845158dcc" }, - "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, + "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, @@ -33,6 +33,8 @@ "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, + "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, + "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, "noice.nvim": { "branch": "main", "commit": "2087bbf8cd64482b47fb5f33b5e0eabf329ab14b" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, @@ -41,11 +43,7 @@ "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, - "nvim-java": { "branch": "main", "commit": "905013eb83c58bda992724b3ecbe20f60b58513f" }, - "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, - "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, - "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, - "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, + "nvim-jdtls": { "branch": "master", "commit": "c4279b8ffce9b64eb302056d78dfebc2968a49bc" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, "nvim-lspconfig": { "branch": "master", "commit": "4cb925e96288a71409a86c84fd97f4434a95453e" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, @@ -54,7 +52,7 @@ "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" }, - "nvim-treesitter": { "branch": "master", "commit": "8e40904e49bbad5812798eb54be8c00d77cdd301" }, + "nvim-treesitter": { "branch": "master", "commit": "bb06afa3f1111780932b3c5493ad65473ce85f9d" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, @@ -62,7 +60,7 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, - "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, + "symbols-outline.nvim": { "branch": "master", "commit": "964c5902243446124417a3a9e9454f5ef032cc36" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" }, diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 5f4fdd1..abb776d 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -7,248 +7,254 @@ local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" } ---@param config table ---@param custom function | table | nil local function extend_or_override(config, custom, ...) - if type(custom) == "function" then - config = custom(config, ...) or config - elseif custom then - config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] - end - return config + if type(custom) == "function" then + config = custom(config, ...) or config + elseif custom then + config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] + end + return config end M = { - { - "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - opts.skip_config = opts.skip_config or {} - vim.list_extend(opts.skip_config, { "jdtls" }) - end, - }, - { - "mfussenegger/nvim-jdtls", - ft = java_filetypes, - enabled = true, - opts = function() - return { - root_dir = require("jdtls.setup").find_root(root_markers), - project_name = function() - return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") - end, + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + opts.skip_config = opts.skip_config or {} + vim.list_extend(opts.skip_config, { "jdtls" }) + end, + }, + { + "mfussenegger/nvim-jdtls", + ft = java_filetypes, + enabled = true, + opts = function() + return { + root_dir = require("jdtls.setup").find_root(root_markers), + project_name = function() + return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + end, - -- Where are the config and workspace dirs for a project? - jdtls_config_dir = function(project_name) - return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" - end, - jdtls_workspace_dir = function(project_name) - return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" - end, - cmd = { vim.fn.exepath("jdtls") }, - full_cmd = function(opts) - local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") - local cmd = vim.deepcopy(opts.cmd) - if project_name then - vim.list_extend(cmd, { - "-configuration", - opts.jdtls_config_dir(project_name), - "-data", - opts.jdtls_workspace_dir(project_name), - }) - end - return cmd - end, + -- Where are the config and workspace dirs for a project? + jdtls_config_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" + end, + jdtls_workspace_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" + end, + cmd = { vim.fn.exepath("jdtls") }, + full_cmd = function(opts) + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + local cmd = vim.deepcopy(opts.cmd) + if project_name then + vim.list_extend(cmd, { + "-configuration", + opts.jdtls_config_dir(project_name), + "-data", + opts.jdtls_workspace_dir(project_name), + }) + end + return cmd + end, - -- These depend on nvim-dap, but can additionally be disabled by setting false here. - dap = { hotcodereplace = "auto", config_overrides = {} }, - dap_main = {}, - test = true, - settings = { - java = { - inlayHints = { - parameterNames = { - enabled = "all", - }, - }, - }, - }, - } - end, - config = function(_, opts) - local opt = vim.opt - opt.shiftwidth = 4 - opt.tabstop = 4 - opt.softtabstop = 4 - opt.ts = 4 - opt.expandtab = true + -- These depend on nvim-dap, but can additionally be disabled by setting false here. + dap = { hotcodereplace = "auto", config_overrides = {} }, + dap_main = {}, + test = true, + settings = { + java = { + inlayHints = { + parameterNames = { + enabled = "all", + }, + }, + }, + }, + } + end, + config = function(_, opts) + local opt = vim.opt + opt.shiftwidth = 4 + opt.tabstop = 4 + opt.softtabstop = 4 + opt.ts = 4 + opt.expandtab = true - local mason_registry = require("mason-registry") - local bundles = {} ---@type string[] - if opts.dap and mason_registry.is_installed("java-debug-adapter") then - local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") - local java_dbg_path = java_dbg_pkg:get_install_path() - local jar_patterns = { - java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", - } - -- java-test also depends on java-debug-adapter. - if opts.test and mason_registry.is_installed("java-test") then - local java_test_pkg = mason_registry.get_package("java-test") - local java_test_path = java_test_pkg:get_install_path() - vim.list_extend(jar_patterns, { - java_test_path .. "/extension/server/*.jar", - }) - end - for _, jar_pattern in ipairs(jar_patterns) do - for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do - table.insert(bundles, bundle) - end - end - end + local mason_registry = require("mason-registry") + local bundles = {} ---@type string[] + if opts.dap and mason_registry.is_installed("java-debug-adapter") then + local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") + local java_dbg_path = java_dbg_pkg:get_install_path() + local jar_patterns = { + java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", + } + -- java-test also depends on java-debug-adapter. + if opts.test and mason_registry.is_installed("java-test") then + local java_test_pkg = mason_registry.get_package("java-test") + local java_test_path = java_test_pkg:get_install_path() + vim.list_extend(jar_patterns, { + java_test_path .. "/extension/server/*.jar", + }) + end + for _, jar_pattern in ipairs(jar_patterns) do + for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do + table.insert(bundles, bundle) + end + end + end - local function attach_jdtls() - local fname = vim.api.nvim_buf_get_name(0) + local function attach_jdtls() + local fname = vim.api.nvim_buf_get_name(0) - -- Configuration can be augmented and overridden by opts.jdtls - local config = extend_or_override({ - cmd = opts.full_cmd(opts), - root_dir = require("jdtls.setup").find_root(root_markers), - init_options = { - bundles = bundles, - }, - settings = opts.settings, - -- enable CMP capabilities - -- capabilities = require("user.lsp.handlers").capabilities or nil, - capabilities = require("auto-lsp.lsp.handlers").capabilities or nil, - }, opts.jdtls) + -- Configuration can be augmented and overridden by opts.jdtls + local config = extend_or_override({ + cmd = opts.full_cmd(opts), + root_dir = require("jdtls.setup").find_root(root_markers), + init_options = { + bundles = bundles, + }, + settings = opts.settings, + -- enable CMP capabilities + -- capabilities = require("user.lsp.handlers").capabilities or nil, + capabilities = require("auto-lsp.lsp.handlers").capabilities or nil, + }, opts.jdtls) - -- Existing server will be reused if the root_dir matches. - require("jdtls").start_or_attach(config) - -- not need to require("jdtls.setup").add_commands(), start automatically adds commands - end + -- Existing server will be reused if the root_dir matches. + require("jdtls").start_or_attach(config) + -- not need to require("jdtls.setup").add_commands(), start automatically adds commands + end - vim.api.nvim_create_autocmd("FileType", { - pattern = java_filetypes, - callback = attach_jdtls, - }) + vim.api.nvim_create_autocmd("FileType", { + pattern = java_filetypes, + callback = attach_jdtls, + }) - -- Setup keymap and dap after the lsp is fully attached. - -- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration - -- https://neovim.io/doc/user/lsp.html#LspAttach - vim.api.nvim_create_autocmd("LspAttach", { - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - if client and client.name == "jdtls" then - local wk = require("which-key") - wk.add({ - { - mode = "n", - buffer = args.buf, - { "cx", group = "extract" }, - { "cxv", require("jdtls").extract_variable_all, desc = "Extract Variable" }, - { "cxc", require("jdtls").extract_constant, desc = "Extract Constant" }, - { "gs", require("jdtls").super_implementation, desc = "Goto Super" }, - { "co", require("jdtls").organize_imports, desc = "Organize Imports" }, - }, - }) - wk.add({ - { - mode = "v", - buffer = args.buf, - { "cx", group = "extract" }, - { - "cxm", - [[lua require('jdtls').extract_method(true)]], - desc = "Extract Method", - }, - { - "cxv", - [[lua require('jdtls').extract_variable_all(true)]], - desc = "Extract Variable", - }, - { - "cxc", - [[lua require('jdtls').extract_constant(true)]], - desc = "Extract Constant", - }, - }, - }) - if opts.dap and mason_registry.is_installed("java-debug-adapter") then - -- custom init for Java debugger - require("jdtls").setup_dap(opts.dap) - require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) + -- Setup keymap and dap after the lsp is fully attached. + -- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration + -- https://neovim.io/doc/user/lsp.html#LspAttach + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client and client.name == "jdtls" then + local wk = require("which-key") + wk.add({ + { + mode = "n", + buffer = args.buf, + { "cx", group = "extract" }, + { "cxv", require("jdtls").extract_variable_all, desc = "Extract Variable" }, + { "cxc", require("jdtls").extract_constant, desc = "Extract Constant" }, + { "gs", require("jdtls").super_implementation, desc = "Goto Super" }, + { "co", require("jdtls").organize_imports, desc = "Organize Imports" }, + }, + }) + wk.add({ + { + mode = "v", + buffer = args.buf, + { "cx", group = "extract" }, + { + "cxm", + [[lua require('jdtls').extract_method(true)]], + desc = "Extract Method", + }, + { + "cxv", + [[lua require('jdtls').extract_variable_all(true)]], + desc = "Extract Variable", + }, + { + "cxc", + [[lua require('jdtls').extract_constant(true)]], + desc = "Extract Constant", + }, + }, + }) + if opts.dap and mason_registry.is_installed("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap(opts.dap) + require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) - -- Java Test require Java debugger to work - -- if opts.test and mason_registry.is_installed("java-test") then - -- -- custom keymaps for Java test runner (not yet compatible with neotest) - -- wk.register({ - -- ["t"] = { name = "+test" }, - -- ["tt"] = { require("jdtls.dap").test_class, "Run All Test" }, - -- ["tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" }, - -- ["tT"] = { require("jdtls.dap").pick_test, "Run Test" }, - -- }, { mode = "n", buffer = args.buf }) - -- end - end + -- Java Test require Java debugger to work + -- if opts.test and mason_registry.is_installed("java-test") then + -- -- custom keymaps for Java test runner (not yet compatible with neotest) + -- wk.register({ + -- ["t"] = { name = "+test" }, + -- ["tt"] = { require("jdtls.dap").test_class, "Run All Test" }, + -- ["tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" }, + -- ["tT"] = { require("jdtls.dap").pick_test, "Run Test" }, + -- }, { mode = "n", buffer = args.buf }) + -- end + end - -- User can set additional keymaps in opts.on_attach - if opts.on_attach then - opts.on_attach(args) - end - end - end, - }) + -- User can set additional keymaps in opts.on_attach + if opts.on_attach then + opts.on_attach(args) + end + end + end, + }) - -- Avoid race condition by calling attach the first time, since the autocmd won't fire. - attach_jdtls() - end, - }, - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "java" }) - end, - }, - { - "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "jdtls" }) - end, - }, - { - "pojokcodeid/auto-conform.nvim", - event = "VeryLazy", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { "java-debug-adapter", "java-test" }) - opts.formatters_by_ft.java = { "lsp_fmt" } - end, - }, - { - "nvim-neotest/neotest", - dependencies = { - "nvim-neotest/nvim-nio", - "nvim-lua/plenary.nvim", - "antoinemadec/FixCursorHold.nvim", - "nvim-treesitter/nvim-treesitter", - "andy-bell101/neotest-java", - }, - config = function() - require("neotest").setup({ - adapters = { - require("neotest-java")({ - -- function to determine which runner to use based on project path - determine_runner = function(project_root_path) - -- return should be "maven" or "gradle" - return "gradle" - end, - -- override the builtin runner discovery behaviour to always use given - -- tool. Default is "nil", so no override - force_runner = nil, - -- if the automatic runner discovery can't uniquely determine whether - -- to use Gradle or Maven, fallback to using this runner. Default is - -- "gradle or maven" - fallback_runner = "gradle", - }), - }, - }) - end, + -- Avoid race condition by calling attach the first time, since the autocmd won't fire. + attach_jdtls() + end, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "java" }) + end, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "jdtls" }) + end, + }, + { + "pojokcodeid/auto-conform.nvim", + event = "VeryLazy", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { "java-debug-adapter", "java-test" }) + opts.formatters_by_ft.java = { "lsp_fmt" } + end, + }, + { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + "andy-bell101/neotest-java", + }, + config = function() + local project_type = "maven" + local gradle_file = vim.fn.findfile("build.gradle", vim.fn.getcwd()) + if gradle_file then + project_type = "gradle" + end + + require("neotest").setup({ + adapters = { + require("neotest-java")({ + -- function to determine which runner to use based on project path + determine_runner = function(project_root_path) + -- return should be "maven" or "gradle" + return project_type + end, + -- override the builtin runner discovery behaviour to always use given + -- tool. Default is "nil", so no override + force_runner = nil, + -- if the automatic runner discovery can't uniquely determine whether + -- to use Gradle or Maven, fallback to using this runner. Default is + -- "gradle or maven" + fallback_runner = project_type, + }), + }, + }) + end, -- stylua: ignore keys = { { "T","",desc="  Test"}, @@ -262,48 +268,48 @@ M = { { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, { "rg", "terminalgradle run", desc = "Run Gradle", mode = "n" }, }, - }, - { - "rockerBOO/symbols-outline.nvim", - cmd = "SymbolsOutline", - config = function() - require("symbols-outline").setup({ - symbols = { - File = { icon = "󰈔", hl = "@text.uri" }, - Module = { icon = "", hl = "@namespace" }, - Namespace = { icon = "󰅪", hl = "@namespace" }, - Package = { icon = "", hl = "@namespace" }, - Class = { icon = "𝓒", hl = "@type" }, - Method = { icon = "ƒ", hl = "@method" }, - Property = { icon = "", hl = "@method" }, - Field = { icon = "", hl = "@field" }, - Constructor = { icon = "", hl = "@constructor" }, - Enum = { icon = "ℰ", hl = "@type" }, - Interface = { icon = "", hl = "@type" }, - Function = { icon = "", hl = "@function" }, - Variable = { icon = "", hl = "@constant" }, - Constant = { icon = "", hl = "@constant" }, - String = { icon = "𝓐", hl = "@string" }, - Number = { icon = "#", hl = "@number" }, - Boolean = { icon = "󰨙 ", hl = "@boolean" }, - Array = { icon = "", hl = "@constant" }, - Object = { icon = "⦿", hl = "@type" }, - Key = { icon = "🔐", hl = "@type" }, - Null = { icon = "NULL", hl = "@type" }, - EnumMember = { icon = "", hl = "@field" }, - Struct = { icon = "𝓢", hl = "@type" }, - Event = { icon = "🗲", hl = "@type" }, - Operator = { icon = "+", hl = "@operator" }, - TypeParameter = { icon = "𝙏", hl = "@parameter" }, - Component = { icon = "󰅴", hl = "@function" }, - Fragment = { icon = "󰅴", hl = "@constant" }, - }, - }) - end, - keys = { - { "S", "SymbolsOutline", desc = "Toggle Outline" }, - }, - }, + }, + { + "rockerBOO/symbols-outline.nvim", + cmd = "SymbolsOutline", + config = function() + require("symbols-outline").setup({ + symbols = { + File = { icon = "󰈔", hl = "@text.uri" }, + Module = { icon = "", hl = "@namespace" }, + Namespace = { icon = "󰅪", hl = "@namespace" }, + Package = { icon = "", hl = "@namespace" }, + Class = { icon = "𝓒", hl = "@type" }, + Method = { icon = "ƒ", hl = "@method" }, + Property = { icon = "", hl = "@method" }, + Field = { icon = "", hl = "@field" }, + Constructor = { icon = "", hl = "@constructor" }, + Enum = { icon = "ℰ", hl = "@type" }, + Interface = { icon = "", hl = "@type" }, + Function = { icon = "", hl = "@function" }, + Variable = { icon = "", hl = "@constant" }, + Constant = { icon = "", hl = "@constant" }, + String = { icon = "𝓐", hl = "@string" }, + Number = { icon = "#", hl = "@number" }, + Boolean = { icon = "󰨙 ", hl = "@boolean" }, + Array = { icon = "", hl = "@constant" }, + Object = { icon = "⦿", hl = "@type" }, + Key = { icon = "🔐", hl = "@type" }, + Null = { icon = "NULL", hl = "@type" }, + EnumMember = { icon = "", hl = "@field" }, + Struct = { icon = "𝓢", hl = "@type" }, + Event = { icon = "🗲", hl = "@type" }, + Operator = { icon = "+", hl = "@operator" }, + TypeParameter = { icon = "𝙏", hl = "@parameter" }, + Component = { icon = "󰅴", hl = "@function" }, + Fragment = { icon = "󰅴", hl = "@constant" }, + }, + }) + end, + keys = { + { "S", "SymbolsOutline", desc = "Toggle Outline" }, + }, + }, } return M diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index a88bd17..daf97c2 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -6,7 +6,7 @@ pcode.lang = { deno = false, golang = false, java = false, - java2 = true, + java2 = false, javascript = false, kotlin = false, markdown = false, From 5ab63cdf430650ef1d692396dcdd5ea8f51d5a7d Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Mon, 11 Nov 2024 23:03:22 +0700 Subject: [PATCH 25/59] enc: add java key mapping --- lua/pcode/plugins/lang/java.lua | 86 +++++++++++++++------------------ 1 file changed, 39 insertions(+), 47 deletions(-) diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index abb776d..325589f 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -18,10 +18,28 @@ end M = { { "williamboman/mason-lspconfig.nvim", + -- stylua: ignore opts = function(_, opts) opts.skip_config = opts.skip_config or {} vim.list_extend(opts.skip_config, { "jdtls" }) + -- Set vim motion for + l + h to show code documentation about the code the cursor is currently over if available + vim.keymap.set("n", "lh", vim.lsp.buf.hover, { desc = "Code Hover Documentation" }) + -- Set vim motion for + l + d to go where the code/variable under the cursor was defined + vim.keymap.set("n", "ld", vim.lsp.buf.definition, { desc = "Code Goto Definition" }) + -- Set vim motion for + l + a for display code action suggestions for code diagnostics in both normal and visual mode + vim.keymap.set({ "n", "v" }, "la", vim.lsp.buf.code_action, { desc = "Code Actions" }) + -- Set vim motion for + l + r to display references to the code under the cursor + vim.keymap.set("n", "lr", require("telescope.builtin").lsp_references, { desc = "Code Goto References" }) + -- Set vim motion for + l + i to display implementations to the code under the cursor + vim.keymap.set("n", "li", require("telescope.builtin").lsp_implementations, { desc = "Code Goto Implementations" }) + -- Set a vim motion for + l + R to smartly rename the code under the cursor + vim.keymap.set("n", "lR", vim.lsp.buf.rename, { desc = "Code Rename" }) + -- Set a vim motion for + l + D to go to where the code/object was declared in the project (class file) + vim.keymap.set("n", "lD", vim.lsp.buf.declaration, { desc = "Code Goto Declaration" }) end, + keys = { + { "l", "", desc = "LSP", mode = { "n", "v" } }, + }, }, { "mfussenegger/nvim-jdtls", @@ -103,8 +121,6 @@ M = { end local function attach_jdtls() - local fname = vim.api.nvim_buf_get_name(0) - -- Configuration can be augmented and overridden by opts.jdtls local config = extend_or_override({ cmd = opts.full_cmd(opts), @@ -134,56 +150,32 @@ M = { vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) + -- stylua: ignore if client and client.name == "jdtls" then - local wk = require("which-key") - wk.add({ - { - mode = "n", - buffer = args.buf, - { "cx", group = "extract" }, - { "cxv", require("jdtls").extract_variable_all, desc = "Extract Variable" }, - { "cxc", require("jdtls").extract_constant, desc = "Extract Constant" }, - { "gs", require("jdtls").super_implementation, desc = "Goto Super" }, - { "co", require("jdtls").organize_imports, desc = "Organize Imports" }, - }, - }) - wk.add({ - { - mode = "v", - buffer = args.buf, - { "cx", group = "extract" }, - { - "cxm", - [[lua require('jdtls').extract_method(true)]], - desc = "Extract Method", - }, - { - "cxv", - [[lua require('jdtls').extract_variable_all(true)]], - desc = "Extract Variable", - }, - { - "cxc", - [[lua require('jdtls').extract_constant(true)]], - desc = "Extract Constant", - }, - }, - }) + -- add keymaps + vim.keymap.set('n', 'J', "", { desc = "Java" }) + -- Set a Vim motion to + J + o to organize imports in normal mode + vim.keymap.set('n', 'Jo', " lua require('jdtls').organize_imports()", { desc = "Java Organize Imports" }) + -- Set a Vim motion to + J + v to extract the code under the cursor to a variable + vim.keymap.set('n', 'Jv', " lua require('jdtls').extract_variable()", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + v to extract the code selected in visual mode to a variable + vim.keymap.set('v', 'Jv', " lua require('jdtls').extract_variable(true)", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + C to extract the code under the cursor to a static variable + vim.keymap.set('n', 'JC', " lua require('jdtls').extract_constant()", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + C to extract the code selected in visual mode to a static variable + vim.keymap.set('v', 'JC', " lua require('jdtls').extract_constant(true)", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + t to run the test method currently under the cursor + vim.keymap.set('n', 'Jt', " lua require('jdtls').test_nearest_method()", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + t to run the test method that is currently selected in visual mode + vim.keymap.set('v', 'Jt', " lua require('jdtls').test_nearest_method(true)", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + T to run an entire test suite (class) + vim.keymap.set('n', 'JT', " lua require('jdtls').test_class()", { desc = "Java Test Class" }) + -- Set a Vim motion to + J + u to update the project configuration + vim.keymap.set('n', 'Ju', " JdtUpdateConfig", { desc = "Java Update Config" }) if opts.dap and mason_registry.is_installed("java-debug-adapter") then -- custom init for Java debugger require("jdtls").setup_dap(opts.dap) require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) - - -- Java Test require Java debugger to work - -- if opts.test and mason_registry.is_installed("java-test") then - -- -- custom keymaps for Java test runner (not yet compatible with neotest) - -- wk.register({ - -- ["t"] = { name = "+test" }, - -- ["tt"] = { require("jdtls.dap").test_class, "Run All Test" }, - -- ["tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" }, - -- ["tT"] = { require("jdtls.dap").pick_test, "Run Test" }, - -- }, { mode = "n", buffer = args.buf }) - -- end end -- User can set additional keymaps in opts.on_attach From db41fc7e005c18c8eaa6d7f9ad7d0fa00bc6b026 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 12 Nov 2024 07:30:58 +0700 Subject: [PATCH 26/59] enc: update config jdtls --- lazy-lock.json | 2 +- lua/pcode/plugins/lang/java.lua | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 18f86c5..0b52fe5 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,7 +2,7 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "2737edc9e674e537dc0a97e3405658d57d2d31ed" }, + "LuaSnip": { "branch": "master", "commit": "48a02259693cb7bbbd1092993406773d5ce14664" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 325589f..4da43c5 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -15,6 +15,25 @@ local function extend_or_override(config, custom, ...) return config end +local function capabilities() + local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") + if status_ok then + return cmp_nvim_lsp.default_capabilities() + end + + local CAPABILITIES = vim.lsp.protocol.make_client_capabilities() + CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true + CAPABILITIES.textDocument.completion.completionItem.resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + }, + } + + return CAPABILITIES +end + M = { { "williamboman/mason-lspconfig.nvim", @@ -131,7 +150,8 @@ M = { settings = opts.settings, -- enable CMP capabilities -- capabilities = require("user.lsp.handlers").capabilities or nil, - capabilities = require("auto-lsp.lsp.handlers").capabilities or nil, + -- capabilities = require("auto-lsp.lsp.handlers").capabilities or nil, + capabilities = capabilities() or nil, }, opts.jdtls) -- Existing server will be reused if the root_dir matches. From b3f5ec56199b459454143e55d426f3f95a1441be Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 12 Nov 2024 07:37:07 +0700 Subject: [PATCH 27/59] enc: set default auto_onatach navic --- lua/pcode/plugins/extras/navic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/pcode/plugins/extras/navic.lua b/lua/pcode/plugins/extras/navic.lua index e65a5f0..eb1a1da 100644 --- a/lua/pcode/plugins/extras/navic.lua +++ b/lua/pcode/plugins/extras/navic.lua @@ -16,7 +16,7 @@ function M.config() require("nvim-navic").setup({ icons = icons, lsp = { - auto_attach = false, + auto_attach = true, preference = nil, }, highlight = false, From e9e0ca3e88f577c001875fd2d68befe534ce59d5 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 12 Nov 2024 09:56:50 +0700 Subject: [PATCH 28/59] add: auto config for jdtls --- lua/auto-jdtls/init.lua | 7 ++ lua/auto-jdtls/utils.lua | 201 +++++++++++++++++++++++++++++++ lua/pcode/plugins/lang/java3.lua | 135 +++++++++++++++++++++ lua/pcode/user/default.lua | 1 + 4 files changed, 344 insertions(+) create mode 100644 lua/auto-jdtls/init.lua create mode 100644 lua/auto-jdtls/utils.lua create mode 100644 lua/pcode/plugins/lang/java3.lua diff --git a/lua/auto-jdtls/init.lua b/lua/auto-jdtls/init.lua new file mode 100644 index 0000000..b8b0f1f --- /dev/null +++ b/lua/auto-jdtls/init.lua @@ -0,0 +1,7 @@ +local M = {} + +M.setup = function() + require("auto-jdtls.utils").attach_jdtls() +end + +return M diff --git a/lua/auto-jdtls/utils.lua b/lua/auto-jdtls/utils.lua new file mode 100644 index 0000000..c365e2d --- /dev/null +++ b/lua/auto-jdtls/utils.lua @@ -0,0 +1,201 @@ +local M = {} +M.java_filetypes = { "java" } +M.root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" } + +-- Utility function to extend or override a config table, similar to the way +-- that Plugin.opts works. +---@param config table +---@param custom function | table | nil +M.extend_or_override = function(config, custom, ...) + if type(custom) == "function" then + config = custom(config, ...) or config + elseif custom then + config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] + end + return config +end + +function M.capabilities() + local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") + if status_ok then + return cmp_nvim_lsp.default_capabilities() + end + + local CAPABILITIES = vim.lsp.protocol.make_client_capabilities() + CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true + CAPABILITIES.textDocument.completion.completionItem.resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + }, + } + + return CAPABILITIES +end +-- stylua: ignore +M.lsp_keymaps=function () + vim.keymap.set({ "n", "v" }, "l", "", { desc = "LSP" }) + -- Set vim motion for + l + h to show code documentation about the code the cursor is currently over if available + vim.keymap.set("n", "lh", vim.lsp.buf.hover, { desc = "Code Hover Documentation" }) + -- Set vim motion for + l + d to go where the code/variable under the cursor was defined + vim.keymap.set("n", "ld", vim.lsp.buf.definition, { desc = "Code Goto Definition" }) + -- Set vim motion for + l + a for display code action suggestions for code diagnostics in both normal and visual mode + vim.keymap.set({ "n", "v" }, "la", vim.lsp.buf.code_action, { desc = "Code Actions" }) + -- Set vim motion for + l + r to display references to the code under the cursor + vim.keymap.set("n", "lr", require("telescope.builtin").lsp_references, { desc = "Code Goto References" }) + -- Set vim motion for + l + i to display implementations to the code under the cursor + vim.keymap.set("n", "li", require("telescope.builtin").lsp_implementations, { desc = "Code Goto Implementations" }) + -- Set a vim motion for + l + R to smartly rename the code under the cursor + vim.keymap.set("n", "lR", vim.lsp.buf.rename, { desc = "Code Rename" }) + -- Set a vim motion for + l + D to go to where the code/object was declared in the project (class file) + vim.keymap.set("n", "lD", vim.lsp.buf.declaration, { desc = "Code Goto Declaration" }) +end + +-- stylua: ignore +M.jdtls_keymaps=function () + -- add keymaps + vim.keymap.set('n', 'J', "", { desc = "Java" }) + -- Set a Vim motion to + J + o to organize imports in normal mode + vim.keymap.set('n', 'Jo', " lua require('jdtls').organize_imports()", { desc = "Java Organize Imports" }) + -- Set a Vim motion to + J + v to extract the code under the cursor to a variable + vim.keymap.set('n', 'Jv', " lua require('jdtls').extract_variable()", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + v to extract the code selected in visual mode to a variable + vim.keymap.set('v', 'Jv', " lua require('jdtls').extract_variable(true)", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + C to extract the code under the cursor to a static variable + vim.keymap.set('n', 'JC', " lua require('jdtls').extract_constant()", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + C to extract the code selected in visual mode to a static variable + vim.keymap.set('v', 'JC', " lua require('jdtls').extract_constant(true)", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + t to run the test method currently under the cursor + vim.keymap.set('n', 'Jt', " lua require('jdtls').test_nearest_method()", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + t to run the test method that is currently selected in visual mode + vim.keymap.set('v', 'Jt', " lua require('jdtls').test_nearest_method(true)", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + T to run an entire test suite (class) + vim.keymap.set('n', 'JT', " lua require('jdtls').test_class()", { desc = "Java Test Class" }) + -- Set a Vim motion to + J + u to update the project configuration + vim.keymap.set('n', 'Ju', " JdtUpdateConfig", { desc = "Java Update Config" }) +end + +M.opts = { + root_dir = require("jdtls.setup").find_root(M.root_markers), + project_name = function() + return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + end, + + -- Where are the config and workspace dirs for a project? + jdtls_config_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" + end, + jdtls_workspace_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" + end, + cmd = { vim.fn.exepath("jdtls") }, + full_cmd = function(opts) + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + local cmd = vim.deepcopy(opts.cmd) + if project_name then + vim.list_extend(cmd, { + "-configuration", + opts.jdtls_config_dir(project_name), + "-data", + opts.jdtls_workspace_dir(project_name), + }) + end + return cmd + end, + + -- These depend on nvim-dap, but can additionally be disabled by setting false here. + dap = { hotcodereplace = "auto", config_overrides = {} }, + dap_main = {}, + test = true, + settings = { + java = { + inlayHints = { + parameterNames = { + enabled = "all", + }, + }, + }, + }, +} + +M.attach_jdtls = function() + local opt = vim.opt + opt.shiftwidth = 4 + opt.tabstop = 4 + opt.softtabstop = 4 + opt.ts = 4 + opt.expandtab = true + + local mason_registry = require("mason-registry") + local bundles = {} ---@type string[] + if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then + local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") + local java_dbg_path = java_dbg_pkg:get_install_path() + local jar_patterns = { + java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", + } + -- java-test also depends on java-debug-adapter. + if M.opts.test and mason_registry.is_installed("java-test") then + local java_test_pkg = mason_registry.get_package("java-test") + local java_test_path = java_test_pkg:get_install_path() + vim.list_extend(jar_patterns, { + java_test_path .. "/extension/server/*.jar", + }) + end + for _, jar_pattern in ipairs(jar_patterns) do + for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do + table.insert(bundles, bundle) + end + end + end + -- initialisasi config + local function attach_jdtls() + -- Configuration can be augmented and overridden by opts.jdtls + local config = M.extend_or_override({ + cmd = M.opts.full_cmd(M.opts), + root_dir = require("jdtls.setup").find_root(M.root_markers), + init_options = { + bundles = bundles, + }, + settings = M.opts.settings, + -- enable CMP capabilities + -- capabilities = require("user.lsp.handlers").capabilities or nil, + -- capabilities = require("auto-lsp.lsp.handlers").capabilities or nil, + capabilities = M.capabilities() or nil, + }, M.opts.jdtls) + + -- Existing server will be reused if the root_dir matches. + require("jdtls").start_or_attach(config) + end + + vim.api.nvim_create_autocmd("FileType", { + pattern = M.java_filetypes, + callback = attach_jdtls, + }) + + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + -- stylua: ignore + if client and client.name == "jdtls" then + M.jdtls_keymaps() + M.lsp_keymaps() + if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap(M.opts.dap) + require("jdtls.dap").setup_dap_main_class_configs(M.opts.dap_main) + end + + -- User can set additional keymaps in opts.on_attach + if M.opts.on_attach then + M.opts.on_attach(args) + end + end + end, + }) + + attach_jdtls() +end + +return M diff --git a/lua/pcode/plugins/lang/java3.lua b/lua/pcode/plugins/lang/java3.lua new file mode 100644 index 0000000..12e37e0 --- /dev/null +++ b/lua/pcode/plugins/lang/java3.lua @@ -0,0 +1,135 @@ +local M = {} +M = { + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + opts.skip_config = opts.skip_config or {} + vim.list_extend(opts.skip_config, { "jdtls" }) + end, + keys = { + { "l", "", desc = "LSP", mode = { "n", "v" } }, + }, + }, + { + "mfussenegger/nvim-jdtls", + ft = { "java" }, + enabled = true, + config = function() + require("auto-jdtls").setup() + end, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "java" }) + end, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "jdtls" }) + end, + }, + { + "pojokcodeid/auto-conform.nvim", + event = "VeryLazy", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { "java-debug-adapter", "java-test" }) + opts.formatters_by_ft.java = { "lsp_fmt" } + end, + }, + { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + "andy-bell101/neotest-java", + }, + config = function() + local project_type = "maven" + local gradle_file = vim.fn.findfile("build.gradle", vim.fn.getcwd()) + if gradle_file then + project_type = "gradle" + end + + require("neotest").setup({ + adapters = { + require("neotest-java")({ + -- function to determine which runner to use based on project path + determine_runner = function(project_root_path) + -- return should be "maven" or "gradle" + return project_type + end, + -- override the builtin runner discovery behaviour to always use given + -- tool. Default is "nil", so no override + force_runner = nil, + -- if the automatic runner discovery can't uniquely determine whether + -- to use Gradle or Maven, fallback to using this runner. Default is + -- "gradle or maven" + fallback_runner = project_type, + }), + }, + }) + end, + -- stylua: ignore + keys = { + { "T","",desc="  Test"}, + { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, + { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, + { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, + { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, + { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, + { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, + { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, + { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, + { "rg", "terminalgradle run", desc = "Run Gradle", mode = "n" }, + }, + }, + { + "rockerBOO/symbols-outline.nvim", + cmd = "SymbolsOutline", + config = function() + require("symbols-outline").setup({ + symbols = { + File = { icon = "󰈔", hl = "@text.uri" }, + Module = { icon = "", hl = "@namespace" }, + Namespace = { icon = "󰅪", hl = "@namespace" }, + Package = { icon = "", hl = "@namespace" }, + Class = { icon = "𝓒", hl = "@type" }, + Method = { icon = "ƒ", hl = "@method" }, + Property = { icon = "", hl = "@method" }, + Field = { icon = "", hl = "@field" }, + Constructor = { icon = "", hl = "@constructor" }, + Enum = { icon = "ℰ", hl = "@type" }, + Interface = { icon = "", hl = "@type" }, + Function = { icon = "", hl = "@function" }, + Variable = { icon = "", hl = "@constant" }, + Constant = { icon = "", hl = "@constant" }, + String = { icon = "𝓐", hl = "@string" }, + Number = { icon = "#", hl = "@number" }, + Boolean = { icon = "󰨙 ", hl = "@boolean" }, + Array = { icon = "", hl = "@constant" }, + Object = { icon = "⦿", hl = "@type" }, + Key = { icon = "🔐", hl = "@type" }, + Null = { icon = "NULL", hl = "@type" }, + EnumMember = { icon = "", hl = "@field" }, + Struct = { icon = "𝓢", hl = "@type" }, + Event = { icon = "🗲", hl = "@type" }, + Operator = { icon = "+", hl = "@operator" }, + TypeParameter = { icon = "𝙏", hl = "@parameter" }, + Component = { icon = "󰅴", hl = "@function" }, + Fragment = { icon = "󰅴", hl = "@constant" }, + }, + }) + end, + keys = { + { "S", "SymbolsOutline", desc = "Toggle Outline" }, + }, + }, +} + +return M diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index daf97c2..4512d0c 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -7,6 +7,7 @@ pcode.lang = { golang = false, java = false, java2 = false, + java3 = true, javascript = false, kotlin = false, markdown = false, From 422efe87ced2c945cb21a6cafba4b30df0f635f9 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 12 Nov 2024 13:03:22 +0700 Subject: [PATCH 29/59] enc: config jdtls independent --- lazy-lock.json | 3 +- lua/auto-jdtls/init.lua | 7 - lua/auto-jdtls2/init.lua | 8 + lua/{auto-jdtls => auto-jdtls2}/utils.lua | 7 +- lua/pcode/plugins/lang/java.lua | 207 +++------------------- lua/pcode/plugins/lang/java3.lua | 198 ++++++++++++++++++++- lua/pcode/user/default.lua | 4 +- 7 files changed, 239 insertions(+), 195 deletions(-) delete mode 100644 lua/auto-jdtls/init.lua create mode 100644 lua/auto-jdtls2/init.lua rename lua/{auto-jdtls => auto-jdtls2}/utils.lua (98%) diff --git a/lazy-lock.json b/lazy-lock.json index 0b52fe5..d548f2a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,6 +6,7 @@ "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "3851cb9539283972d53ac24a3fd00a9decfdc717" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, @@ -66,7 +67,7 @@ "toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, - "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, + "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, "volt": { "branch": "main", "commit": "1df6698f7e5d19db578063412d12322e53376f5e" }, "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, "yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" }, diff --git a/lua/auto-jdtls/init.lua b/lua/auto-jdtls/init.lua deleted file mode 100644 index b8b0f1f..0000000 --- a/lua/auto-jdtls/init.lua +++ /dev/null @@ -1,7 +0,0 @@ -local M = {} - -M.setup = function() - require("auto-jdtls.utils").attach_jdtls() -end - -return M diff --git a/lua/auto-jdtls2/init.lua b/lua/auto-jdtls2/init.lua new file mode 100644 index 0000000..1ffc62a --- /dev/null +++ b/lua/auto-jdtls2/init.lua @@ -0,0 +1,8 @@ +local M = {} + +M.setup = function(opt) + opt = opt or {} + require("auto-jdtls.utils").attach_jdtls(opt) +end + +return M diff --git a/lua/auto-jdtls/utils.lua b/lua/auto-jdtls2/utils.lua similarity index 98% rename from lua/auto-jdtls/utils.lua rename to lua/auto-jdtls2/utils.lua index c365e2d..db66e88 100644 --- a/lua/auto-jdtls/utils.lua +++ b/lua/auto-jdtls2/utils.lua @@ -119,7 +119,8 @@ M.opts = { }, } -M.attach_jdtls = function() +M.attach_jdtls = function(op) + M.opts = M.extend_or_override(M.opts, op or {}) local opt = vim.opt opt.shiftwidth = 4 opt.tabstop = 4 @@ -179,8 +180,8 @@ M.attach_jdtls = function() local client = vim.lsp.get_client_by_id(args.data.client_id) -- stylua: ignore if client and client.name == "jdtls" then - M.jdtls_keymaps() - M.lsp_keymaps() + -- M.jdtls_keymaps() + -- M.lsp_keymaps() if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then -- custom init for Java debugger require("jdtls").setup_dap(M.opts.dap) diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 4da43c5..67488bd 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -1,39 +1,4 @@ local M = {} -local java_filetypes = { "java" } -local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" } - --- Utility function to extend or override a config table, similar to the way --- that Plugin.opts works. ----@param config table ----@param custom function | table | nil -local function extend_or_override(config, custom, ...) - if type(custom) == "function" then - config = custom(config, ...) or config - elseif custom then - config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] - end - return config -end - -local function capabilities() - local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") - if status_ok then - return cmp_nvim_lsp.default_capabilities() - end - - local CAPABILITIES = vim.lsp.protocol.make_client_capabilities() - CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true - CAPABILITIES.textDocument.completion.completionItem.resolveSupport = { - properties = { - "documentation", - "detail", - "additionalTextEdits", - }, - } - - return CAPABILITIES -end - M = { { "williamboman/mason-lspconfig.nvim", @@ -41,6 +6,7 @@ M = { opts = function(_, opts) opts.skip_config = opts.skip_config or {} vim.list_extend(opts.skip_config, { "jdtls" }) + vim.keymap.set({ "n", "v" }, "l", "", { desc = "LSP" }) -- Set vim motion for + l + h to show code documentation about the code the cursor is currently over if available vim.keymap.set("n", "lh", vim.lsp.buf.hover, { desc = "Code Hover Documentation" }) -- Set vim motion for + l + d to go where the code/variable under the cursor was defined @@ -62,152 +28,34 @@ M = { }, { "mfussenegger/nvim-jdtls", - ft = java_filetypes, + dependencies = { "pojokcodeid/auto-jdtls.nvim" }, + ft = { "java" }, enabled = true, - opts = function() - return { - root_dir = require("jdtls.setup").find_root(root_markers), - project_name = function() - return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") - end, - - -- Where are the config and workspace dirs for a project? - jdtls_config_dir = function(project_name) - return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" - end, - jdtls_workspace_dir = function(project_name) - return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" - end, - cmd = { vim.fn.exepath("jdtls") }, - full_cmd = function(opts) - local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") - local cmd = vim.deepcopy(opts.cmd) - if project_name then - vim.list_extend(cmd, { - "-configuration", - opts.jdtls_config_dir(project_name), - "-data", - opts.jdtls_workspace_dir(project_name), - }) - end - return cmd - end, - - -- These depend on nvim-dap, but can additionally be disabled by setting false here. - dap = { hotcodereplace = "auto", config_overrides = {} }, - dap_main = {}, - test = true, - settings = { - java = { - inlayHints = { - parameterNames = { - enabled = "all", - }, - }, - }, - }, - } - end, + -- your opts go here + opts = {}, + -- stylua: ignore config = function(_, opts) - local opt = vim.opt - opt.shiftwidth = 4 - opt.tabstop = 4 - opt.softtabstop = 4 - opt.ts = 4 - opt.expandtab = true - - local mason_registry = require("mason-registry") - local bundles = {} ---@type string[] - if opts.dap and mason_registry.is_installed("java-debug-adapter") then - local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") - local java_dbg_path = java_dbg_pkg:get_install_path() - local jar_patterns = { - java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", - } - -- java-test also depends on java-debug-adapter. - if opts.test and mason_registry.is_installed("java-test") then - local java_test_pkg = mason_registry.get_package("java-test") - local java_test_path = java_test_pkg:get_install_path() - vim.list_extend(jar_patterns, { - java_test_path .. "/extension/server/*.jar", - }) - end - for _, jar_pattern in ipairs(jar_patterns) do - for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do - table.insert(bundles, bundle) - end - end - end - - local function attach_jdtls() - -- Configuration can be augmented and overridden by opts.jdtls - local config = extend_or_override({ - cmd = opts.full_cmd(opts), - root_dir = require("jdtls.setup").find_root(root_markers), - init_options = { - bundles = bundles, - }, - settings = opts.settings, - -- enable CMP capabilities - -- capabilities = require("user.lsp.handlers").capabilities or nil, - -- capabilities = require("auto-lsp.lsp.handlers").capabilities or nil, - capabilities = capabilities() or nil, - }, opts.jdtls) - - -- Existing server will be reused if the root_dir matches. - require("jdtls").start_or_attach(config) - -- not need to require("jdtls.setup").add_commands(), start automatically adds commands - end - - vim.api.nvim_create_autocmd("FileType", { - pattern = java_filetypes, - callback = attach_jdtls, - }) - - -- Setup keymap and dap after the lsp is fully attached. - -- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration - -- https://neovim.io/doc/user/lsp.html#LspAttach - vim.api.nvim_create_autocmd("LspAttach", { - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - -- stylua: ignore - if client and client.name == "jdtls" then - -- add keymaps - vim.keymap.set('n', 'J', "", { desc = "Java" }) - -- Set a Vim motion to + J + o to organize imports in normal mode - vim.keymap.set('n', 'Jo', " lua require('jdtls').organize_imports()", { desc = "Java Organize Imports" }) - -- Set a Vim motion to + J + v to extract the code under the cursor to a variable - vim.keymap.set('n', 'Jv', " lua require('jdtls').extract_variable()", { desc = "Java Extract Variable" }) - -- Set a Vim motion to + J + v to extract the code selected in visual mode to a variable - vim.keymap.set('v', 'Jv', " lua require('jdtls').extract_variable(true)", { desc = "Java Extract Variable" }) - -- Set a Vim motion to + J + C to extract the code under the cursor to a static variable - vim.keymap.set('n', 'JC', " lua require('jdtls').extract_constant()", { desc = "Java Extract Constant" }) - -- Set a Vim motion to + J + C to extract the code selected in visual mode to a static variable - vim.keymap.set('v', 'JC', " lua require('jdtls').extract_constant(true)", { desc = "Java Extract Constant" }) - -- Set a Vim motion to + J + t to run the test method currently under the cursor - vim.keymap.set('n', 'Jt', " lua require('jdtls').test_nearest_method()", { desc = "Java Test Method" }) - -- Set a Vim motion to + J + t to run the test method that is currently selected in visual mode - vim.keymap.set('v', 'Jt', " lua require('jdtls').test_nearest_method(true)", { desc = "Java Test Method" }) - -- Set a Vim motion to + J + T to run an entire test suite (class) - vim.keymap.set('n', 'JT', " lua require('jdtls').test_class()", { desc = "Java Test Class" }) - -- Set a Vim motion to + J + u to update the project configuration - vim.keymap.set('n', 'Ju', " JdtUpdateConfig", { desc = "Java Update Config" }) - if opts.dap and mason_registry.is_installed("java-debug-adapter") then - -- custom init for Java debugger - require("jdtls").setup_dap(opts.dap) - require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) - end - - -- User can set additional keymaps in opts.on_attach - if opts.on_attach then - opts.on_attach(args) - end - end - end, - }) - - -- Avoid race condition by calling attach the first time, since the autocmd won't fire. - attach_jdtls() + require("auto-jdtls").setup(opts) + -- add keymaps + vim.keymap.set('n', 'J', "", { desc = "Java" }) + -- Set a Vim motion to + J + o to organize imports in normal mode + vim.keymap.set('n', 'Jo', " lua require('jdtls').organize_imports()", { desc = "Java Organize Imports" }) + -- Set a Vim motion to + J + v to extract the code under the cursor to a variable + vim.keymap.set('n', 'Jv', " lua require('jdtls').extract_variable()", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + v to extract the code selected in visual mode to a variable + vim.keymap.set('v', 'Jv', " lua require('jdtls').extract_variable(true)", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + C to extract the code under the cursor to a static variable + vim.keymap.set('n', 'JC', " lua require('jdtls').extract_constant()", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + C to extract the code selected in visual mode to a static variable + vim.keymap.set('v', 'JC', " lua require('jdtls').extract_constant(true)", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + t to run the test method currently under the cursor + vim.keymap.set('n', 'Jt', " lua require('jdtls').test_nearest_method()", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + t to run the test method that is currently selected in visual mode + vim.keymap.set('v', 'Jt', " lua require('jdtls').test_nearest_method(true)", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + T to run an entire test suite (class) + vim.keymap.set('n', 'JT', " lua require('jdtls').test_class()", { desc = "Java Test Class" }) + -- Set a Vim motion to + J + u to update the project configuration + vim.keymap.set('n', 'Ju', " JdtUpdateConfig", { desc = "Java Update Config" }) end, }, { @@ -219,6 +67,7 @@ M = { }, { "williamboman/mason-lspconfig.nvim", + -- stylua: ignore opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} vim.list_extend(opts.ensure_installed, { "jdtls" }) diff --git a/lua/pcode/plugins/lang/java3.lua b/lua/pcode/plugins/lang/java3.lua index 12e37e0..4da43c5 100644 --- a/lua/pcode/plugins/lang/java3.lua +++ b/lua/pcode/plugins/lang/java3.lua @@ -1,10 +1,60 @@ local M = {} +local java_filetypes = { "java" } +local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" } + +-- Utility function to extend or override a config table, similar to the way +-- that Plugin.opts works. +---@param config table +---@param custom function | table | nil +local function extend_or_override(config, custom, ...) + if type(custom) == "function" then + config = custom(config, ...) or config + elseif custom then + config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] + end + return config +end + +local function capabilities() + local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") + if status_ok then + return cmp_nvim_lsp.default_capabilities() + end + + local CAPABILITIES = vim.lsp.protocol.make_client_capabilities() + CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true + CAPABILITIES.textDocument.completion.completionItem.resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + }, + } + + return CAPABILITIES +end + M = { { "williamboman/mason-lspconfig.nvim", + -- stylua: ignore opts = function(_, opts) opts.skip_config = opts.skip_config or {} vim.list_extend(opts.skip_config, { "jdtls" }) + -- Set vim motion for + l + h to show code documentation about the code the cursor is currently over if available + vim.keymap.set("n", "lh", vim.lsp.buf.hover, { desc = "Code Hover Documentation" }) + -- Set vim motion for + l + d to go where the code/variable under the cursor was defined + vim.keymap.set("n", "ld", vim.lsp.buf.definition, { desc = "Code Goto Definition" }) + -- Set vim motion for + l + a for display code action suggestions for code diagnostics in both normal and visual mode + vim.keymap.set({ "n", "v" }, "la", vim.lsp.buf.code_action, { desc = "Code Actions" }) + -- Set vim motion for + l + r to display references to the code under the cursor + vim.keymap.set("n", "lr", require("telescope.builtin").lsp_references, { desc = "Code Goto References" }) + -- Set vim motion for + l + i to display implementations to the code under the cursor + vim.keymap.set("n", "li", require("telescope.builtin").lsp_implementations, { desc = "Code Goto Implementations" }) + -- Set a vim motion for + l + R to smartly rename the code under the cursor + vim.keymap.set("n", "lR", vim.lsp.buf.rename, { desc = "Code Rename" }) + -- Set a vim motion for + l + D to go to where the code/object was declared in the project (class file) + vim.keymap.set("n", "lD", vim.lsp.buf.declaration, { desc = "Code Goto Declaration" }) end, keys = { { "l", "", desc = "LSP", mode = { "n", "v" } }, @@ -12,10 +62,152 @@ M = { }, { "mfussenegger/nvim-jdtls", - ft = { "java" }, + ft = java_filetypes, enabled = true, - config = function() - require("auto-jdtls").setup() + opts = function() + return { + root_dir = require("jdtls.setup").find_root(root_markers), + project_name = function() + return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + end, + + -- Where are the config and workspace dirs for a project? + jdtls_config_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" + end, + jdtls_workspace_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" + end, + cmd = { vim.fn.exepath("jdtls") }, + full_cmd = function(opts) + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + local cmd = vim.deepcopy(opts.cmd) + if project_name then + vim.list_extend(cmd, { + "-configuration", + opts.jdtls_config_dir(project_name), + "-data", + opts.jdtls_workspace_dir(project_name), + }) + end + return cmd + end, + + -- These depend on nvim-dap, but can additionally be disabled by setting false here. + dap = { hotcodereplace = "auto", config_overrides = {} }, + dap_main = {}, + test = true, + settings = { + java = { + inlayHints = { + parameterNames = { + enabled = "all", + }, + }, + }, + }, + } + end, + config = function(_, opts) + local opt = vim.opt + opt.shiftwidth = 4 + opt.tabstop = 4 + opt.softtabstop = 4 + opt.ts = 4 + opt.expandtab = true + + local mason_registry = require("mason-registry") + local bundles = {} ---@type string[] + if opts.dap and mason_registry.is_installed("java-debug-adapter") then + local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") + local java_dbg_path = java_dbg_pkg:get_install_path() + local jar_patterns = { + java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", + } + -- java-test also depends on java-debug-adapter. + if opts.test and mason_registry.is_installed("java-test") then + local java_test_pkg = mason_registry.get_package("java-test") + local java_test_path = java_test_pkg:get_install_path() + vim.list_extend(jar_patterns, { + java_test_path .. "/extension/server/*.jar", + }) + end + for _, jar_pattern in ipairs(jar_patterns) do + for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do + table.insert(bundles, bundle) + end + end + end + + local function attach_jdtls() + -- Configuration can be augmented and overridden by opts.jdtls + local config = extend_or_override({ + cmd = opts.full_cmd(opts), + root_dir = require("jdtls.setup").find_root(root_markers), + init_options = { + bundles = bundles, + }, + settings = opts.settings, + -- enable CMP capabilities + -- capabilities = require("user.lsp.handlers").capabilities or nil, + -- capabilities = require("auto-lsp.lsp.handlers").capabilities or nil, + capabilities = capabilities() or nil, + }, opts.jdtls) + + -- Existing server will be reused if the root_dir matches. + require("jdtls").start_or_attach(config) + -- not need to require("jdtls.setup").add_commands(), start automatically adds commands + end + + vim.api.nvim_create_autocmd("FileType", { + pattern = java_filetypes, + callback = attach_jdtls, + }) + + -- Setup keymap and dap after the lsp is fully attached. + -- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration + -- https://neovim.io/doc/user/lsp.html#LspAttach + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + -- stylua: ignore + if client and client.name == "jdtls" then + -- add keymaps + vim.keymap.set('n', 'J', "", { desc = "Java" }) + -- Set a Vim motion to + J + o to organize imports in normal mode + vim.keymap.set('n', 'Jo', " lua require('jdtls').organize_imports()", { desc = "Java Organize Imports" }) + -- Set a Vim motion to + J + v to extract the code under the cursor to a variable + vim.keymap.set('n', 'Jv', " lua require('jdtls').extract_variable()", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + v to extract the code selected in visual mode to a variable + vim.keymap.set('v', 'Jv', " lua require('jdtls').extract_variable(true)", { desc = "Java Extract Variable" }) + -- Set a Vim motion to + J + C to extract the code under the cursor to a static variable + vim.keymap.set('n', 'JC', " lua require('jdtls').extract_constant()", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + C to extract the code selected in visual mode to a static variable + vim.keymap.set('v', 'JC', " lua require('jdtls').extract_constant(true)", { desc = "Java Extract Constant" }) + -- Set a Vim motion to + J + t to run the test method currently under the cursor + vim.keymap.set('n', 'Jt', " lua require('jdtls').test_nearest_method()", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + t to run the test method that is currently selected in visual mode + vim.keymap.set('v', 'Jt', " lua require('jdtls').test_nearest_method(true)", { desc = "Java Test Method" }) + -- Set a Vim motion to + J + T to run an entire test suite (class) + vim.keymap.set('n', 'JT', " lua require('jdtls').test_class()", { desc = "Java Test Class" }) + -- Set a Vim motion to + J + u to update the project configuration + vim.keymap.set('n', 'Ju', " JdtUpdateConfig", { desc = "Java Update Config" }) + if opts.dap and mason_registry.is_installed("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap(opts.dap) + require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) + end + + -- User can set additional keymaps in opts.on_attach + if opts.on_attach then + opts.on_attach(args) + end + end + end, + }) + + -- Avoid race condition by calling attach the first time, since the autocmd won't fire. + attach_jdtls() end, }, { diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 4512d0c..ee24357 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -5,9 +5,9 @@ pcode.lang = { sql = false, deno = false, golang = false, - java = false, + java = true, java2 = false, - java3 = true, + java3 = false, javascript = false, kotlin = false, markdown = false, From 273f3ebcb7b6053e727405b55c0cc42805ac2330 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Tue, 12 Nov 2024 17:45:45 +0700 Subject: [PATCH 30/59] enc: add alternative config jdtls --- lazy-lock.json | 6 +- lua/{auto-jdtls2 => auto-jdtls}/init.lua | 0 lua/{auto-jdtls2 => auto-jdtls}/utils.lua | 93 ++++++++++++++++------- lua/pcode/plugins/lang/java.lua | 2 +- 4 files changed, 69 insertions(+), 32 deletions(-) rename lua/{auto-jdtls2 => auto-jdtls}/init.lua (100%) rename lua/{auto-jdtls2 => auto-jdtls}/utils.lua (77%) diff --git a/lazy-lock.json b/lazy-lock.json index d548f2a..620cff1 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,6 @@ "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "3851cb9539283972d53ac24a3fd00a9decfdc717" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, @@ -46,14 +45,14 @@ "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-jdtls": { "branch": "master", "commit": "c4279b8ffce9b64eb302056d78dfebc2968a49bc" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "4cb925e96288a71409a86c84fd97f4434a95453e" }, + "nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" }, - "nvim-treesitter": { "branch": "master", "commit": "bb06afa3f1111780932b3c5493ad65473ce85f9d" }, + "nvim-treesitter": { "branch": "master", "commit": "7646c1c12a3121562aa87fd79aace48c728ac096" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, @@ -61,6 +60,7 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, + "springboot-nvim": { "branch": "main", "commit": "3e81c0ed2ca8c05d2cfcbab04addfaa3792dbcb0" }, "symbols-outline.nvim": { "branch": "master", "commit": "964c5902243446124417a3a9e9454f5ef032cc36" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, diff --git a/lua/auto-jdtls2/init.lua b/lua/auto-jdtls/init.lua similarity index 100% rename from lua/auto-jdtls2/init.lua rename to lua/auto-jdtls/init.lua diff --git a/lua/auto-jdtls2/utils.lua b/lua/auto-jdtls/utils.lua similarity index 77% rename from lua/auto-jdtls2/utils.lua rename to lua/auto-jdtls/utils.lua index db66e88..e1bccb2 100644 --- a/lua/auto-jdtls2/utils.lua +++ b/lua/auto-jdtls/utils.lua @@ -82,25 +82,62 @@ M.opts = { return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") end, - -- Where are the config and workspace dirs for a project? - jdtls_config_dir = function(project_name) - return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" + get_jdtls = function() + local function check_os() + local uname = vim.loop.os_uname().sysname + if uname == "Darwin" then + return "mac" + elseif uname == "Windows_NT" then + return "win" + elseif uname == "Linux" then + return "linux" + else + return "unknown" + end + end + local mason_registry = require("mason-registry") + local jdtls = mason_registry.get_package("jdtls") + local jdtls_path = jdtls:get_install_path() + local launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") + local SYSTEM = check_os() + local config = jdtls_path .. "/config_" .. SYSTEM + local lombok = jdtls_path .. "/lombok.jar" + return launcher, config, lombok end, + jdtls_workspace_dir = function(project_name) - return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" + local function get_workspace() + local home = os.getenv("HOME") + local workspace_path = home .. "/code/workspace/" + local workspace_dir = workspace_path .. project_name + return workspace_dir + end + return get_workspace() end, - cmd = { vim.fn.exepath("jdtls") }, full_cmd = function(opts) local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") - local cmd = vim.deepcopy(opts.cmd) - if project_name then - vim.list_extend(cmd, { - "-configuration", - opts.jdtls_config_dir(project_name), - "-data", - opts.jdtls_workspace_dir(project_name), - }) - end + local launcher, os_config, lombok = opts.get_jdtls() + local cmd = { + "java", + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Dosgi.bundles.defaultStartLevel=4", + "-Declipse.product=org.eclipse.jdt.ls.core.product", + "-Dlog.protocol=true", + "-Dlog.level=ALL", + "-Xmx1g", + "--add-modules=ALL-SYSTEM", + "--add-opens", + "java.base/java.util=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "-javaagent:" .. lombok, + "-jar", + launcher, + "-configuration", + os_config, + "-data", + opts.jdtls_workspace_dir(project_name), + } return cmd end, @@ -178,21 +215,21 @@ M.attach_jdtls = function(op) vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) - -- stylua: ignore - if client and client.name == "jdtls" then - -- M.jdtls_keymaps() - -- M.lsp_keymaps() - if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then - -- custom init for Java debugger - require("jdtls").setup_dap(M.opts.dap) - require("jdtls.dap").setup_dap_main_class_configs(M.opts.dap_main) - end - - -- User can set additional keymaps in opts.on_attach - if M.opts.on_attach then - M.opts.on_attach(args) - end + -- stylua: ignore + if client and client.name == "jdtls" then + -- M.jdtls_keymaps() + -- M.lsp_keymaps() + if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap(M.opts.dap) + require("jdtls.dap").setup_dap_main_class_configs(M.opts.dap_main) end + + -- User can set additional keymaps in opts.on_attach + if M.opts.on_attach then + M.opts.on_attach(args) + end + end end, }) diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 67488bd..3da35b9 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -28,7 +28,7 @@ M = { }, { "mfussenegger/nvim-jdtls", - dependencies = { "pojokcodeid/auto-jdtls.nvim" }, + -- dependencies = { "pojokcodeid/auto-jdtls.nvim" }, ft = { "java" }, enabled = true, -- your opts go here From 0c56a139ec6ae22455dba9b6a3ea86ae999332ef Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Wed, 13 Nov 2024 05:33:40 +0700 Subject: [PATCH 31/59] enc: add jdtls auto config --- lazy-lock.json | 8 ++++---- lua/{auto-jdtls => auto-jdtls2}/init.lua | 0 lua/{auto-jdtls => auto-jdtls2}/utils.lua | 0 lua/pcode/plugins/lang/java.lua | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename lua/{auto-jdtls => auto-jdtls2}/init.lua (100%) rename lua/{auto-jdtls => auto-jdtls2}/utils.lua (100%) diff --git a/lazy-lock.json b/lazy-lock.json index 620cff1..fcfe458 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,10 +2,11 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "48a02259693cb7bbbd1092993406773d5ce14664" }, + "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "3851cb9539283972d53ac24a3fd00a9decfdc717" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, @@ -19,7 +20,7 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "code_runner.nvim": { "branch": "main", "commit": "dcedccbf969a0f3bc00db446172b4966e83101dd" }, "codeium.vim": { "branch": "main", "commit": "8c01979323b2b480c8bf160d3ff85bd1668baa49" }, - "conform.nvim": { "branch": "master", "commit": "8c354323201d04530727d8bdcc4669791ee082ef" }, + "conform.nvim": { "branch": "master", "commit": "1a7ff54dcfbe1af139b11829c6d58f5ffab87707" }, "dressing.nvim": { "branch": "master", "commit": "43b8f74e0b1e3f41e51f640f8efa3bcd401cea0d" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, @@ -60,7 +61,6 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, - "springboot-nvim": { "branch": "main", "commit": "3e81c0ed2ca8c05d2cfcbab04addfaa3792dbcb0" }, "symbols-outline.nvim": { "branch": "master", "commit": "964c5902243446124417a3a9e9454f5ef032cc36" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, @@ -70,6 +70,6 @@ "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, "volt": { "branch": "main", "commit": "1df6698f7e5d19db578063412d12322e53376f5e" }, "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, - "yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" }, + "yanky.nvim": { "branch": "main", "commit": "a86d33912017878a4cb18758cd863dd335873bf8" }, "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } } diff --git a/lua/auto-jdtls/init.lua b/lua/auto-jdtls2/init.lua similarity index 100% rename from lua/auto-jdtls/init.lua rename to lua/auto-jdtls2/init.lua diff --git a/lua/auto-jdtls/utils.lua b/lua/auto-jdtls2/utils.lua similarity index 100% rename from lua/auto-jdtls/utils.lua rename to lua/auto-jdtls2/utils.lua diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 3da35b9..67488bd 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -28,7 +28,7 @@ M = { }, { "mfussenegger/nvim-jdtls", - -- dependencies = { "pojokcodeid/auto-jdtls.nvim" }, + dependencies = { "pojokcodeid/auto-jdtls.nvim" }, ft = { "java" }, enabled = true, -- your opts go here From 835b1706b21d909118306bff6e3460fdaaa91ebd Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 14 Nov 2024 06:20:10 +0700 Subject: [PATCH 32/59] enc: update config spesifik language java --- lazy-lock.json | 18 ++--- lua/auto-jdtls2/init.lua | 1 + lua/auto-jdtls2/utils.lua | 50 ++++++++++++++ lua/pcode/plugins/extras/lspsignatur.lua | 23 +++++++ .../plugins/extras/telescopetreesiterinfo.lua | 13 ++++ lua/pcode/plugins/lang/java.lua | 67 +------------------ lua/pcode/plugins/lang/java2.lua | 9 ++- lua/pcode/plugins/lang/java4.lua | 32 +++++++++ lua/pcode/plugins/notify.lua | 2 +- lua/pcode/user/default.lua | 3 + 10 files changed, 144 insertions(+), 74 deletions(-) create mode 100644 lua/pcode/plugins/extras/lspsignatur.lua create mode 100644 lua/pcode/plugins/extras/telescopetreesiterinfo.lua create mode 100644 lua/pcode/plugins/lang/java4.lua diff --git a/lazy-lock.json b/lazy-lock.json index fcfe458..0f9ae96 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,7 @@ "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "3851cb9539283972d53ac24a3fd00a9decfdc717" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "5029bc563353d47d3ba27d4b30770bad167500af" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, @@ -20,13 +20,14 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "code_runner.nvim": { "branch": "main", "commit": "dcedccbf969a0f3bc00db446172b4966e83101dd" }, "codeium.vim": { "branch": "main", "commit": "8c01979323b2b480c8bf160d3ff85bd1668baa49" }, - "conform.nvim": { "branch": "master", "commit": "1a7ff54dcfbe1af139b11829c6d58f5ffab87707" }, - "dressing.nvim": { "branch": "master", "commit": "43b8f74e0b1e3f41e51f640f8efa3bcd401cea0d" }, + "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, + "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, - "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, + "gitsigns.nvim": { "branch": "main", "commit": "9521fe8be39255b9abc6ec54e352bf04c410f5cf" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, + "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, @@ -36,12 +37,12 @@ "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, - "noice.nvim": { "branch": "main", "commit": "2087bbf8cd64482b47fb5f33b5e0eabf329ab14b" }, + "noice.nvim": { "branch": "main", "commit": "ca2e3fea9fb080dcb79d9129d73dac631294fe79" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, "nvim-colorizer.lua": { "branch": "master", "commit": "f134063618a65cad4d7415fddbd96ff7e0c5b4ae" }, - "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, + "nvim-dap": { "branch": "master", "commit": "6bf4de67dbe90271608e1c81797e5edc79ec6335" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-jdtls": { "branch": "master", "commit": "c4279b8ffce9b64eb302056d78dfebc2968a49bc" }, @@ -53,7 +54,7 @@ "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" }, - "nvim-treesitter": { "branch": "master", "commit": "7646c1c12a3121562aa87fd79aace48c728ac096" }, + "nvim-treesitter": { "branch": "master", "commit": "e1e3108cd23d7f967842261bd66126b6734d8907" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, @@ -62,6 +63,7 @@ "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, "symbols-outline.nvim": { "branch": "master", "commit": "964c5902243446124417a3a9e9454f5ef032cc36" }, + "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, "toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" }, @@ -70,6 +72,6 @@ "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, "volt": { "branch": "main", "commit": "1df6698f7e5d19db578063412d12322e53376f5e" }, "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, - "yanky.nvim": { "branch": "main", "commit": "a86d33912017878a4cb18758cd863dd335873bf8" }, + "yanky.nvim": { "branch": "main", "commit": "f9b905994cccf3c55f41af3a0a1f4c76c844e411" }, "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } } diff --git a/lua/auto-jdtls2/init.lua b/lua/auto-jdtls2/init.lua index 1ffc62a..af1787a 100644 --- a/lua/auto-jdtls2/init.lua +++ b/lua/auto-jdtls2/init.lua @@ -2,6 +2,7 @@ local M = {} M.setup = function(opt) opt = opt or {} + require("auto-jdtls.utils").install() require("auto-jdtls.utils").attach_jdtls(opt) end diff --git a/lua/auto-jdtls2/utils.lua b/lua/auto-jdtls2/utils.lua index e1bccb2..ce6262a 100644 --- a/lua/auto-jdtls2/utils.lua +++ b/lua/auto-jdtls2/utils.lua @@ -165,7 +165,31 @@ M.attach_jdtls = function(op) opt.ts = 4 opt.expandtab = true + -- Check Ttriisittrer + + local function ensure_ts_install(lang) + local parsers = require("nvim-treesitter.parsers") + local installed = parsers.has_parser(lang) + + if not installed then + vim.cmd("TSInstall " .. lang) + require("notify")("Treesitter parser for " .. lang .. " installed successfully.") + end + end + + -- Memeriksa dan menginstal atau mengonfirmasi Treesitter untuk Java + ensure_ts_install("java") + local mason_registry = require("mason-registry") + if + not mason_registry.is_installed("jdtls") + or not mason_registry.is_installed("java-debug-adapter") + or not mason_registry.is_installed("java-test") + then + vim.cmd("Mason") + require("notify")("Mason Installed Dependency, please restart nvim after installation is completed") + return + end local bundles = {} ---@type string[] if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") @@ -236,4 +260,30 @@ M.attach_jdtls = function(op) attach_jdtls() end +M.install = function() + local ensure_installed = { + "java-debug-adapter", + "java-test", + "jdtls", + } + local mr = require("mason-registry") + mr:on("package:install:success", function() + vim.defer_fn(function() + -- trigger FileType event to possibly load this newly installed LSP server + require("lazy.core.handler.event").trigger({ + event = "FileType", + buf = vim.api.nvim_get_current_buf(), + }) + end, 100) + end) + + mr.refresh(function() + for _, tool in ipairs(ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end + end + end) +end return M diff --git a/lua/pcode/plugins/extras/lspsignatur.lua b/lua/pcode/plugins/extras/lspsignatur.lua new file mode 100644 index 0000000..436e687 --- /dev/null +++ b/lua/pcode/plugins/extras/lspsignatur.lua @@ -0,0 +1,23 @@ +return { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + opts = function() + local is_enabled = true + return { + -- Window mode + floating_window = is_enabled, -- Display it as floating window. + hi_parameter = "IncSearch", -- Color to highlight floating window. + handler_opts = { border = "rounded" }, -- Window style + + -- Hint mode + hint_enable = false, -- Display it as hint. + hint_prefix = "👈 ", + + -- Additionally, you can use uH to toggle inlay hints. + toggle_key_flip_floatwin_setting = is_enabled, + } + end, + config = function(_, opts) + require("lsp_signature").setup(opts) + end, +} diff --git a/lua/pcode/plugins/extras/telescopetreesiterinfo.lua b/lua/pcode/plugins/extras/telescopetreesiterinfo.lua new file mode 100644 index 0000000..487b930 --- /dev/null +++ b/lua/pcode/plugins/extras/telescopetreesiterinfo.lua @@ -0,0 +1,13 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "roycrippen4/telescope-treesitter-info.nvim", + }, + config = function() + require("telescope").load_extension("treesitter_info") + end, + keys = { + { "p", "Telescope treesitter_info", desc = "Treesitter Info" }, + }, +} diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 67488bd..84642e0 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -2,29 +2,10 @@ local M = {} M = { { "williamboman/mason-lspconfig.nvim", - -- stylua: ignore opts = function(_, opts) opts.skip_config = opts.skip_config or {} vim.list_extend(opts.skip_config, { "jdtls" }) - vim.keymap.set({ "n", "v" }, "l", "", { desc = "LSP" }) - -- Set vim motion for + l + h to show code documentation about the code the cursor is currently over if available - vim.keymap.set("n", "lh", vim.lsp.buf.hover, { desc = "Code Hover Documentation" }) - -- Set vim motion for + l + d to go where the code/variable under the cursor was defined - vim.keymap.set("n", "ld", vim.lsp.buf.definition, { desc = "Code Goto Definition" }) - -- Set vim motion for + l + a for display code action suggestions for code diagnostics in both normal and visual mode - vim.keymap.set({ "n", "v" }, "la", vim.lsp.buf.code_action, { desc = "Code Actions" }) - -- Set vim motion for + l + r to display references to the code under the cursor - vim.keymap.set("n", "lr", require("telescope.builtin").lsp_references, { desc = "Code Goto References" }) - -- Set vim motion for + l + i to display implementations to the code under the cursor - vim.keymap.set("n", "li", require("telescope.builtin").lsp_implementations, { desc = "Code Goto Implementations" }) - -- Set a vim motion for + l + R to smartly rename the code under the cursor - vim.keymap.set("n", "lR", vim.lsp.buf.rename, { desc = "Code Rename" }) - -- Set a vim motion for + l + D to go to where the code/object was declared in the project (class file) - vim.keymap.set("n", "lD", vim.lsp.buf.declaration, { desc = "Code Goto Declaration" }) end, - keys = { - { "l", "", desc = "LSP", mode = { "n", "v" } }, - }, }, { "mfussenegger/nvim-jdtls", @@ -33,52 +14,10 @@ M = { enabled = true, -- your opts go here opts = {}, - -- stylua: ignore config = function(_, opts) require("auto-jdtls").setup(opts) - -- add keymaps - vim.keymap.set('n', 'J', "", { desc = "Java" }) - -- Set a Vim motion to + J + o to organize imports in normal mode - vim.keymap.set('n', 'Jo', " lua require('jdtls').organize_imports()", { desc = "Java Organize Imports" }) - -- Set a Vim motion to + J + v to extract the code under the cursor to a variable - vim.keymap.set('n', 'Jv', " lua require('jdtls').extract_variable()", { desc = "Java Extract Variable" }) - -- Set a Vim motion to + J + v to extract the code selected in visual mode to a variable - vim.keymap.set('v', 'Jv', " lua require('jdtls').extract_variable(true)", { desc = "Java Extract Variable" }) - -- Set a Vim motion to + J + C to extract the code under the cursor to a static variable - vim.keymap.set('n', 'JC', " lua require('jdtls').extract_constant()", { desc = "Java Extract Constant" }) - -- Set a Vim motion to + J + C to extract the code selected in visual mode to a static variable - vim.keymap.set('v', 'JC', " lua require('jdtls').extract_constant(true)", { desc = "Java Extract Constant" }) - -- Set a Vim motion to + J + t to run the test method currently under the cursor - vim.keymap.set('n', 'Jt', " lua require('jdtls').test_nearest_method()", { desc = "Java Test Method" }) - -- Set a Vim motion to + J + t to run the test method that is currently selected in visual mode - vim.keymap.set('v', 'Jt', " lua require('jdtls').test_nearest_method(true)", { desc = "Java Test Method" }) - -- Set a Vim motion to + J + T to run an entire test suite (class) - vim.keymap.set('n', 'JT', " lua require('jdtls').test_class()", { desc = "Java Test Class" }) - -- Set a Vim motion to + J + u to update the project configuration - vim.keymap.set('n', 'Ju', " JdtUpdateConfig", { desc = "Java Update Config" }) - end, - }, - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "java" }) - end, - }, - { - "williamboman/mason-lspconfig.nvim", - -- stylua: ignore - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "jdtls" }) - end, - }, - { - "pojokcodeid/auto-conform.nvim", - event = "VeryLazy", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { "java-debug-adapter", "java-test" }) - opts.formatters_by_ft.java = { "lsp_fmt" } + require("auto-jdtls.utils").lsp_keymaps() + require("auto-jdtls.utils").jdtls_keymaps() end, }, { @@ -168,7 +107,7 @@ M = { }) end, keys = { - { "S", "SymbolsOutline", desc = "Toggle Outline" }, + { "Js", "SymbolsOutline", desc = "Toggle Outline" }, }, }, } diff --git a/lua/pcode/plugins/lang/java2.lua b/lua/pcode/plugins/lang/java2.lua index 6db9d45..8ed35bf 100644 --- a/lua/pcode/plugins/lang/java2.lua +++ b/lua/pcode/plugins/lang/java2.lua @@ -1,6 +1,13 @@ return { "nvim-java/nvim-java", - event = "VeryLazy", + -- event = "VeryLazy", + ft = { "java" }, + dependencies = { + "MunifTanjim/nui.nvim", + "neovim/nvim-lspconfig", + "mfussenegger/nvim-dap", + "williamboman/mason.nvim", + }, config = function() require("java").setup({ notifications = { diff --git a/lua/pcode/plugins/lang/java4.lua b/lua/pcode/plugins/lang/java4.lua new file mode 100644 index 0000000..cb144cf --- /dev/null +++ b/lua/pcode/plugins/lang/java4.lua @@ -0,0 +1,32 @@ +return { + "nvim-java/nvim-java", + -- ft = { "java" }, + dependencies = { + "MunifTanjim/nui.nvim", + "neovim/nvim-lspconfig", + "mfussenegger/nvim-dap", + "williamboman/mason.nvim", + }, + opts = { + notifications = { + dap = false, + }, + jdk = { + auto_install = false, + }, + + -- NOTE: One of these files must be in your project root directory. + -- Otherwise the debugger will end in the wrong directory and fail. + root_markers = { + "settings.gradle", + "settings.gradle.kts", + "pom.xml", + "build.gradle", + "mvnw", + "gradlew", + "build.gradle", + "build.gradle.kts", + ".git", + }, + }, +} diff --git a/lua/pcode/plugins/notify.lua b/lua/pcode/plugins/notify.lua index 639d0de..1c4ae83 100644 --- a/lua/pcode/plugins/notify.lua +++ b/lua/pcode/plugins/notify.lua @@ -17,7 +17,7 @@ return { return math.floor(vim.o.lines * 0.75) end, max_width = function() - return math.floor(vim.o.columns * 0.75) + return math.floor(vim.o.columns * 0.3) end, render = "wrapped-compact", -- background_colour = "#00000000", diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index ee24357..efd2f8a 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -8,6 +8,7 @@ pcode.lang = { java = true, java2 = false, java3 = false, + java4 = false, javascript = false, kotlin = false, markdown = false, @@ -44,6 +45,8 @@ pcode.extras = { visualmulti = true, yanky = true, zenmode = true, + lspsignatur = true, + telescopetreesiterinfo = true, } -- activate config themes pcode.themes = { From d186be6aec8b2e9277818726585a0a9ca36767ae Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 14 Nov 2024 06:43:36 +0700 Subject: [PATCH 33/59] enc: add icons to outline --- lua/pcode/plugins/lang/java.lua | 57 ++--- lua/pcode/user/icons.lua | 386 ++++++++++++++++---------------- 2 files changed, 223 insertions(+), 220 deletions(-) diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 84642e0..9eea3b5 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -73,36 +73,37 @@ M = { "rockerBOO/symbols-outline.nvim", cmd = "SymbolsOutline", config = function() + local icons = require("pcode.user.icons").kind require("symbols-outline").setup({ symbols = { - File = { icon = "󰈔", hl = "@text.uri" }, - Module = { icon = "", hl = "@namespace" }, - Namespace = { icon = "󰅪", hl = "@namespace" }, - Package = { icon = "", hl = "@namespace" }, - Class = { icon = "𝓒", hl = "@type" }, - Method = { icon = "ƒ", hl = "@method" }, - Property = { icon = "", hl = "@method" }, - Field = { icon = "", hl = "@field" }, - Constructor = { icon = "", hl = "@constructor" }, - Enum = { icon = "ℰ", hl = "@type" }, - Interface = { icon = "", hl = "@type" }, - Function = { icon = "", hl = "@function" }, - Variable = { icon = "", hl = "@constant" }, - Constant = { icon = "", hl = "@constant" }, - String = { icon = "𝓐", hl = "@string" }, - Number = { icon = "#", hl = "@number" }, - Boolean = { icon = "󰨙 ", hl = "@boolean" }, - Array = { icon = "", hl = "@constant" }, - Object = { icon = "⦿", hl = "@type" }, - Key = { icon = "🔐", hl = "@type" }, - Null = { icon = "NULL", hl = "@type" }, - EnumMember = { icon = "", hl = "@field" }, - Struct = { icon = "𝓢", hl = "@type" }, - Event = { icon = "🗲", hl = "@type" }, - Operator = { icon = "+", hl = "@operator" }, - TypeParameter = { icon = "𝙏", hl = "@parameter" }, - Component = { icon = "󰅴", hl = "@function" }, - Fragment = { icon = "󰅴", hl = "@constant" }, + File = { icon = icons.File, hl = "@text.uri" }, + Module = { icon = icons.Module, hl = "@namespace" }, + Namespace = { icon = icons.Namespace, hl = "@namespace" }, + Package = { icon = icons.Package, hl = "@namespace" }, + Class = { icon = icons.Class, hl = "@type" }, + Method = { icon = icons.Method, hl = "@method" }, + Property = { icon = icons.Property, hl = "@method" }, + Field = { icon = icons.Field, hl = "@field" }, + Constructor = { icon = icons.Constructor, hl = "@constructor" }, + Enum = { icon = icons.Enum, hl = "@type" }, + Interface = { icon = icons.Interface, hl = "@type" }, + Function = { icon = icons.Function, hl = "@function" }, + Variable = { icon = icons.Variable, hl = "@constant" }, + Constant = { icon = icons.Constant, hl = "@constant" }, + String = { icon = icons.String, hl = "@string" }, + Number = { icon = icons.Number, hl = "@number" }, + Boolean = { icon = icons.Boolean, hl = "@boolean" }, + Array = { icon = icons.Array, hl = "@constant" }, + Object = { icon = icons.Object, hl = "@type" }, + Key = { icon = icons.Key, hl = "@type" }, + Null = { icon = icons.Null, hl = "@type" }, + EnumMember = { icon = icons.EnumMember, hl = "@field" }, + Struct = { icon = icons.Struct, hl = "@type" }, + Event = { icon = icons.Event, hl = "@type" }, + Operator = { icon = icons.Operator, hl = "@operator" }, + TypeParameter = { icon = icons.TypeParameter, hl = "@parameter" }, + Component = { icon = icons.Component, hl = "@function" }, + Fragment = { icon = icons.Fragment, hl = "@constant" }, }, }) end, diff --git a/lua/pcode/user/icons.lua b/lua/pcode/user/icons.lua index d7f7076..50e7964 100644 --- a/lua/pcode/user/icons.lua +++ b/lua/pcode/user/icons.lua @@ -1,194 +1,196 @@ return { - kind = { - Boolean = "󰨙", - Color = "", - Codeium = "󰘦", - Control = "", - Collapsed = " ", - Copilot = "", - CopilotOff = "", - Folder = "󰉋", - Keyword = "", - Reference = "", - Snippet = "", - TabNine = "󰏚", - Text = "", - Unit = "", - Value = "", - File = "", - Module = "", - Namespace = "", - Package = "", - Class = "", - Method = "", - Property = "", - Field = "", - Constructor = "", - Enum = "", - Interface = "", - Function = "", - Variable = "", - Constant = "", - String = "", - Number = "", - Array = "", - Object = "", - Key = "", - Null = "", - EnumMember = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", - }, - git = { - LineAdded = "", - LineModified = "", - LineRemoved = "", - FileDeleted = "", - FileIgnored = "", - FileRenamed = "", - FileStaged = "S", - FileUnmerged = "", - FileUnstaged = "", - FileUntracked = "U", - Diff = "", - Repo = "", - Octoface = "", - Branch = "", - Branch2 = "", - Branch3 = "󰘬", - NoBranch = "󱓌", - }, - ui = { - ArrowCircleDown = "", - ArrowCircleLeft = "", - ArrowCircleRight = "", - ArrowCircleUp = "", - BoldArrowDown = "", - BoldArrowLeft = "", - BoldArrowRight = "", - BoldArrowUp = "", - BoldClose = "", - BoldDividerLeft = "", - BoldDividerRight = "", - BoldLineLeft = "▎", - BookMark = "", - BoxChecked = "", - Bug = "", - Stacks = "", - Scopes = "", - Watches = "󰂥", - DebugConsole = "", - Calendar = "", - Check = "", - ChevronRight = "", - ChevronShortDown = "", - ChevronShortLeft = "", - ChevronShortRight = "", - ChevronShortUp = "", - ChevronShortDown2 = " ", - ChevronShortLeft2 = "", - ChevronShortRight2 = "", - ChevronShortUp2 = "", - Circle = " ", - Close = "󰅖", - CloudDownload = "", - Code = "", - Comment = "", - Dashboard = "", - DividerLeft = "", - DividerRight = "", - DoubleChevronRight = "»", - Ellipsis = "", - EmptyFolder = "󰉖", - EmptyFolderOpen = "󰷏", - File = "", - FileSymlink = "", - Files = "", - FindFile = "󰈞", - FindText = "󰊄", - Fire = "", - Folder = "󰉋", - FolderOpen = "󰝰", - FolderSymlink = "", - Forward = "", - Gear = "", - History = "", - Lightbulb = "", - LineLeft = "▏", - LineMiddle = "│", - List = "", - Lock = "", - NewFile = "", - Note = "", - Package = "", - Pencil = "󰏫", - Plus = "", - Project = "", - Search = "", - SignIn = "", - SignOut = "", - Tab = "󰌒", - Table = "", - Target = "󰀘", - Telescope = "", - Text = "", - Tree = "", - Triangle = "󰐊", - TriangleShortArrowDown = "", - TriangleShortArrowLeft = "", - TriangleShortArrowRight = "", - TriangleShortArrowUp = "", - Neovim = "", - Pending = " ", - BlankCircle = " ", - CheckCircle = " ", - DotCircle = " ", - Border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - ProjekFolder = "󱧶", - Bell = "󰂠", - ft = "", - not_loaded = "", - Paint = "", - }, - folding = { - vert = "▕", -- alternatives │ - fold = " ", - eob = " ", -- suppress ~ at EndOfBuffer - diff = "╱", -- alternatives = ⣿ ░ ─ - msgsep = "‾", - foldopen = "▾", - foldsep = "│", - foldclose = "▸", - plusBox = "󰜄", - plusSircle = "󰐙", - plus = "󰐕", - minusBox = "󰛲", - minusSircle = "󰍷", - minus = "󰍴", - }, - diagnostics = { - BoldError = "", - Error = "", - BoldWarning = "", - Warning = "", - BoldInformation = "", - Information = "", - BoldQuestion = "", - Question = "", - BoldHint = "", - Hint = "󰌶", - Debug = "", - Trace = "✎", - }, - misc = { - Robot = "󰚩", - Squirrel = "", - Tag = "", - Watch = "", - Smiley = "", - Package = "", - CircuitBoard = "", - }, + kind = { + Boolean = "󰨙", + Color = "", + Codeium = "󰘦", + Control = "", + Collapsed = " ", + Component = "󰅴", + Copilot = "", + CopilotOff = "", + Folder = "󰉋", + Keyword = "", + Reference = "", + Snippet = "", + TabNine = "󰏚", + Text = "", + Unit = "", + Value = "", + File = "", + Module = "", + Namespace = "", + Package = "", + Class = "", + Method = "", + Property = "", + Field = "", + Constructor = "", + Enum = "", + Interface = "", + Function = "", + Fragment = "󰅴", + Variable = "", + Constant = "", + String = "", + Number = "", + Array = "", + Object = "", + Key = "", + Null = "", + EnumMember = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", + }, + git = { + LineAdded = "", + LineModified = "", + LineRemoved = "", + FileDeleted = "", + FileIgnored = "", + FileRenamed = "", + FileStaged = "S", + FileUnmerged = "", + FileUnstaged = "", + FileUntracked = "U", + Diff = "", + Repo = "", + Octoface = "", + Branch = "", + Branch2 = "", + Branch3 = "󰘬", + NoBranch = "󱓌", + }, + ui = { + ArrowCircleDown = "", + ArrowCircleLeft = "", + ArrowCircleRight = "", + ArrowCircleUp = "", + BoldArrowDown = "", + BoldArrowLeft = "", + BoldArrowRight = "", + BoldArrowUp = "", + BoldClose = "", + BoldDividerLeft = "", + BoldDividerRight = "", + BoldLineLeft = "▎", + BookMark = "", + BoxChecked = "", + Bug = "", + Stacks = "", + Scopes = "", + Watches = "󰂥", + DebugConsole = "", + Calendar = "", + Check = "", + ChevronRight = "", + ChevronShortDown = "", + ChevronShortLeft = "", + ChevronShortRight = "", + ChevronShortUp = "", + ChevronShortDown2 = " ", + ChevronShortLeft2 = "", + ChevronShortRight2 = "", + ChevronShortUp2 = "", + Circle = " ", + Close = "󰅖", + CloudDownload = "", + Code = "", + Comment = "", + Dashboard = "", + DividerLeft = "", + DividerRight = "", + DoubleChevronRight = "»", + Ellipsis = "", + EmptyFolder = "󰉖", + EmptyFolderOpen = "󰷏", + File = "", + FileSymlink = "", + Files = "", + FindFile = "󰈞", + FindText = "󰊄", + Fire = "", + Folder = "󰉋", + FolderOpen = "󰝰", + FolderSymlink = "", + Forward = "", + Gear = "", + History = "", + Lightbulb = "", + LineLeft = "▏", + LineMiddle = "│", + List = "", + Lock = "", + NewFile = "", + Note = "", + Package = "", + Pencil = "󰏫", + Plus = "", + Project = "", + Search = "", + SignIn = "", + SignOut = "", + Tab = "󰌒", + Table = "", + Target = "󰀘", + Telescope = "", + Text = "", + Tree = "", + Triangle = "󰐊", + TriangleShortArrowDown = "", + TriangleShortArrowLeft = "", + TriangleShortArrowRight = "", + TriangleShortArrowUp = "", + Neovim = "", + Pending = " ", + BlankCircle = " ", + CheckCircle = " ", + DotCircle = " ", + Border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + ProjekFolder = "󱧶", + Bell = "󰂠", + ft = "", + not_loaded = "", + Paint = "", + }, + folding = { + vert = "▕", -- alternatives │ + fold = " ", + eob = " ", -- suppress ~ at EndOfBuffer + diff = "╱", -- alternatives = ⣿ ░ ─ + msgsep = "‾", + foldopen = "▾", + foldsep = "│", + foldclose = "▸", + plusBox = "󰜄", + plusSircle = "󰐙", + plus = "󰐕", + minusBox = "󰛲", + minusSircle = "󰍷", + minus = "󰍴", + }, + diagnostics = { + BoldError = "", + Error = "", + BoldWarning = "", + Warning = "", + BoldInformation = "", + Information = "", + BoldQuestion = "", + Question = "", + BoldHint = "", + Hint = "󰌶", + Debug = "", + Trace = "✎", + }, + misc = { + Robot = "󰚩", + Squirrel = "", + Tag = "", + Watch = "", + Smiley = "", + Package = "", + CircuitBoard = "", + }, } From e0a4367eb081e0ea6a978c1e815bc567b9cf2fef Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 14 Nov 2024 06:48:20 +0700 Subject: [PATCH 34/59] enc: simplify neotest adaptor for java --- lua/pcode/plugins/lang/java.lua | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 9eea3b5..3eee608 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -30,28 +30,15 @@ M = { "andy-bell101/neotest-java", }, config = function() - local project_type = "maven" - local gradle_file = vim.fn.findfile("build.gradle", vim.fn.getcwd()) - if gradle_file then - project_type = "gradle" - end + -- local project_type = "maven" + -- local gradle_file = vim.fn.findfile("build.gradle", vim.fn.getcwd()) + -- if gradle_file then + -- project_type = "gradle" + -- end require("neotest").setup({ adapters = { - require("neotest-java")({ - -- function to determine which runner to use based on project path - determine_runner = function(project_root_path) - -- return should be "maven" or "gradle" - return project_type - end, - -- override the builtin runner discovery behaviour to always use given - -- tool. Default is "nil", so no override - force_runner = nil, - -- if the automatic runner discovery can't uniquely determine whether - -- to use Gradle or Maven, fallback to using this runner. Default is - -- "gradle or maven" - fallback_runner = project_type, - }), + require("neotest-java"), }, }) end, From 353e5a66c7b0581fb31a2f079e68e0dd1b476734 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 14 Nov 2024 07:50:11 +0700 Subject: [PATCH 35/59] enc: support neotest for gradle only --- lazy-lock.json | 5 +---- lua/pcode/plugins/lang/java.lua | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 0f9ae96..e1ae92e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,12 +1,11 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, - "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "5029bc563353d47d3ba27d4b30770bad167500af" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "230212e61c28e83e3e39893ac11d3d39d9da6d09" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, @@ -35,8 +34,6 @@ "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, - "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, - "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, "noice.nvim": { "branch": "main", "commit": "ca2e3fea9fb080dcb79d9129d73dac631294fe79" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 3eee608..aede04e 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -29,13 +29,8 @@ M = { "nvim-treesitter/nvim-treesitter", "andy-bell101/neotest-java", }, + enabled = vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" or false, config = function() - -- local project_type = "maven" - -- local gradle_file = vim.fn.findfile("build.gradle", vim.fn.getcwd()) - -- if gradle_file then - -- project_type = "gradle" - -- end - require("neotest").setup({ adapters = { require("neotest-java"), From 26cb34e301d1bef0c6203001bc1bfe6cbe030966 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 14 Nov 2024 15:02:28 +0700 Subject: [PATCH 36/59] enc: update patch plugins --- lazy-lock.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lazy-lock.json b/lazy-lock.json index e1ae92e..c04505d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,11 +1,12 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "230212e61c28e83e3e39893ac11d3d39d9da6d09" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "65c74d2a8dccf7b373b4e5d7fdcabcba79c51dc9" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, @@ -34,6 +35,8 @@ "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, + "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, + "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, "noice.nvim": { "branch": "main", "commit": "ca2e3fea9fb080dcb79d9129d73dac631294fe79" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, From 4af6a3dec6435c1aae2874e6fd8517f54a1427d2 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 14 Nov 2024 19:52:24 +0700 Subject: [PATCH 37/59] enc: update config jdtls --- lazy-lock.json | 4 ++-- lua/pcode/plugins/lang/java.lua | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index c04505d..18f721c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,7 @@ "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "65c74d2a8dccf7b373b4e5d7fdcabcba79c51dc9" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "ba78a66eac59cffc5c8e6fe8426eae2cd195393c" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, @@ -54,7 +54,7 @@ "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" }, - "nvim-treesitter": { "branch": "master", "commit": "e1e3108cd23d7f967842261bd66126b6734d8907" }, + "nvim-treesitter": { "branch": "master", "commit": "6389ceb1758b8f62a15194e3b790e33268304cb8" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index aede04e..b9bcf74 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -18,6 +18,9 @@ M = { require("auto-jdtls").setup(opts) require("auto-jdtls.utils").lsp_keymaps() require("auto-jdtls.utils").jdtls_keymaps() + vim.keymap.set("n", "rm", ":silent RunMvnSpringBoot", { desc = "Run Maven Sping Boot" }) + vim.keymap.set("n", "rG", ":silent RunGradleSpringBoot", { desc = "Run Gradle Sping Boot" }) + vim.keymap.set("n", "rM", ":silent RunMvnAndJava", { desc = "Run Maven Project" }) end, }, { From 3c9cf189330dfc6abae2a34798d3e2b71ecae060 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Thu, 14 Nov 2024 21:19:48 +0700 Subject: [PATCH 38/59] enc: add run project gradle and maven --- lazy-lock.json | 2 +- lua/pcode/plugins/lang/java.lua | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 18f721c..74cc1fc 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,7 @@ "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "ba78a66eac59cffc5c8e6fe8426eae2cd195393c" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "7838b8936547b1d93eeebf1c78af788267ab7ac1" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index b9bcf74..3367fb1 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -18,9 +18,10 @@ M = { require("auto-jdtls").setup(opts) require("auto-jdtls.utils").lsp_keymaps() require("auto-jdtls.utils").jdtls_keymaps() - vim.keymap.set("n", "rm", ":silent RunMvnSpringBoot", { desc = "Run Maven Sping Boot" }) - vim.keymap.set("n", "rG", ":silent RunGradleSpringBoot", { desc = "Run Gradle Sping Boot" }) - vim.keymap.set("n", "rM", ":silent RunMvnAndJava", { desc = "Run Maven Project" }) + vim.keymap.set("n", "rM", ":RunMvnSpringBoot", { desc = "Run Maven Sping Boot" }) + vim.keymap.set("n", "rG", ":RunGradleSpringBoot", { desc = "Run Gradle Sping Boot" }) + vim.keymap.set("n", "rm", ":RunMaven", { desc = "Run Maven Project" }) + vim.keymap.set("n", "rg", ":RunGradle", { desc = "Run Gradle Project" }) end, }, { @@ -51,7 +52,6 @@ M = { { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, - { "rg", "terminalgradle run", desc = "Run Gradle", mode = "n" }, }, }, { From 16264d0b0d509c1f32f3dd08e5482eec0c1dabef Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Sat, 16 Nov 2024 20:14:22 +0700 Subject: [PATCH 39/59] enc: add create project java --- lazy-lock.json | 23 +- lua/auto-jdtls2/create_maven_project.lua | 113 +++++++ lua/auto-jdtls2/create_springboot_project.lua | 289 ++++++++++++++++++ lua/auto-jdtls2/init.lua | 2 + lua/auto-jdtls2/utils.lua | 160 ++++++++++ lua/pcode/plugins/lang/java.lua | 11 +- 6 files changed, 585 insertions(+), 13 deletions(-) create mode 100644 lua/auto-jdtls2/create_maven_project.lua create mode 100644 lua/auto-jdtls2/create_springboot_project.lua diff --git a/lazy-lock.json b/lazy-lock.json index 74cc1fc..d770724 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -3,12 +3,13 @@ "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, - "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, + "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "7838b8936547b1d93eeebf1c78af788267ab7ac1" }, + "auto-java-project.nvim": { "branch": "main", "commit": "940531b6eeea682fa734f8dc160d7870dde38df2" }, + "auto-jdtls.nvim": { "branch": "main", "commit": "050da8d68c51a6e02a08d91329b7a848887927e7" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, - "auto-lsp.nvim": { "branch": "main", "commit": "2a5ade9f78a1c60d747396445d4205352d2491db" }, + "auto-lsp.nvim": { "branch": "main", "commit": "1f3ef04741972c107187a07be5615ff210888184" }, "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, "breadcrumbs.nvim": { "branch": "master", "commit": "9f764278784ce2f10dbe2f555ba14be2451d36a0" }, "bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" }, @@ -23,38 +24,38 @@ "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, - "gitsigns.nvim": { "branch": "main", "commit": "9521fe8be39255b9abc6ec54e352bf04c410f5cf" }, + "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "cab00668464d2914d0752b86168b4a431cc93eb2" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, - "minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" }, + "minty": { "branch": "main", "commit": "a3d69bd63fc98f640815f94b797bf978e9193022" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, - "noice.nvim": { "branch": "main", "commit": "ca2e3fea9fb080dcb79d9129d73dac631294fe79" }, + "noice.nvim": { "branch": "main", "commit": "6e0c8dcc61282782ac7fa4b9b4b0c910fd3f83d9" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, "nvim-colorizer.lua": { "branch": "master", "commit": "f134063618a65cad4d7415fddbd96ff7e0c5b4ae" }, - "nvim-dap": { "branch": "master", "commit": "6bf4de67dbe90271608e1c81797e5edc79ec6335" }, + "nvim-dap": { "branch": "master", "commit": "29d1f8814fa4fcc194ec574de998a42a22ebbe4a" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-jdtls": { "branch": "master", "commit": "c4279b8ffce9b64eb302056d78dfebc2968a49bc" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" }, + "nvim-lspconfig": { "branch": "master", "commit": "87c7c83ce62971e0bdb29bb32b8ad2b19c8f95d0" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, "nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" }, - "nvim-treesitter": { "branch": "master", "commit": "6389ceb1758b8f62a15194e3b790e33268304cb8" }, + "nvim-treesitter": { "branch": "master", "commit": "20e10ca6914f65cf1410232433fb58de70ab6b39" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, @@ -70,7 +71,7 @@ "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, - "volt": { "branch": "main", "commit": "1df6698f7e5d19db578063412d12322e53376f5e" }, + "volt": { "branch": "main", "commit": "2cf7e86f3bc7f41cbb6d0a8d0d84fc759c0dae86" }, "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, "yanky.nvim": { "branch": "main", "commit": "f9b905994cccf3c55f41af3a0a1f4c76c844e411" }, "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } diff --git a/lua/auto-jdtls2/create_maven_project.lua b/lua/auto-jdtls2/create_maven_project.lua new file mode 100644 index 0000000..bbfd05c --- /dev/null +++ b/lua/auto-jdtls2/create_maven_project.lua @@ -0,0 +1,113 @@ +local function mvn_new_project() + local function create_notif(message, level) + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify(message, level) + else + print(message) + end + end + -- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan + local function get_user_input(prompt, default_value) + vim.fn.inputsave() + local result = vim.fn.input(prompt, default_value) + vim.fn.inputrestore() + + -- Cek apakah pengguna menekan Esc untuk membatalkan input + if result == "" then + create_notif("Input canceled.", "info") + return nil, true + end + + return result, false + end + -- Ambil input dari pengguna untuk menentukan direktori proyek + local project_dir, canceled = get_user_input("Enter project directory: ", vim.fn.getcwd()) + if canceled then + return + end + -- Buat direktori jika belum ada + if vim.fn.isdirectory(project_dir) == 0 then + if vim.fn.mkdir(project_dir, "p") == 0 then + create_notif("Failed to create project directory: " .. project_dir, "error") + return + end + end + -- Pindah ke direktori proyek + local success, err = pcall(vim.fn.chdir, project_dir) + if not success then + create_notif("Error changing directory: " .. err, "error") + return + end + + create_notif("Changed directory to: " .. project_dir, "info") + -- Ambil input dari pengguna untuk Maven + local group_id, canceled_group = get_user_input("Enter groupId: ", "com.example") + if canceled_group then + return + end + local artifact_id, canceled_artifact = get_user_input("Enter artifactId: ", "myproject") + if canceled_artifact then + return + end + local archetype_artifact_id, canceled_archetype = + get_user_input("Enter archetypeArtifactId: ", "maven-archetype-quickstart") + if canceled_archetype then + return + end + local archetype_version, canceled_version = get_user_input("Enter archetypeVersion: ", "1.5") + if canceled_version then + return + end + local interactive_mode, canceled_interactive = get_user_input("Enter interactiveMode (true/false): ", "false") + if canceled_interactive then + return + end + -- Format perintah Maven berdasarkan input pengguna + local command = string.format( + [[mvn archetype:generate "-DgroupId=%s" "-DartifactId=%s" "-DarchetypeArtifactId=%s" "-DarchetypeVersion=%s" "-DinteractiveMode=%s"]], + group_id, + artifact_id, + archetype_artifact_id, + archetype_version, + interactive_mode + ) + + -- Fungsi untuk menjalankan perintah Maven dan menampilkan outputnya + local function run_maven_command(cmd, project_name) + local output = vim.fn.system(cmd) + if vim.v.shell_error ~= 0 then + print("Erro ao executar: " .. output) + else + local ch_dir = string.format("cd %s", project_name) + vim.fn.system(ch_dir) + vim.fn.chdir(project_name) + -- Cari dan buka file main class + local uname = vim.loop.os_uname().sysname + if uname == "Windows_NT" then + if group_id then + group_id = group_id:gsub("%.", "\\") + local main_class_path = string.format("src\\main\\java\\%s\\App.java", group_id) + if vim.fn.filereadable(main_class_path) == 1 then + vim.cmd(":edit " .. main_class_path) + end + end + else + if group_id then + group_id = group_id:gsub("%.", "/") + local main_class_path = string.format("src/main/java/%s/App.java", group_id) + if vim.fn.filereadable(main_class_path) == 1 then + vim.cmd(":edit " .. main_class_path) + end + end + end + vim.cmd(":NvimTreeFindFileToggl") + end + end + + -- Jalankan perintah Maven dan buka proyek + run_maven_command(command, artifact_id) + create_notif("Project created successfully !", "info") +end + +vim.api.nvim_create_user_command("MavenNewProject", mvn_new_project, {}) diff --git a/lua/auto-jdtls2/create_springboot_project.lua b/lua/auto-jdtls2/create_springboot_project.lua new file mode 100644 index 0000000..42b4915 --- /dev/null +++ b/lua/auto-jdtls2/create_springboot_project.lua @@ -0,0 +1,289 @@ +local function create_notif(message, level) + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify(message, level) + else + print(message) + end +end + +local function safe_request(url) + local status, request = pcall(function() + return vim.system({ "curl", "-s", url }, { text = true }):wait() + end) + + if not status then + vim.api.nvim_err_writeln("Error making request to " .. url .. ": " .. request) + return nil + end + + return request +end + +local function safe_json_decode(data) + local status, decoded = pcall(vim.fn.json_decode, data) + + if not status then + vim.api.nvim_err_writeln("Error decoding JSON: " .. decoded) + return nil + end + + return decoded +end + +local function contains(list, element) + for _, value in pairs(list) do + if value == element then + return true + end + end + return false +end + +local function list_to_string(list, is_err) + local result = "" + + for i, value in ipairs(list) do + if is_err then + result = result .. "'" .. tostring(value) .. "'" + else + result = result .. tostring(value) + end + if i < #list then + if is_err then + result = result .. " or " + else + result = result .. "/" + end + end + end + return result +end + +local function handle_start_springboot_data(data) + local spring_data = {} + for _, value in pairs(data.values) do + table.insert(spring_data, value.id) + end + return spring_data +end + +local function change_directory() + -- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan + local function get_user_input(prompt, default_value) + vim.fn.inputsave() + local result = vim.fn.input(prompt, default_value) + vim.fn.inputrestore() + + -- Cek apakah pengguna menekan Esc untuk membatalkan input + if result == "" then + create_notif("Input canceled.", "info") + return nil, true + end + + return result, false + end + + -- Ambil input dari pengguna untuk menentukan direktori proyek + local project_dir, canceled = get_user_input("Enter project directory: ", vim.fn.getcwd()) + if canceled then + return + end + -- Buat direktori jika belum ada + if vim.fn.isdirectory(project_dir) == 0 then + if vim.fn.mkdir(project_dir, "p") == 0 then + create_notif("Failed to create project directory: " .. project_dir, "error") + return + end + end + -- Pindah ke direktori proyek + local success, err = pcall(vim.fn.chdir, project_dir) + if not success then + create_notif("Error changing directory: " .. err, "error") + return + end + + create_notif("Changed directory to: " .. project_dir, "info") + return project_dir +end + +local function get_build_type(data_available) + local build_type_available = list_to_string(data_available, false) + local options_err = list_to_string(data_available, true) + local build_type = vim.fn.input("Enter build type (" .. build_type_available .. "): ", "maven") + if not contains(data_available, build_type) then + create_notif("Invalid build type. Please enter " .. options_err .. ".", "info") + return "" + end + + return build_type +end + +local function get_language(data_available) + local language_available = list_to_string(data_available, false) + local options_err = list_to_string(data_available, true) + + local language = vim.fn.input("Enter Language (" .. language_available .. "): ", "java") + if not contains(data_available, language) then + create_notif("Invalid language. Please enter " .. options_err .. ".", "info") + return "" + end + + return language +end + +local function get_java_version(data_available) + local version_available = list_to_string(data_available, false) + local options_err = list_to_string(data_available, true) + + local java_version = vim.fn.input("Enter Java Version (" .. version_available .. "): ", "21") + if not contains(data_available, java_version) then + create_notif("Invalid Java version. Please enter a valid version " .. options_err .. ".", "info") + return "" + end + + return java_version +end + +local function get_boot_version(data_available) + local version_available = list_to_string(data_available, false) + local options_err = list_to_string(data_available, true) + + local versions_table = {} + for v in string.gmatch(version_available, "([^/]+)") do + table.insert(versions_table, "-> " .. v) + end + local annotated_versions = table.concat(versions_table, "\n") + local boot_version = vim.fn.input(annotated_versions .. "\n: ", "3.3.5.RELEASE") + if not contains(data_available, boot_version) then + create_notif("Invalid Spring Boot version. Please enter a valid version " .. options_err .. ".", "info") + return "" + end + + return boot_version +end + +local function get_packaging(data_available) + local packaging_available = list_to_string(data_available, false) + local options_err = list_to_string(data_available, true) + + local packaging = vim.fn.input("Enter Packaging(" .. packaging_available .. "): ", "jar") + if packaging ~= "jar" and packaging ~= "war" then + create_notif("Invalid packaging. Please enter " .. options_err .. ".", "info") + return "" + end + return packaging +end + +local function springboot_new_project() + local request = safe_request("https://start.spring.io/metadata/client") + + if not request then + vim.api.nvim_err_writeln("Failed to make a request to the URL.") + return false + end + + local springboot_data = safe_json_decode(request.stdout) + + if not springboot_data then + vim.api.nvim_err_writeln("Failed to decode JSON from the request.") + return false + end + local project_dir = change_directory() + local build_types = { "maven", "gradle" } + local languages = handle_start_springboot_data(springboot_data.language) + local java_versions = handle_start_springboot_data(springboot_data.javaVersion) + local boot_versions = handle_start_springboot_data(springboot_data.bootVersion) + local packagings = handle_start_springboot_data(springboot_data.packaging) + local build_type = get_build_type(build_types) + + if build_type:len() == 0 then + return + end + + local language = get_language(languages) + if language:len() == 0 then + return + end + + local java_version = get_java_version(java_versions) + if java_version:len() == 0 then + return + end + + local boot_version = get_boot_version(boot_versions) + if boot_version:len() == 0 then + return + end + + local packaging = get_packaging(packagings) + if packaging:len() == 0 then + return + end + + local dependencies = vim.fn.input("Enter dependencies (comma separated): ", "devtools,web,data-jpa,h2,thymeleaf") + local group_id = vim.fn.input("Enter Group ID: ", "com.example") + local artifact_id = vim.fn.input("Enter Artifact ID: ", "myproject") + local name = vim.fn.input("Enter project name: ", artifact_id) + local package_name = vim.fn.input("Enter package name: ", group_id .. "." .. artifact_id) + local description = vim.fn.input("Enter project description: ", "") + + local command = string.format( + "spring init --boot-version=%s --java-version=%s --dependencies=%s --groupId=%s --artifactId=%s --name=%s --package-name=%s --description=%s --language=%s --build=%s %s", + boot_version, + java_version, + dependencies, + group_id, + artifact_id, + name, + package_name, + description, -- Menambahkan deskripsi proyek + language, -- Menambahkan bahasa pemrograman (Java, Kotlin, atau Groovy) + build_type, + name + ) + + -- Fungsi untuk mengubah teks + local function capitalize_first_letter(str) + return str:sub(1, 1):upper() .. str:sub(2):lower() + end + + local output = vim.fn.system(command) + if vim.v.shell_error ~= 0 then + create_notif("Erro ao executar: " .. output, "error") + else + local ch_dir = string.format("cd %s", project_dir .. "/" .. name) + vim.fn.system(ch_dir) + vim.fn.chdir(project_dir .. "/" .. name) + create_notif(name, "info") + -- Cari dan buka file main class + local uname = vim.loop.os_uname().sysname + local pth = package_name + if uname == "Windows_NT" then + if pth then + pth = pth:gsub("%.", "\\") + create_notif(pth, "info") + local main_class_path = + string.format("src\\main\\java\\%s\\" .. capitalize_first_letter(name) .. "Application.java", pth) + create_notif(main_class_path, "info") + if vim.fn.filereadable(main_class_path) == 1 then + vim.cmd(":edit " .. main_class_path) + end + end + else + if pth then + pth = pth:gsub("%.", "/") + local main_class_path = + string.format("src/main/java/%s/" .. capitalize_first_letter(name) .. "Application.java", pth) + if vim.fn.filereadable(main_class_path) == 1 then + vim.cmd(":edit " .. main_class_path) + end + end + end + vim.cmd(":NvimTreeFindFileToggl") + end + + create_notif("Project created successfully!", "info") +end + +vim.api.nvim_create_user_command("SpringBootNewProject", springboot_new_project, {}) diff --git a/lua/auto-jdtls2/init.lua b/lua/auto-jdtls2/init.lua index af1787a..24ff4be 100644 --- a/lua/auto-jdtls2/init.lua +++ b/lua/auto-jdtls2/init.lua @@ -3,6 +3,8 @@ local M = {} M.setup = function(opt) opt = opt or {} require("auto-jdtls.utils").install() + require("auto-jdtls.create_maven_project") + require("auto-jdtls.create_springboot_project") require("auto-jdtls.utils").attach_jdtls(opt) end diff --git a/lua/auto-jdtls2/utils.lua b/lua/auto-jdtls2/utils.lua index ce6262a..67c63e3 100644 --- a/lua/auto-jdtls2/utils.lua +++ b/lua/auto-jdtls2/utils.lua @@ -52,6 +52,161 @@ M.lsp_keymaps=function () vim.keymap.set("n", "lD", vim.lsp.buf.declaration, { desc = "Code Goto Declaration" }) end +M.is_maven_project = function() + if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then + return true + else + return false + end +end + +M.is_gradle_project = function() + if + vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" + or vim.fn.findfile("settings.gradle", vim.fn.getcwd()) == "settings.gradle" + or vim.fn.findfile("gradlew", vim.fn.getcwd()) == "gradlew" + then + return true + else + return false + end +end + +M.is_main_class = function() + local bufnr = vim.api.nvim_get_current_buf() + local content = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + for i, line in ipairs(content) do + if line:match("public static void main%s*%(") then + return true + end + end + + return false +end + +M.run_aven_pring_boot = function() + if M.is_maven_project() then + vim.cmd("terminal mvn spring-boot:run") + else + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify("Project pom.xml not found !", "info") + else + print("Project pom.xml not found !") + end + end +end + +M.cmd_maven_spring_boot = function() + vim.api.nvim_create_user_command("RunMvnSpringBoot", function() + M.run_aven_pring_boot() + end, { nargs = 0 }) +end + +M.run_gradle_spring_boot = function() + if M.is_gradle_project() then + local uname = vim.loop.os_uname().sysname + if uname == "Windows_NT" then + vim.cmd("terminal .\\gradlew build --continuous") + vim.cmd("terminal .\\gradlew bootRun") + else + vim.cmd("terminal ./gradlew build --continuous") + vim.cmd("terminal ./gradlew bootRun") + end + else + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify("Project build.gradle not found !", "info") + else + print("Project build.gradle not found !") + end + end +end + +M.cmd_gradle_spring_boot = function() + vim.api.nvim_create_user_command("RunGradleSpringBoot", function() + M.run_gradle_spring_boot() + end, { nargs = 0 }) +end + +M.run_mvn_and_java = function() + if M.is_maven_project() then + local result = M.is_main_class() + if not result then + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify("Please open java main class !", "info") + else + print("Please open java main class !") + end + return + else + -- Fungsi untuk mencari file .jar dalam folder target + local function find_jar_file() + local target_dir = "target" + local jar_file = nil + + local handle = vim.loop.fs_scandir(target_dir) + if handle then + while true do + local name, t = vim.loop.fs_scandir_next(handle) + if not name then + break + end + if t == "file" and name:match("%.jar$") then + jar_file = name + break + end + end + end + return jar_file + end + local jar_file = find_jar_file() + -- Buat fungsi untuk menjalankan perintah secara berurutan dalam mode diam + function RunMvnAndJava() + -- daptkan path + local root = vim.uv.cwd() + local fname = vim.api.nvim_buf_get_name(0) + fname = fname:gsub(root, "") + fname = fname:gsub("/src/main/java/", "") + fname = fname:gsub("\\src\\main\\java\\", "") + fname = fname:gsub(".java", ""):gsub("/", ".") + fname = fname:gsub("\\", ".") + -- Jalankan perintah mvn package secara diam-diam + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify("Compile Start !", "info") + end + vim.fn.jobstart("mvn package", { + on_exit = function() + vim.cmd("terminal java -cp target/" .. jar_file .. " " .. fname) + end, + }) + end + RunMvnAndJava() + end + else + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify("Project pom.xml not found !", "info") + else + print("Project pom.xml not found !") + end + end +end + +M.cmd_mvn_and_java = function() + vim.api.nvim_create_user_command("RunMaven", function() + M.run_mvn_and_java() + end, { nargs = 0 }) +end + +M.cmd_gradle = function() + vim.api.nvim_create_user_command("RunGradle", function() + vim.cmd("terminal gradle run") + end, { nargs = 0 }) +end + -- stylua: ignore M.jdtls_keymaps=function () -- add keymaps @@ -213,6 +368,11 @@ M.attach_jdtls = function(op) end -- initialisasi config local function attach_jdtls() + -- load user cmd + M.cmd_maven_spring_boot() + M.cmd_gradle_spring_boot() + M.cmd_mvn_and_java() + M.cmd_gradle() -- Configuration can be augmented and overridden by opts.jdtls local config = M.extend_or_override({ cmd = M.opts.full_cmd(M.opts), diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 3367fb1..50daaf7 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -7,11 +7,17 @@ M = { vim.list_extend(opts.skip_config, { "jdtls" }) end, }, + { + "pojokcodeid/auto-java-project.nvim", + event = "VeryLazy", + config = function() + require("auto-java-project").setup() + end, + }, { "mfussenegger/nvim-jdtls", dependencies = { "pojokcodeid/auto-jdtls.nvim" }, ft = { "java" }, - enabled = true, -- your opts go here opts = {}, config = function(_, opts) @@ -33,8 +39,9 @@ M = { "nvim-treesitter/nvim-treesitter", "andy-bell101/neotest-java", }, - enabled = vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" or false, + -- enabled = vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" or false, config = function() + require("auto-jdtls.create_maven_project") require("neotest").setup({ adapters = { require("neotest-java"), From c66913e4c2008d559bd452b5402eaebe9863d64d Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Sat, 16 Nov 2024 21:51:22 +0700 Subject: [PATCH 40/59] enc: add gradle create new project --- lazy-lock.json | 4 +- lua/auto-jdtls2/create_gradle_project.lua | 88 +++++++++++++++++++++++ lua/auto-jdtls2/init.lua | 1 + 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 lua/auto-jdtls2/create_gradle_project.lua diff --git a/lazy-lock.json b/lazy-lock.json index d770724..2035390 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,7 @@ "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-java-project.nvim": { "branch": "main", "commit": "940531b6eeea682fa734f8dc160d7870dde38df2" }, + "auto-java-project.nvim": { "branch": "main", "commit": "b685ad4fbda1a28cb61dd941d54fb0dd3c22d8f4" }, "auto-jdtls.nvim": { "branch": "main", "commit": "050da8d68c51a6e02a08d91329b7a848887927e7" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "1f3ef04741972c107187a07be5615ff210888184" }, @@ -38,7 +38,7 @@ "minty": { "branch": "main", "commit": "a3d69bd63fc98f640815f94b797bf978e9193022" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, - "noice.nvim": { "branch": "main", "commit": "6e0c8dcc61282782ac7fa4b9b4b0c910fd3f83d9" }, + "noice.nvim": { "branch": "main", "commit": "221ffbc499d322699ea079fcd878a2399529e775" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, diff --git a/lua/auto-jdtls2/create_gradle_project.lua b/lua/auto-jdtls2/create_gradle_project.lua new file mode 100644 index 0000000..1867635 --- /dev/null +++ b/lua/auto-jdtls2/create_gradle_project.lua @@ -0,0 +1,88 @@ +local function gradle_new_project() + local function create_notif(message, level) + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify(message, level) + else + print(message) + end + end + + -- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan + local function get_user_input(prompt, default_value) + vim.fn.inputsave() + local result = vim.fn.input(prompt, default_value) + vim.fn.inputrestore() + + -- Cek apakah pengguna menekan Esc untuk membatalkan input + if result == "" then + create_notif("Input canceled.", "info") + return nil, true + end + + return result, false + end + + -- Ambil input dari pengguna untuk menentukan direktori proyek + local project_dir, canceled = get_user_input("Enter project directory: ", vim.fn.getcwd()) + if canceled then + return + end + + -- Ambil input dari pengguna untuk Gradle + local project_name, canceled_name = get_user_input("Enter project name: ", "myjavaproject") + if canceled_name then + return + end + + project_dir = project_dir .. "\\" .. project_name + + -- Buat direktori jika belum ada + if vim.fn.isdirectory(project_dir) == 0 then + if vim.fn.mkdir(project_dir, "p") == 0 then + create_notif("Failed to create project directory: " .. project_dir, "error") + return + end + end + -- Pindah ke direktori proyek + local success, err = pcall(vim.fn.chdir, project_dir) + if not success then + create_notif("Error changing directory: " .. err, "error") + return + end + + create_notif("Changed directory to: " .. project_dir, "info") + + -- Ambil input package name + local package_name, canceled_package = get_user_input("Enter package name: ", "com.example." .. project_name) + if canceled_package then + return + end + + -- Format perintah Gradle berdasarkan input pengguna + local command = string.format( + "gradle init --type java-application --dsl groovy --project-name %s --package %s", + project_name, + package_name + ) + + -- Fungsi untuk menjalankan perintah Gradle dan menampilkan outputnya + local function run_gradle_command(cmd, dir, pkg) + local output = vim.fn.system(cmd) + if vim.v.shell_error ~= 0 then + create_notif("Error executing: " .. output, "error") + else + create_notif("Project created successfully!", "info") + local main_class_path = string.format("%s/app/src/main/java/%s/App.java", dir, pkg:gsub("%.", "/")) + if vim.fn.filereadable(main_class_path) == 1 then + vim.cmd(":edit " .. main_class_path) + end + vim.cmd(":NvimTreeFindFileToggle") + end + end + + -- Jalankan perintah Gradle dan buka proyek + run_gradle_command(command, project_dir, package_name) +end + +vim.api.nvim_create_user_command("GradleNewProject", gradle_new_project, {}) diff --git a/lua/auto-jdtls2/init.lua b/lua/auto-jdtls2/init.lua index 24ff4be..6afe333 100644 --- a/lua/auto-jdtls2/init.lua +++ b/lua/auto-jdtls2/init.lua @@ -3,6 +3,7 @@ local M = {} M.setup = function(opt) opt = opt or {} require("auto-jdtls.utils").install() + require("auto-jdtls.create_gradle_project") require("auto-jdtls.create_maven_project") require("auto-jdtls.create_springboot_project") require("auto-jdtls.utils").attach_jdtls(opt) From 11a88eb681b1b8651999f3f1ab756a2faec559e2 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Sun, 17 Nov 2024 10:12:07 +0700 Subject: [PATCH 41/59] enc: add create file java --- lazy-lock.json | 5 +- lua/auto-jdtls2/generate_java_class.lua | 115 +++++++++++++++++++ lua/auto-jdtls2/generate_java_interface.lua | 109 ++++++++++++++++++ lua/auto-jdtls2/generate_java_main_class.lua | 115 +++++++++++++++++++ lua/auto-jdtls2/init.lua | 3 + lua/pcode/plugins/lang/java.lua | 3 + lua/pcode/user/default.lua | 2 +- 7 files changed, 348 insertions(+), 4 deletions(-) create mode 100644 lua/auto-jdtls2/generate_java_class.lua create mode 100644 lua/auto-jdtls2/generate_java_interface.lua create mode 100644 lua/auto-jdtls2/generate_java_main_class.lua diff --git a/lazy-lock.json b/lazy-lock.json index 2035390..5eaf777 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,7 @@ "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-java-project.nvim": { "branch": "main", "commit": "b685ad4fbda1a28cb61dd941d54fb0dd3c22d8f4" }, + "auto-java-project.nvim": { "branch": "main", "commit": "796bbee285c5eaed8784b8d91edd0ea5d25a3856" }, "auto-jdtls.nvim": { "branch": "main", "commit": "050da8d68c51a6e02a08d91329b7a848887927e7" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "1f3ef04741972c107187a07be5615ff210888184" }, @@ -28,7 +28,6 @@ "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, - "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "cab00668464d2914d0752b86168b4a431cc93eb2" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, @@ -40,7 +39,7 @@ "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, "noice.nvim": { "branch": "main", "commit": "221ffbc499d322699ea079fcd878a2399529e775" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, - "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, + "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, "nvim-colorizer.lua": { "branch": "master", "commit": "f134063618a65cad4d7415fddbd96ff7e0c5b4ae" }, "nvim-dap": { "branch": "master", "commit": "29d1f8814fa4fcc194ec574de998a42a22ebbe4a" }, diff --git a/lua/auto-jdtls2/generate_java_class.lua b/lua/auto-jdtls2/generate_java_class.lua new file mode 100644 index 0000000..0a57941 --- /dev/null +++ b/lua/auto-jdtls2/generate_java_class.lua @@ -0,0 +1,115 @@ +local function create_java_class() + local is_maven_project = function() + if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then + return true + else + return false + end + end + + local function create_notif(message, level) + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify(message, level) + else + print(message) + end + end + + -- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan + local function get_user_input(prompt, default_value) + vim.fn.inputsave() + local result = vim.fn.input(prompt, default_value) + vim.fn.inputrestore() + + -- Cek apakah pengguna menekan Esc untuk membatalkan input + if result == "" then + create_notif("Input canceled.", "info") + return nil, true + end + + return result, false + end + + -- Fungsi untuk mendapatkan nama package default berdasarkan buffer aktif + local function get_default_package() + local path = vim.fn.expand("%:p:h") + local project_root = vim.fn.getcwd() + local relative_path = path:sub(#project_root + 1) + relative_path = relative_path:gsub("app\\src\\main\\java\\", "") + relative_path = relative_path:gsub("src\\main\\java\\", "") + relative_path = relative_path:gsub("app/src/main/java/", "") + relative_path = relative_path:gsub("src/main/java/", "") + relative_path = relative_path:gsub("\\", ".") + relative_path = relative_path:gsub("/", ".") + return relative_path:sub(2) + end + + -- Ambil input dari pengguna untuk nama package dan nama kelas + local package_name, canceled_package = get_user_input("Enter package name: ", get_default_package()) + if canceled_package then + return + end + + local class_name, canceled_class = get_user_input("Enter class name: ", "MyClass") + if canceled_class then + return + end + + -- Format direktori dan path file berdasarkan input pengguna + local package_dir = nil + if package_name then + if is_maven_project() then + package_dir = string.format("src/main/java/%s", package_name:gsub("%.", "/")) + else + package_dir = string.format("app/src/main/java/%s", package_name:gsub("%.", "/")) + end + if vim.fn.isdirectory(package_dir) == 0 then + vim.fn.mkdir(package_dir, "p") + end + else + create_notif("Invalid package name: " .. package_name, "error") + return + end + + local file_path = string.format("%s/%s.java", package_dir, class_name) + if vim.fn.filereadable(file_path) == 1 then + create_notif("Class already exists: " .. file_path, "error") + return + end + + -- Tulis konten kelas Java ke dalam file + local class_content = string.format( + [[ +/* + * This Java source file. + */ +package %s; + +public class %s { + /** + * + */ + public %s() { + + } + // Other methods and fields +} +]], + package_name, + class_name, + class_name + ) + + local file = io.open(file_path, "w") + if file then + file:write(class_content) + file:close() + end + + -- Buka file Java yang baru dibuat di Neovim + vim.cmd(":edit " .. file_path) + create_notif("Java class created: " .. file_path, "info") +end + +vim.api.nvim_create_user_command("CreateJavaClass", create_java_class, {}) diff --git a/lua/auto-jdtls2/generate_java_interface.lua b/lua/auto-jdtls2/generate_java_interface.lua new file mode 100644 index 0000000..2e567d0 --- /dev/null +++ b/lua/auto-jdtls2/generate_java_interface.lua @@ -0,0 +1,109 @@ +local function create_java_class() + local function create_notif(message, level) + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify(message, level) + else + print(message) + end + end + + local is_maven_project = function() + if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then + return true + else + return false + end + end + + -- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan + local function get_user_input(prompt, default_value) + vim.fn.inputsave() + local result = vim.fn.input(prompt, default_value) + vim.fn.inputrestore() + + -- Cek apakah pengguna menekan Esc untuk membatalkan input + if result == "" then + create_notif("Input canceled.", "info") + return nil, true + end + + return result, false + end + + -- Fungsi untuk mendapatkan nama package default berdasarkan buffer aktif + local function get_default_package() + local path = vim.fn.expand("%:p:h") + local project_root = vim.fn.getcwd() + local relative_path = path:sub(#project_root + 1) + relative_path = relative_path:gsub("app\\src\\main\\java\\", "") + relative_path = relative_path:gsub("src\\main\\java\\", "") + relative_path = relative_path:gsub("app/src/main/java/", "") + relative_path = relative_path:gsub("src/main/java/", "") + relative_path = relative_path:gsub("\\", ".") + relative_path = relative_path:gsub("/", ".") + return relative_path:sub(2) + end + + -- Ambil input dari pengguna untuk nama package dan nama kelas + local package_name, canceled_package = get_user_input("Enter package name: ", get_default_package()) + if canceled_package then + return + end + + local class_name, canceled_class = get_user_input("Enter interface name: ", "MyInterface") + if canceled_class then + return + end + + -- Format direktori dan path file berdasarkan input pengguna + local package_dir = nil + if package_name then + if is_maven_project() then + package_dir = string.format("src/main/java/%s", package_name:gsub("%.", "/")) + else + package_dir = string.format("app/src/main/java/%s", package_name:gsub("%.", "/")) + end + if vim.fn.isdirectory(package_dir) == 0 then + vim.fn.mkdir(package_dir, "p") + end + else + create_notif("Invalid package name: " .. package_name, "error") + return + end + + local file_path = string.format("%s/%s.java", package_dir, class_name) + if vim.fn.filereadable(file_path) == 1 then + create_notif("Class already exists: " .. file_path, "error") + return + end + + -- Tulis konten kelas Java ke dalam file + local class_content = string.format( + [[ +/* + * This Java source file. + */ +package %s; + +public interface %s { + // Other methods and fields +} +]], + package_name, + class_name, + class_name + ) + + local file = io.open(file_path, "w") + if file then + file:write(class_content) + file:close() + end + + -- Buka file Java yang baru dibuat di Neovim + vim.cmd(":edit " .. file_path) + create_notif("Java interface created: " .. file_path, "info") +end + +vim.api.nvim_create_user_command("CreateJavaInterface", create_java_class, {}) diff --git a/lua/auto-jdtls2/generate_java_main_class.lua b/lua/auto-jdtls2/generate_java_main_class.lua new file mode 100644 index 0000000..cd8878a --- /dev/null +++ b/lua/auto-jdtls2/generate_java_main_class.lua @@ -0,0 +1,115 @@ +local function create_java_main_class() + local function create_notif(message, level) + local notif_ok, notify = pcall(require, "notify") + if notif_ok then + notify(message, level) + else + print(message) + end + end + + local is_maven_project = function() + if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then + return true + else + return false + end + end + + -- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan + local function get_user_input(prompt, default_value) + vim.fn.inputsave() + local result = vim.fn.input(prompt, default_value) + vim.fn.inputrestore() + + -- Cek apakah pengguna menekan Esc untuk membatalkan input + if result == "" then + create_notif("Input canceled.", "info") + return nil, true + end + + return result, false + end + + -- Fungsi untuk mendapatkan nama package default berdasarkan buffer aktif + local function get_default_package() + local path = vim.fn.expand("%:p:h") + local project_root = vim.fn.getcwd() + local relative_path = path:sub(#project_root + 1) + relative_path = relative_path:gsub("app\\src\\main\\java\\", "") + relative_path = relative_path:gsub("src\\main\\java\\", "") + relative_path = relative_path:gsub("app/src/main/java/", "") + relative_path = relative_path:gsub("src/main/java/", "") + relative_path = relative_path:gsub("\\", ".") + relative_path = relative_path:gsub("/", ".") + return relative_path:sub(2) + end + + -- Ambil input dari pengguna untuk nama package dan nama kelas + local package_name, canceled_package = get_user_input("Enter package name: ", get_default_package()) + if canceled_package then + return + end + + local class_name, canceled_class = get_user_input("Enter class name: ", "MyMainClass") + if canceled_class then + return + end + + -- Format direktori dan path file berdasarkan input pengguna + local package_dir = nil + if package_name then + if is_maven_project() then + package_dir = string.format("src/main/java/%s", package_name:gsub("%.", "/")) + else + package_dir = string.format("app/src/main/java/%s", package_name:gsub("%.", "/")) + end + if vim.fn.isdirectory(package_dir) == 0 then + vim.fn.mkdir(package_dir, "p") + end + else + create_notif("Invalid package name: " .. package_name, "error") + return + end + + local file_path = string.format("%s/%s.java", package_dir, class_name) + if vim.fn.filereadable(file_path) == 1 then + create_notif("Class already exists: " .. file_path, "error") + return + end + + -- Tulis konten kelas Java ke dalam file + local class_content = string.format( + [[ +/* + * This Java source file. + */ +package %s; + +public class %s { + /** + * + */ + public static void main(String[] args) { + System.out.println("Hello World"); + } + +} +]], + package_name, + class_name, + class_name + ) + + local file = io.open(file_path, "w") + if file then + file:write(class_content) + file:close() + end + + -- Buka file Java yang baru dibuat di Neovim + vim.cmd(":edit " .. file_path) + create_notif("Java class created: " .. file_path, "info") +end + +vim.api.nvim_create_user_command("CreateJavaMainClass", create_java_main_class, {}) diff --git a/lua/auto-jdtls2/init.lua b/lua/auto-jdtls2/init.lua index 6afe333..83cc941 100644 --- a/lua/auto-jdtls2/init.lua +++ b/lua/auto-jdtls2/init.lua @@ -6,6 +6,9 @@ M.setup = function(opt) require("auto-jdtls.create_gradle_project") require("auto-jdtls.create_maven_project") require("auto-jdtls.create_springboot_project") + require("auto-jdtls.generate_java_class") + require("auto-jdtls.generate_java_interface") + require("auto-jdtls.generate_java_main_class") require("auto-jdtls.utils").attach_jdtls(opt) end diff --git a/lua/pcode/plugins/lang/java.lua b/lua/pcode/plugins/lang/java.lua index 50daaf7..aaba41c 100644 --- a/lua/pcode/plugins/lang/java.lua +++ b/lua/pcode/plugins/lang/java.lua @@ -12,6 +12,9 @@ M = { event = "VeryLazy", config = function() require("auto-java-project").setup() + vim.keymap.set("n", "Jc", ":CreateJavaClass", { desc = "Create Java Class" }) + vim.keymap.set("n", "Jm", ":CreateJavaMainClass", { desc = "Create Java Main Class" }) + vim.keymap.set("n", "Ji", ":CreateJavaInterface", { desc = "Create Java Interface" }) end, }, { diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index efd2f8a..ada123c 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -45,7 +45,7 @@ pcode.extras = { visualmulti = true, yanky = true, zenmode = true, - lspsignatur = true, + lspsignatur = false, telescopetreesiterinfo = true, } -- activate config themes From b3f841d25c0652aa419dd65f1c6ba4392898d2b3 Mon Sep 17 00:00:00 2001 From: Pojok Code Date: Mon, 18 Nov 2024 20:18:15 +0700 Subject: [PATCH 42/59] qa: testing create java project --- lazy-lock.json | 18 ++++---- lua/auto-jdtls2/create_gradle_project.lua | 56 +++++++++-------------- lua/auto-jdtls2/create_maven_project.lua | 20 ++++++-- lua/auto-jdtls2/generate_java_class.lua | 11 +---- lua/auto-jdtls2/init.lua | 16 +++---- lua/pcode/plugins/notify.lua | 2 +- lua/pcode/user/java.lua | 3 ++ 7 files changed, 59 insertions(+), 67 deletions(-) create mode 100644 lua/pcode/user/java.lua diff --git a/lazy-lock.json b/lazy-lock.json index 5eaf777..34722d7 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,11 +2,11 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, + "LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-java-project.nvim": { "branch": "main", "commit": "796bbee285c5eaed8784b8d91edd0ea5d25a3856" }, + "auto-java-project.nvim": { "branch": "v2", "commit": "71107191bed6bac984b886af458d3ac405e7a5fb" }, "auto-jdtls.nvim": { "branch": "main", "commit": "050da8d68c51a6e02a08d91329b7a848887927e7" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, "auto-lsp.nvim": { "branch": "main", "commit": "1f3ef04741972c107187a07be5615ff210888184" }, @@ -29,7 +29,7 @@ "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "cab00668464d2914d0752b86168b4a431cc93eb2" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, @@ -37,7 +37,7 @@ "minty": { "branch": "main", "commit": "a3d69bd63fc98f640815f94b797bf978e9193022" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, - "noice.nvim": { "branch": "main", "commit": "221ffbc499d322699ea079fcd878a2399529e775" }, + "noice.nvim": { "branch": "main", "commit": "2626b4a49340e4eae24a388468ac98680fc24532" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, @@ -47,17 +47,17 @@ "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, "nvim-jdtls": { "branch": "master", "commit": "c4279b8ffce9b64eb302056d78dfebc2968a49bc" }, "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "87c7c83ce62971e0bdb29bb32b8ad2b19c8f95d0" }, + "nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, - "nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" }, - "nvim-treesitter": { "branch": "master", "commit": "20e10ca6914f65cf1410232433fb58de70ab6b39" }, + "nvim-tree.lua": { "branch": "master", "commit": "f7c65e11d695a084ca10b93df659bb7e68b71f9f" }, + "nvim-treesitter": { "branch": "master", "commit": "37427012d1c77c544356bfff0c9acc88fd3256bc" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, - "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "nvim-web-devicons": { "branch": "master", "commit": "e87554285f581047b1bf236794b0eb812b444b87" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, @@ -70,7 +70,7 @@ "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, - "volt": { "branch": "main", "commit": "2cf7e86f3bc7f41cbb6d0a8d0d84fc759c0dae86" }, + "volt": { "branch": "main", "commit": "41c03a5d6a0a8a997e774a3482d82e5ef820c6ba" }, "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, "yanky.nvim": { "branch": "main", "commit": "f9b905994cccf3c55f41af3a0a1f4c76c844e411" }, "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } diff --git a/lua/auto-jdtls2/create_gradle_project.lua b/lua/auto-jdtls2/create_gradle_project.lua index 1867635..4395750 100644 --- a/lua/auto-jdtls2/create_gradle_project.lua +++ b/lua/auto-jdtls2/create_gradle_project.lua @@ -22,67 +22,55 @@ local function gradle_new_project() return result, false end - - -- Ambil input dari pengguna untuk menentukan direktori proyek - local project_dir, canceled = get_user_input("Enter project directory: ", vim.fn.getcwd()) - if canceled then + -- Ambil input Testing + local test, canceled_test = get_user_input("Testing (junit,junit-jupiter,testng,spock): ", "junit-jupiter") + if canceled_test then return end - - -- Ambil input dari pengguna untuk Gradle - local project_name, canceled_name = get_user_input("Enter project name: ", "myjavaproject") - if canceled_name then + -- Ambil input DSL + local script_dsl, canceled_dsl = get_user_input("Script DSL (kotlin, groovy): ", "groovy") + if canceled_dsl then return end - - project_dir = project_dir .. "\\" .. project_name - - -- Buat direktori jika belum ada - if vim.fn.isdirectory(project_dir) == 0 then - if vim.fn.mkdir(project_dir, "p") == 0 then - create_notif("Failed to create project directory: " .. project_dir, "error") - return - end - end - -- Pindah ke direktori proyek - local success, err = pcall(vim.fn.chdir, project_dir) - if not success then - create_notif("Error changing directory: " .. err, "error") - return - end - - create_notif("Changed directory to: " .. project_dir, "info") - -- Ambil input package name - local package_name, canceled_package = get_user_input("Enter package name: ", "com.example." .. project_name) + local package_name, canceled_package = get_user_input("Enter package name: ", "com.example") if canceled_package then return end -- Format perintah Gradle berdasarkan input pengguna local command = string.format( - "gradle init --type java-application --dsl groovy --project-name %s --package %s", - project_name, + "echo no | gradle init --type java-application --test-framework %s --dsl %s --package %s --no-daemon", + test, + script_dsl, package_name ) -- Fungsi untuk menjalankan perintah Gradle dan menampilkan outputnya - local function run_gradle_command(cmd, dir, pkg) + local function run_gradle_command(cmd, path, pkg) local output = vim.fn.system(cmd) if vim.v.shell_error ~= 0 then create_notif("Error executing: " .. output, "error") else create_notif("Project created successfully!", "info") - local main_class_path = string.format("%s/app/src/main/java/%s/App.java", dir, pkg:gsub("%.", "/")) + create_notif("Please Reopen Dir : " .. path, "info") + vim.cmd(":NvimTreeFindFileToggle") + local main_class_path = string.format("%s/app/src/main/java/%s/App.java", path, pkg:gsub("%.", "/")) if vim.fn.filereadable(main_class_path) == 1 then vim.cmd(":edit " .. main_class_path) end - vim.cmd(":NvimTreeFindFileToggle") + local function delayed_quit() + vim.defer_fn(function() + vim.cmd("qa!") + end, 4000) -- Delay is set in milliseconds (3,000ms = 3 seconds) + end + -- Run the delayed quit function + delayed_quit() end end -- Jalankan perintah Gradle dan buka proyek - run_gradle_command(command, project_dir, package_name) + run_gradle_command(command, vim.fn.getcwd(), package_name) end vim.api.nvim_create_user_command("GradleNewProject", gradle_new_project, {}) diff --git a/lua/auto-jdtls2/create_maven_project.lua b/lua/auto-jdtls2/create_maven_project.lua index bbfd05c..29a9595 100644 --- a/lua/auto-jdtls2/create_maven_project.lua +++ b/lua/auto-jdtls2/create_maven_project.lua @@ -34,22 +34,32 @@ local function mvn_new_project() end end -- Pindah ke direktori proyek - local success, err = pcall(vim.fn.chdir, project_dir) + -- Hapus satu level dari path + local parent_dir = vim.fn.fnamemodify(project_dir, ":h") + local success, err = pcall(vim.fn.chdir, parent_dir) if not success then create_notif("Error changing directory: " .. err, "error") return end create_notif("Changed directory to: " .. project_dir, "info") + -- Fungsi untuk mendapatkan nama direktori terakhir dari path + local function getLastDirName(path) + local uname = vim.loop.os_uname().sysname + local name + if uname == "Windows_NT" then + name = path:match("([^\\]+)$") + else + name = path:match("([^/]+)$") + end + return name + end -- Ambil input dari pengguna untuk Maven local group_id, canceled_group = get_user_input("Enter groupId: ", "com.example") if canceled_group then return end - local artifact_id, canceled_artifact = get_user_input("Enter artifactId: ", "myproject") - if canceled_artifact then - return - end + local artifact_id = getLastDirName(project_dir) local archetype_artifact_id, canceled_archetype = get_user_input("Enter archetypeArtifactId: ", "maven-archetype-quickstart") if canceled_archetype then diff --git a/lua/auto-jdtls2/generate_java_class.lua b/lua/auto-jdtls2/generate_java_class.lua index 0a57941..cd1dd42 100644 --- a/lua/auto-jdtls2/generate_java_class.lua +++ b/lua/auto-jdtls2/generate_java_class.lua @@ -81,19 +81,10 @@ local function create_java_class() -- Tulis konten kelas Java ke dalam file local class_content = string.format( [[ -/* - * This Java source file. - */ package %s; public class %s { - /** - * - */ - public %s() { - - } - // Other methods and fields + } ]], package_name, diff --git a/lua/auto-jdtls2/init.lua b/lua/auto-jdtls2/init.lua index 83cc941..fe49ae1 100644 --- a/lua/auto-jdtls2/init.lua +++ b/lua/auto-jdtls2/init.lua @@ -2,14 +2,14 @@ local M = {} M.setup = function(opt) opt = opt or {} - require("auto-jdtls.utils").install() - require("auto-jdtls.create_gradle_project") - require("auto-jdtls.create_maven_project") - require("auto-jdtls.create_springboot_project") - require("auto-jdtls.generate_java_class") - require("auto-jdtls.generate_java_interface") - require("auto-jdtls.generate_java_main_class") - require("auto-jdtls.utils").attach_jdtls(opt) + require("auto-jdtls2.create_gradle_project") + require("auto-jdtls2.create_maven_project") + require("auto-jdtls2.create_springboot_project") + require("auto-jdtls2.generate_java_class") + require("auto-jdtls2.generate_java_interface") + require("auto-jdtls2.generate_java_main_class") + -- require("auto-jdtls2.utils").install() + -- require("auto-jdtls2.utils").attach_jdtls(opt) end return M diff --git a/lua/pcode/plugins/notify.lua b/lua/pcode/plugins/notify.lua index 1c4ae83..ba74835 100644 --- a/lua/pcode/plugins/notify.lua +++ b/lua/pcode/plugins/notify.lua @@ -17,7 +17,7 @@ return { return math.floor(vim.o.lines * 0.75) end, max_width = function() - return math.floor(vim.o.columns * 0.3) + return math.floor(vim.o.columns * 0.4) end, render = "wrapped-compact", -- background_colour = "#00000000", diff --git a/lua/pcode/user/java.lua b/lua/pcode/user/java.lua new file mode 100644 index 0000000..553a3d1 --- /dev/null +++ b/lua/pcode/user/java.lua @@ -0,0 +1,3 @@ +require("auto-jdtls2.create_gradle_project") +require("auto-jdtls2.create_maven_project") +require("auto-jdtls2.create_springboot_project") From 5dc5c723b293e72a2bb14055d4cdeb1b5ace6bdb Mon Sep 17 00:00:00 2001 From: pojok code Date: Tue, 3 Jun 2025 21:08:25 +0700 Subject: [PATCH 43/59] fix: update config mason-lspconfig --- lazy-lock.json | 120 +++++++++++++-------------- lua/pcode/plugins/theme/evatheme.lua | 1 + 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 34722d7..a180b74 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,77 +1,77 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "Eva-Theme.nvim": { "branch": "master", "commit": "5e0ee05b7b803cbd781612d484b0796c45946a3d" }, + "Eva-Theme.nvim": { "branch": "master", "commit": "c78021386dda1eee1a63a8842e0c188ddfa99e3b" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" }, - "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-java-project.nvim": { "branch": "v2", "commit": "71107191bed6bac984b886af458d3ac405e7a5fb" }, + "auto-java-project.nvim": { "branch": "v2", "commit": "0510829ee6780229efc409305b8da304a18f2754" }, "auto-jdtls.nvim": { "branch": "main", "commit": "050da8d68c51a6e02a08d91329b7a848887927e7" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, - "auto-lsp.nvim": { "branch": "main", "commit": "1f3ef04741972c107187a07be5615ff210888184" }, - "auto-lualine.nvim": { "branch": "main", "commit": "fc8557f61dc1da12a8b90167a49420958b991d8c" }, + "auto-lsp.nvim": { "branch": "main", "commit": "632e72ed4b67aac0bc31a2657407cd238199cf3f" }, + "auto-lualine.nvim": { "branch": "main", "commit": "c889473aef975bf3b17a770dfb2039bb2a0cd41c" }, "breadcrumbs.nvim": { "branch": "master", "commit": "9f764278784ce2f10dbe2f555ba14be2451d36a0" }, - "bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "code_runner.nvim": { "branch": "main", "commit": "dcedccbf969a0f3bc00db446172b4966e83101dd" }, - "codeium.vim": { "branch": "main", "commit": "8c01979323b2b480c8bf160d3ff85bd1668baa49" }, - "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, - "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, - "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, - "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, - "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, - "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, - "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, - "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, - "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, - "mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" }, - "minty": { "branch": "main", "commit": "a3d69bd63fc98f640815f94b797bf978e9193022" }, - "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, + "code_runner.nvim": { "branch": "main", "commit": "386bcaa8aa7ae8703281afce4465ecfdb7c44e65" }, + "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, + "conform.nvim": { "branch": "master", "commit": "f643d1b51d1d3d14c8641a46ce44f6bce73c2697" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f1b1e25373cd589ecf418ced8c2ece28229dd83" }, + "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c2682b0d9732bf52cbc34862056f143e71dc4a6d" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, + "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, + "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, + "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, - "noice.nvim": { "branch": "main", "commit": "2626b4a49340e4eae24a388468ac98680fc24532" }, - "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, - "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, - "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "f134063618a65cad4d7415fddbd96ff7e0c5b4ae" }, - "nvim-dap": { "branch": "master", "commit": "29d1f8814fa4fcc194ec574de998a42a22ebbe4a" }, - "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, - "nvim-jdtls": { "branch": "master", "commit": "c4279b8ffce9b64eb302056d78dfebc2968a49bc" }, - "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, - "nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, + "nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" }, + "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, + "nvim-jdtls": { "branch": "master", "commit": "c23f200fee469a415c77265ca55b496feb646992" }, + "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, + "nvim-lspconfig": { "branch": "master", "commit": "8adb3b5938f6074a1bcc36d3c3916f497d2e8ec4" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, - "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, - "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, - "nvim-scrollview": { "branch": "main", "commit": "f7f611330a8f7cd00dc81538fec369611be678ed" }, - "nvim-tree.lua": { "branch": "master", "commit": "f7c65e11d695a084ca10b93df659bb7e68b71f9f" }, - "nvim-treesitter": { "branch": "master", "commit": "37427012d1c77c544356bfff0c9acc88fd3256bc" }, - "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, - "nvim-web-devicons": { "branch": "master", "commit": "e87554285f581047b1bf236794b0eb812b444b87" }, - "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" }, - "refactoring.nvim": { "branch": "master", "commit": "53ed6854e0bba64d467c58e87084dcf8b1c22d36" }, - "smart-splits.nvim": { "branch": "master", "commit": "ea4702652cb1d18811d60f2e206787602a2e946c" }, + "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, + "nvim-scrollview": { "branch": "main", "commit": "70e88d7248eda2f73e8ea0c6a12aa4748b7a950e" }, + "nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, + "refactoring.nvim": { "branch": "master", "commit": "64dbe67bf7c28c864488262d267c799f80cae9ba" }, + "smart-splits.nvim": { "branch": "master", "commit": "e80bf81015a342b78e3e9ef0395a09ca91f666de" }, "symbols-outline.nvim": { "branch": "master", "commit": "964c5902243446124417a3a9e9454f5ef032cc36" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, - "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, - "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "a39fa4c92268832f6034306793b8acbfec2a7549" }, - "toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" }, - "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, + "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, + "vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, - "volt": { "branch": "main", "commit": "41c03a5d6a0a8a997e774a3482d82e5ef820c6ba" }, - "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }, - "yanky.nvim": { "branch": "main", "commit": "f9b905994cccf3c55f41af3a0a1f4c76c844e411" }, - "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } + "volt": { "branch": "main", "commit": "c45d5f48da8e802e608b5c6da471ca4d84276dfb" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, + "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }, + "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } } diff --git a/lua/pcode/plugins/theme/evatheme.lua b/lua/pcode/plugins/theme/evatheme.lua index dd932b5..ce04a2d 100644 --- a/lua/pcode/plugins/theme/evatheme.lua +++ b/lua/pcode/plugins/theme/evatheme.lua @@ -21,6 +21,7 @@ return { hi(0, "WinBar", { bg = color.background }) hi(0, "WinBarNC", { bg = color.background }) hi(0, "NormalFloat", { bg = color.background }) + hi(0, "TabLine", { bg = color.background }) hi(0, "NormalNC", { bg = color.background }) hi(0, "@tag.delimiter.javascript", { fg = color.punctuation }) hi(0, "@tag.delimiter.tsx", { fg = color.punctuation }) From c2fbd5746921679f31f4bbf0a5d1aefe4464f880 Mon Sep 17 00:00:00 2001 From: pojok code Date: Wed, 4 Jun 2025 06:14:13 +0700 Subject: [PATCH 44/59] enc: update config autocmd --- lua/pcode/user/autocmd.lua | 12 ++++++------ lua/pcode/user/default.lua | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/pcode/user/autocmd.lua b/lua/pcode/user/autocmd.lua index 54ff66b..8ecb083 100644 --- a/lua/pcode/user/autocmd.lua +++ b/lua/pcode/user/autocmd.lua @@ -3,12 +3,12 @@ local api = vim.api -- General Settings api.nvim_create_augroup("_general_settings", { clear = true }) -api.nvim_create_autocmd("TextYankPost", { - group = "_general_settings", - callback = function() - require("vim.highlight").on_yank({ higroup = "Visual", timeout = 200 }) - end, -}) +-- api.nvim_create_autocmd("TextYankPost", { +-- group = "_general_settings", +-- callback = function() +-- require("vim.highlight").on_yank({ higroup = "Visual", timeout = 200 }) +-- end, +-- }) api.nvim_create_autocmd("FileType", { group = "_general_settings", diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index ada123c..de13c93 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -4,8 +4,8 @@ pcode.lang = { cpp = false, sql = false, deno = false, - golang = false, - java = true, + golang = true, + java = false, java2 = false, java3 = false, java4 = false, From 8e0228505a0de2cbbabf450d2df93ee4001afd4f Mon Sep 17 00:00:00 2001 From: pojok code Date: Wed, 4 Jun 2025 06:14:30 +0700 Subject: [PATCH 45/59] enc: update plugins regular --- lazy-lock.json | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index a180b74..f63177e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,14 +2,12 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "c78021386dda1eee1a63a8842e0c188ddfa99e3b" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "LuaSnip": { "branch": "master", "commit": "776a29c3e1ac61029ac3f57ac6b5937df2340162" }, "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, - "auto-java-project.nvim": { "branch": "v2", "commit": "0510829ee6780229efc409305b8da304a18f2754" }, - "auto-jdtls.nvim": { "branch": "main", "commit": "050da8d68c51a6e02a08d91329b7a848887927e7" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, - "auto-lsp.nvim": { "branch": "main", "commit": "632e72ed4b67aac0bc31a2657407cd238199cf3f" }, + "auto-lsp.nvim": { "branch": "main", "commit": "4377da72c12cbb4d9673840ab8247f0f44f40c64" }, "auto-lualine.nvim": { "branch": "main", "commit": "c889473aef975bf3b17a770dfb2039bb2a0cd41c" }, "breadcrumbs.nvim": { "branch": "master", "commit": "9f764278784ce2f10dbe2f555ba14be2451d36a0" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, @@ -24,7 +22,7 @@ "conform.nvim": { "branch": "master", "commit": "f643d1b51d1d3d14c8641a46ce44f6bce73c2697" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "5f1b1e25373cd589ecf418ced8c2ece28229dd83" }, + "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, @@ -36,16 +34,18 @@ "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, - "neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" }, + "neotest-golang": { "branch": "main", "commit": "863a9d8cef20b7392aac77eaa7d116faa8344aab" }, + "neotest-plenary": { "branch": "master", "commit": "3523adcf9ffaad1911960c5813b0136c1b63a2ec" }, + "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, - "nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" }, + "nvim-dap": { "branch": "master", "commit": "e771e86a69a8ba60cffb16609773522eafb9f41a" }, + "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, - "nvim-jdtls": { "branch": "master", "commit": "c23f200fee469a415c77265ca55b496feb646992" }, "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, "nvim-lspconfig": { "branch": "master", "commit": "8adb3b5938f6074a1bcc36d3c3916f497d2e8ec4" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, @@ -62,7 +62,6 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, "refactoring.nvim": { "branch": "master", "commit": "64dbe67bf7c28c864488262d267c799f80cae9ba" }, "smart-splits.nvim": { "branch": "master", "commit": "e80bf81015a342b78e3e9ef0395a09ca91f666de" }, - "symbols-outline.nvim": { "branch": "master", "commit": "964c5902243446124417a3a9e9454f5ef032cc36" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, From 69d6dd962d02fbd1678ff69991f4a220bdddb69e Mon Sep 17 00:00:00 2001 From: pojok code Date: Wed, 4 Jun 2025 09:07:15 +0700 Subject: [PATCH 46/59] enc: change golang linter to golangci-lint --- lazy-lock.json | 6 +- lua/pcode/plugins/lang/golang.lua | 286 +++++++++++++++--------------- 2 files changed, 146 insertions(+), 146 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index f63177e..5ef3ab6 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -7,7 +7,7 @@ "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, "auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" }, - "auto-lsp.nvim": { "branch": "main", "commit": "4377da72c12cbb4d9673840ab8247f0f44f40c64" }, + "auto-lsp.nvim": { "branch": "main", "commit": "ea80aef3ac630d310c2643047aaa7d7747d207a1" }, "auto-lualine.nvim": { "branch": "main", "commit": "c889473aef975bf3b17a770dfb2039bb2a0cd41c" }, "breadcrumbs.nvim": { "branch": "master", "commit": "9f764278784ce2f10dbe2f555ba14be2451d36a0" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, @@ -19,7 +19,7 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "code_runner.nvim": { "branch": "main", "commit": "386bcaa8aa7ae8703281afce4465ecfdb7c44e65" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, - "conform.nvim": { "branch": "master", "commit": "f643d1b51d1d3d14c8641a46ce44f6bce73c2697" }, + "conform.nvim": { "branch": "master", "commit": "b529dd4897c85c3188cc787084089a9d55843093" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, @@ -60,7 +60,7 @@ "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, - "refactoring.nvim": { "branch": "master", "commit": "64dbe67bf7c28c864488262d267c799f80cae9ba" }, + "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" }, "smart-splits.nvim": { "branch": "master", "commit": "e80bf81015a342b78e3e9ef0395a09ca91f666de" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, diff --git a/lua/pcode/plugins/lang/golang.lua b/lua/pcode/plugins/lang/golang.lua index acf3bae..aceb426 100644 --- a/lua/pcode/plugins/lang/golang.lua +++ b/lua/pcode/plugins/lang/golang.lua @@ -1,101 +1,101 @@ return { - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "go", "gomod", "gosum", "gotmpl", "gowork" }) - end, - }, - { - "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "gopls" }) - end, - }, - { - "pojokcodeid/auto-conform.nvim", - event = "VeryLazy", - opts = function(_, opts) - local package = "gofumpt" - vim.list_extend(opts.ensure_installed, { package }) - opts.formatters_by_ft.gofumpt = { package } - end, - }, - { - "pojokcodeid/auto-lint.nvim", - opts = function(_, opts) - opts.linters_by_ft = opts.linters_by_ft or {} - vim.list_extend(opts.ensure_installed, { "ast-grep" }) - opts.linters_by_ft.php = { "ast-grep" } - end, - }, - { - "nvim-neotest/neotest", - event = "VeryLazy", - dependencies = { - "nvim-lua/plenary.nvim", - "antoinemadec/FixCursorHold.nvim", - "nvim-treesitter/nvim-treesitter", + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "go", "gomod", "gosum", "gotmpl", "gowork" }) + end, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "gopls" }) + end, + }, + { + "pojokcodeid/auto-conform.nvim", + event = "VeryLazy", + opts = function(_, opts) + local package = "gofumpt" + vim.list_extend(opts.ensure_installed, { package }) + opts.formatters_by_ft.gofumpt = { package } + end, + }, + { + "pojokcodeid/auto-lint.nvim", + opts = function(_, opts) + opts.linters_by_ft = opts.linters_by_ft or {} + vim.list_extend(opts.ensure_installed, { "golangci-lint" }) + opts.linters_by_ft.php = { "golangci-lint" } + end, + }, + { + "nvim-neotest/neotest", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", - "nvim-neotest/neotest-plenary", - "nvim-neotest/neotest-vim-test", + "nvim-neotest/neotest-plenary", + "nvim-neotest/neotest-vim-test", - "nvim-neotest/nvim-nio", + "nvim-neotest/nvim-nio", - { - "fredrikaverpil/neotest-golang", - dependencies = { - { - "leoluz/nvim-dap-go", - opts = {}, - }, - }, - branch = "main", - }, - }, - opts = function(_, opts) - opts.adapters = opts.adapters or {} - opts.adapters["neotest-golang"] = { - go_test_args = { - "-v", - "-race", - "-count=1", - "-timeout=60s", - "-coverprofile=" .. vim.fn.getcwd() .. "/coverage.out", - }, - dap_go_enabled = true, - } - end, - config = function(_, opts) - if opts.adapters then - local adapters = {} - for name, config in pairs(opts.adapters or {}) do - if type(name) == "number" then - if type(config) == "string" then - config = require(config) - end - adapters[#adapters + 1] = config - elseif config ~= false then - local adapter = require(name) - if type(config) == "table" and not vim.tbl_isempty(config) then - local meta = getmetatable(adapter) - if adapter.setup then - adapter.setup(config) - elseif meta and meta.__call then - adapter(config) - else - error("Adapter " .. name .. " does not support setup") - end - end - adapters[#adapters + 1] = adapter - end - end - opts.adapters = adapters - end + { + "fredrikaverpil/neotest-golang", + dependencies = { + { + "leoluz/nvim-dap-go", + opts = {}, + }, + }, + branch = "main", + }, + }, + opts = function(_, opts) + opts.adapters = opts.adapters or {} + opts.adapters["neotest-golang"] = { + go_test_args = { + "-v", + "-race", + "-count=1", + "-timeout=60s", + "-coverprofile=" .. vim.fn.getcwd() .. "/coverage.out", + }, + dap_go_enabled = true, + } + end, + config = function(_, opts) + if opts.adapters then + local adapters = {} + for name, config in pairs(opts.adapters or {}) do + if type(name) == "number" then + if type(config) == "string" then + config = require(config) + end + adapters[#adapters + 1] = config + elseif config ~= false then + local adapter = require(name) + if type(config) == "table" and not vim.tbl_isempty(config) then + local meta = getmetatable(adapter) + if adapter.setup then + adapter.setup(config) + elseif meta and meta.__call then + adapter(config) + else + error("Adapter " .. name .. " does not support setup") + end + end + adapters[#adapters + 1] = adapter + end + end + opts.adapters = adapters + end - require("neotest").setup(opts) - end, + require("neotest").setup(opts) + end, -- stylua: ignore keys = { { "T","",desc="  Test"}, @@ -111,54 +111,54 @@ return { { "Tt", function() require("neotest").run.stop() end, desc = "[t]est [t]erminate" }, { "Td", function() require("neotest").run.run({ suite = false, strategy = "dap" }) end, desc = "Debug nearest test" }, }, - }, - { - "rcarriga/nvim-dap-ui", - lazy = true, - event = "BufRead", - dependencies = { - { "mfussenegger/nvim-dap", lazy = true }, - { "nvim-neotest/nvim-nio", lazy = true }, - { - "theHamsta/nvim-dap-virtual-text", - opts = { - virt_text_win_col = 80, - }, - }, - }, - config = function() - require("pcode.user.dapui") - end, - keys = { - { "d", "", desc = "  Debug" }, - { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, - { "db", "lua require'dap'.step_back()", desc = "Step Back" }, - { "dc", "lua require'dap'.continue()", desc = "Continue" }, - { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, - { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, - { "dg", "lua require'dap'.session()", desc = "Get Session" }, - { "di", "lua require'dap'.step_into()", desc = "Step Into" }, - { "do", "lua require'dap'.step_over()", desc = "Step Over" }, - { "du", "lua require'dap'.step_out()", desc = "Step Out" }, - { "dp", "lua require'dap'.pause()", desc = "Pause" }, - { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, - { "ds", "lua require'dap'.continue()", desc = "Start" }, - { "dq", "lua require'dap'.close()", desc = "Quit" }, - { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, - }, - }, - { - "jay-babu/mason-nvim-dap.nvim", - lazy = true, - event = "BufRead", - dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" }, - config = function() - require("mason-nvim-dap").setup({ - automatic_installation = true, - automatic_setup = true, - handlers = {}, - ensure_installed = { "delve" }, - }) - end, - }, + }, + { + "rcarriga/nvim-dap-ui", + lazy = true, + event = "BufRead", + dependencies = { + { "mfussenegger/nvim-dap", lazy = true }, + { "nvim-neotest/nvim-nio", lazy = true }, + { + "theHamsta/nvim-dap-virtual-text", + opts = { + virt_text_win_col = 80, + }, + }, + }, + config = function() + require("pcode.user.dapui") + end, + keys = { + { "d", "", desc = "  Debug" }, + { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, + { "db", "lua require'dap'.step_back()", desc = "Step Back" }, + { "dc", "lua require'dap'.continue()", desc = "Continue" }, + { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, + { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, + { "dg", "lua require'dap'.session()", desc = "Get Session" }, + { "di", "lua require'dap'.step_into()", desc = "Step Into" }, + { "do", "lua require'dap'.step_over()", desc = "Step Over" }, + { "du", "lua require'dap'.step_out()", desc = "Step Out" }, + { "dp", "lua require'dap'.pause()", desc = "Pause" }, + { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, + { "ds", "lua require'dap'.continue()", desc = "Start" }, + { "dq", "lua require'dap'.close()", desc = "Quit" }, + { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, + }, + }, + { + "jay-babu/mason-nvim-dap.nvim", + lazy = true, + event = "BufRead", + dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" }, + config = function() + require("mason-nvim-dap").setup({ + automatic_installation = true, + automatic_setup = true, + handlers = {}, + ensure_installed = { "delve" }, + }) + end, + }, } From b727898cf3ba13a46ba9cc7f31fbc4f56f59f058 Mon Sep 17 00:00:00 2001 From: Asep Komarudin <68836805+pojokcodeid@users.noreply.github.com> Date: Sun, 8 Jun 2025 20:03:52 +0700 Subject: [PATCH 47/59] update branch --- lua/pcode/plugins/extras/rainbowdelimiters.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/pcode/plugins/extras/rainbowdelimiters.lua b/lua/pcode/plugins/extras/rainbowdelimiters.lua index ebc7c1a..3cf3380 100644 --- a/lua/pcode/plugins/extras/rainbowdelimiters.lua +++ b/lua/pcode/plugins/extras/rainbowdelimiters.lua @@ -2,6 +2,7 @@ return { "hiphish/rainbow-delimiters.nvim", lazy = true, event = "BufRead", + branch = "master", config = function() -- Modul ini berisi beberapa definisi default local rainbow_delimiters = require("rainbow-delimiters") From af0923e403762eee9fde13eb38a161b419017302 Mon Sep 17 00:00:00 2001 From: pojok code Date: Sun, 8 Jun 2025 20:08:34 +0700 Subject: [PATCH 48/59] enc: update patch plugins --- lazy-lock.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 5ef3ab6..e85acfe 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,8 +1,8 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "Eva-Theme.nvim": { "branch": "master", "commit": "c78021386dda1eee1a63a8842e0c188ddfa99e3b" }, + "Eva-Theme.nvim": { "branch": "master", "commit": "9d743346eb0e7647d79468fff6f57352cd102655" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "776a29c3e1ac61029ac3f57ac6b5937df2340162" }, + "LuaSnip": { "branch": "master", "commit": "5271933f7cea9f6b1c7de953379469010ed4553a" }, "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, @@ -19,22 +19,22 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "code_runner.nvim": { "branch": "main", "commit": "386bcaa8aa7ae8703281afce4465ecfdb7c44e65" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, - "conform.nvim": { "branch": "master", "commit": "b529dd4897c85c3188cc787084089a9d55843093" }, + "conform.nvim": { "branch": "master", "commit": "0e93e0d12d2f7ebdea9e3e444dfaff0050cefbe6" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "c2682b0d9732bf52cbc34862056f143e71dc4a6d" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "bef29b653ba71d442816bf56286c2a686210be04" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, - "neotest-golang": { "branch": "main", "commit": "863a9d8cef20b7392aac77eaa7d116faa8344aab" }, + "neotest-golang": { "branch": "main", "commit": "c452301848418baf244e2da34491157bca7614c1" }, "neotest-plenary": { "branch": "master", "commit": "3523adcf9ffaad1911960c5813b0136c1b63a2ec" }, "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, @@ -42,17 +42,17 @@ "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, - "nvim-dap": { "branch": "master", "commit": "e771e86a69a8ba60cffb16609773522eafb9f41a" }, + "nvim-dap": { "branch": "master", "commit": "ea82027c3447dc1a022be9a9884de276c05cd33a" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, - "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, - "nvim-lspconfig": { "branch": "master", "commit": "8adb3b5938f6074a1bcc36d3c3916f497d2e8ec4" }, + "nvim-lint": { "branch": "master", "commit": "cc26ae6a620298bb3f33b0e0681f99a10ae57781" }, + "nvim-lspconfig": { "branch": "master", "commit": "a182334ba933e58240c2c45e6ae2d9c7ae313e00" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, - "nvim-scrollview": { "branch": "main", "commit": "70e88d7248eda2f73e8ea0c6a12aa4748b7a950e" }, + "nvim-scrollview": { "branch": "main", "commit": "23db9bbd210fed942085070071fdac921837a55f" }, "nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, @@ -61,7 +61,7 @@ "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" }, - "smart-splits.nvim": { "branch": "master", "commit": "e80bf81015a342b78e3e9ef0395a09ca91f666de" }, + "smart-splits.nvim": { "branch": "master", "commit": "9af865e451e55a9835fae6862dd7c55396870ecb" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, From 5b2d06cf97bea37e77db529ad499c75c7b648333 Mon Sep 17 00:00:00 2001 From: pojok code Date: Tue, 10 Jun 2025 07:44:40 +0700 Subject: [PATCH 49/59] enc: add transparant config for tab --- lazy-lock.json | 7 ++++--- lua/pcode/plugins/extras/transparent.lua | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index e85acfe..106593e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -17,9 +17,9 @@ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "code_runner.nvim": { "branch": "main", "commit": "386bcaa8aa7ae8703281afce4465ecfdb7c44e65" }, + "code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, - "conform.nvim": { "branch": "master", "commit": "0e93e0d12d2f7ebdea9e3e444dfaff0050cefbe6" }, + "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, @@ -38,7 +38,7 @@ "neotest-plenary": { "branch": "master", "commit": "3523adcf9ffaad1911960c5813b0136c1b63a2ec" }, "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, @@ -66,6 +66,7 @@ "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, + "transparent.nvim": { "branch": "main", "commit": "d41ae9b56ac2706cb3db4b16afe5cd6903013937" }, "vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, diff --git a/lua/pcode/plugins/extras/transparent.lua b/lua/pcode/plugins/extras/transparent.lua index b0970e0..ff59aef 100644 --- a/lua/pcode/plugins/extras/transparent.lua +++ b/lua/pcode/plugins/extras/transparent.lua @@ -21,6 +21,7 @@ return { "WinBar", "WinBarNC", "NotifyBackground", + "TabLine", }, exclude_groups = { -- disable active selection backgroun From 65b1300677b18417bc37a4ffce936d6fa09cccac Mon Sep 17 00:00:00 2001 From: pojok code Date: Tue, 10 Jun 2025 21:09:13 +0700 Subject: [PATCH 50/59] enc: update transparant config for tabbufferline bg color --- lazy-lock.json | 4 +- lua/pcode/plugins/extras/fidget.lua | 14 +++ lua/pcode/plugins/extras/transparent.lua | 1 + lua/pcode/plugins/theme/dracula.lua | 120 +++++++++++------------ lua/pcode/plugins/theme/jetbrains.lua | 78 +++++++-------- lua/pcode/user/default.lua | 7 +- 6 files changed, 120 insertions(+), 104 deletions(-) create mode 100644 lua/pcode/plugins/extras/fidget.lua diff --git a/lazy-lock.json b/lazy-lock.json index 106593e..0eae901 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,5 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "Eva-Theme.nvim": { "branch": "master", "commit": "9d743346eb0e7647d79468fff6f57352cd102655" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "5271933f7cea9f6b1c7de953379469010ed4553a" }, "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, @@ -20,6 +19,7 @@ "code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, + "dracula.nvim": { "branch": "main", "commit": "96c9d19ce81b26053055ad6f688277d655b3f7d2" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, @@ -52,7 +52,7 @@ "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, - "nvim-scrollview": { "branch": "main", "commit": "23db9bbd210fed942085070071fdac921837a55f" }, + "nvim-scrollview": { "branch": "main", "commit": "b65192ef2e39c456e8dc5f8f5cdd9b8d13f121e4" }, "nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, diff --git a/lua/pcode/plugins/extras/fidget.lua b/lua/pcode/plugins/extras/fidget.lua new file mode 100644 index 0000000..6d9c12c --- /dev/null +++ b/lua/pcode/plugins/extras/fidget.lua @@ -0,0 +1,14 @@ +return { + "j-hui/fidget.nvim", + lazy = true, + tag = "legacy", + event = "BufRead", + config = function() + require("fidget").setup({ + window = { + blend = 0, + relative = "editor", + }, + }) + end, +} diff --git a/lua/pcode/plugins/extras/transparent.lua b/lua/pcode/plugins/extras/transparent.lua index ff59aef..2241527 100644 --- a/lua/pcode/plugins/extras/transparent.lua +++ b/lua/pcode/plugins/extras/transparent.lua @@ -22,6 +22,7 @@ return { "WinBarNC", "NotifyBackground", "TabLine", + "TabLineFill", }, exclude_groups = { -- disable active selection backgroun diff --git a/lua/pcode/plugins/theme/dracula.lua b/lua/pcode/plugins/theme/dracula.lua index a789f3d..21d5a22 100644 --- a/lua/pcode/plugins/theme/dracula.lua +++ b/lua/pcode/plugins/theme/dracula.lua @@ -1,62 +1,62 @@ return { - "Mofiqul/dracula.nvim", - priority = 1000, - opts=function() - local colors = require("dracula").colors() - return{ - colors = { - -- purple = "#FCC76A", - menu = colors.bg, - selection = "#363848", - }, - italic_comment = true, - lualine_bg_color = colors.bg, - overrides = { - Keywords = { fg = colors.cyan, italic = true }, - ["@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 }, - ["@property.css"] = { fg = colors.cyan }, - ["@type.css"] = { fg = colors.green }, - ["@tag.css"] = { fg = colors.pink }, - ["@keyword.css"] = { fg = colors.fg }, - ["@string.css"] = { fg = colors.pink }, - NvimTreeFolderIcon = { fg = "#6776a7" }, - CmpItemAbbr = { fg = "#ABB2BF" }, - CmpItemKind = { fg = "#ABB2BF" }, - CmpItemAbbrDeprecated = { fg = "#ABB2BF" }, - CmpItemAbbrMatch = { fg = "#8BE9FD" }, - htmlLink = { fg = "#BD93F9", underline = false }, - Underlined = { fg = "#8BE9FD" }, - NvimTreeSpecialFile = { fg = "#FF79C6" }, - SpellBad = { fg = "#FF6E6E" }, - illuminatedWord = { bg = "#3b4261" }, - illuminatedCurWord = { bg = "#3b4261" }, - IlluminatedWordText = { bg = "#3b4261" }, - IlluminatedWordRead = { bg = "#3b4261" }, - IlluminatedWordWrite = { bg = "#3b4261" }, - DiffChange = { fg = colors.fg }, - StatusLine = { fg = colors.fg, bg = colors.bg }, - StatusLineTerm = { fg = colors.fg, bg = colors.bg }, - BufferLineFill = { bg = colors.bg }, - Pmenu = { fg = colors.fg, bg = colors.bg }, - LspInfoBorder = { fg = colors.fg }, - LspReferenceText = { bg = "#3b4261" }, - LspReferenceRead = { bg = "#3b4261" }, - LspReferenceWrite = { bg = "#3b4261" }, - WinBar = { bg = colors.bg }, - WinBarNC = { fg = colors.fg, bg = colors.bg }, - }, - transparent_bg = false, - } - end, - config = function(_,opts) - require("dracula").setup(opts) - local colorscheme = pcode.themes.dracula or "dracula" - vim.cmd("colorscheme " .. colorscheme) - end, + "Mofiqul/dracula.nvim", + priority = 1000, + opts = function() + local colors = require("dracula").colors() + return { + colors = { + -- purple = "#FCC76A", + menu = colors.bg, + selection = "#363848", + }, + italic_comment = true, + lualine_bg_color = colors.bg, + overrides = { + Keywords = { fg = colors.cyan, italic = true }, + ["@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 }, + ["@property.css"] = { fg = colors.cyan }, + ["@type.css"] = { fg = colors.green }, + ["@tag.css"] = { fg = colors.pink }, + ["@keyword.css"] = { fg = colors.fg }, + ["@string.css"] = { fg = colors.pink }, + NvimTreeFolderIcon = { fg = "#6776a7" }, + CmpItemAbbr = { fg = "#ABB2BF" }, + CmpItemKind = { fg = "#ABB2BF" }, + CmpItemAbbrDeprecated = { fg = "#ABB2BF" }, + CmpItemAbbrMatch = { fg = "#8BE9FD" }, + htmlLink = { fg = "#BD93F9", underline = false }, + Underlined = { fg = "#8BE9FD" }, + NvimTreeSpecialFile = { fg = "#FF79C6" }, + SpellBad = { fg = "#FF6E6E" }, + illuminatedWord = { bg = "#3b4261" }, + illuminatedCurWord = { bg = "#3b4261" }, + IlluminatedWordText = { bg = "#3b4261" }, + IlluminatedWordRead = { bg = "#3b4261" }, + IlluminatedWordWrite = { bg = "#3b4261" }, + DiffChange = { fg = colors.fg }, + StatusLine = { fg = colors.fg, bg = colors.bg }, + StatusLineTerm = { fg = colors.fg, bg = colors.bg }, + BufferLineFill = { bg = colors.bg }, + Pmenu = { fg = colors.fg, bg = colors.bg }, + LspInfoBorder = { fg = colors.fg }, + LspReferenceText = { bg = "#3b4261" }, + LspReferenceRead = { bg = "#3b4261" }, + LspReferenceWrite = { bg = "#3b4261" }, + WinBar = { bg = colors.bg }, + WinBarNC = { fg = colors.fg, bg = colors.bg }, + }, + transparent_bg = false, + } + end, + config = function(_, opts) + require("dracula").setup(opts) + local colorscheme = pcode.themes.dracula or "dracula" + vim.cmd("colorscheme " .. colorscheme) + end, } diff --git a/lua/pcode/plugins/theme/jetbrains.lua b/lua/pcode/plugins/theme/jetbrains.lua index 8b2e558..e877813 100644 --- a/lua/pcode/plugins/theme/jetbrains.lua +++ b/lua/pcode/plugins/theme/jetbrains.lua @@ -1,41 +1,41 @@ return { - "pojokcodeid/darcula-dark.nvim", - priority = 1000, - lazy = false, - config = function() - require("darcula").setup({ - colors = { - lavender = "#9876AA", - statusline = "NONE", - }, - }) - vim.api.nvim_create_autocmd("ColorScheme", { - pattern = "*", - callback = function() - local colors = require("darcula").colors() - local hi = vim.api.nvim_set_hl - hi(0, "@property.json", { fg = colors.lavender }) - hi(0, "@property.jsonc", { fg = colors.lavender }) - hi(0, "LineNr", { ctermfg = 11, fg = colors._39 }) - -- hi(0, "@variable.member.sql", { fg = colors.olive_green }) - -- telescope - hi(0, "TelescopePromptBorder", { fg = colors.medium_gray }) - hi(0, "TelescopeResultsBorder", { fg = colors.medium_gray }) - hi(0, "TelescopePreviewBorder", { fg = colors.medium_gray }) - hi(0, "TelescopeSelection", { bg = colors.dark_charcoal_gray }) - hi(0, "TelescopeMultiSelection", { bg = colors.dark_charcoal_gray }) - hi(0, "TelescopeNormal", { bg = colors.dark }) - hi(0, "TelescopeMatching", { fg = colors.olive_green }) - hi(0, "TelescopePromptPrefix", { fg = colors.red }) - hi(0, "TelescopeResultsDiffDelete", { fg = colors.red }) - hi(0, "TelescopeResultsDiffChange", { fg = colors.bright_cyan }) - hi(0, "TelescopeResultsDiffAdd", { fg = colors.olive_green }) - hi(0, "TelescopePromptNormal", { bg = colors.dark, fg = colors.grey }) - hi(0, "TelescopePromptPrefix", { bg = colors.dark, fg = colors.red }) - hi(0, "TelescopeResultsTitle", { bg = colors.olive_green, fg = colors.very_dark_gray }) - end, - }) - local colorscheme = pcode.themes.jetbrains or "darcula-dark" - vim.cmd("colorscheme " .. colorscheme) - end, + "pojokcodeid/darcula-dark.nvim", + priority = 1000, + lazy = false, + config = function() + require("darcula").setup({ + colors = { + lavender = "#9876AA", + statusline = "NONE", + }, + }) + vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = function() + local colors = require("darcula").colors() + local hi = vim.api.nvim_set_hl + hi(0, "@property.json", { fg = colors.lavender }) + hi(0, "@property.jsonc", { fg = colors.lavender }) + hi(0, "LineNr", { ctermfg = 11, fg = colors._39 }) + -- hi(0, "@variable.member.sql", { fg = colors.olive_green }) + -- telescope + hi(0, "TelescopePromptBorder", { fg = colors.medium_gray }) + hi(0, "TelescopeResultsBorder", { fg = colors.medium_gray }) + hi(0, "TelescopePreviewBorder", { fg = colors.medium_gray }) + hi(0, "TelescopeSelection", { bg = colors.dark_charcoal_gray }) + hi(0, "TelescopeMultiSelection", { bg = colors.dark_charcoal_gray }) + hi(0, "TelescopeNormal", { bg = colors.dark }) + hi(0, "TelescopeMatching", { fg = colors.olive_green }) + hi(0, "TelescopePromptPrefix", { fg = colors.red }) + hi(0, "TelescopeResultsDiffDelete", { fg = colors.red }) + hi(0, "TelescopeResultsDiffChange", { fg = colors.bright_cyan }) + hi(0, "TelescopeResultsDiffAdd", { fg = colors.olive_green }) + hi(0, "TelescopePromptNormal", { bg = colors.dark, fg = colors.grey }) + hi(0, "TelescopePromptPrefix", { bg = colors.dark, fg = colors.red }) + hi(0, "TelescopeResultsTitle", { bg = colors.olive_green, fg = colors.very_dark_gray }) + end, + }) + local colorscheme = pcode.themes.jetbrains or "darcula-dark" + vim.cmd("colorscheme " .. colorscheme) + end, } diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index de13c93..49ca510 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -47,18 +47,19 @@ pcode.extras = { zenmode = true, lspsignatur = false, telescopetreesiterinfo = true, + fidget = false, } -- activate config themes pcode.themes = { -- note: open remark only one -- **:: Eva Theme ::** -- - evatheme = "Eva-Dark", + -- evatheme = "Eva-Dark", -- evatheme = "Eva-Dark-Italic", -- evatheme = "Eva-Dark-Bold", -- evatheme = "Eva-Light", -- -- **:: Dracula Theme ::** -- - -- dracula = "dracula", + dracula = "dracula", -- dracula = "dracula-soft", -- -- **:: Onedarkpro Theme ::** -- @@ -92,6 +93,6 @@ pcode.themes = { -- github = "github_dark_dimmed", } -- activate config transparent_bg -pcode.transparent = false +pcode.transparent = true pcode.localcode = true pcode.snippets_path = vim.fn.stdpath("config") .. "/mysnippets" From 56982c3434a96fe79f4413ed55ce250467888811 Mon Sep 17 00:00:00 2001 From: pojok code Date: Tue, 10 Jun 2025 21:41:41 +0700 Subject: [PATCH 51/59] enc: add uninstall prosedure --- README.md | 26 ++++++++++++++++---------- lazy-lock.json | 6 +++--- lua/pcode/user/default.lua | 4 ++-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 56c3c43..5b9bbb4 100644 --- a/README.md +++ b/README.md @@ -67,14 +67,14 @@ ## Basic Requirement 2. Install Neovim 0.95+ https://github.com/neovim/neovim/releases/tag/stable -3. C++ https://www.msys2.org/ -4. GIT https://git-scm.com/download/win -5. NodeJs https://nodejs.org/en/ -6. Ripgrep https://github.com/BurntSushi/ripgrep -7. Lazygit https://github.com/jesseduffield/lazygit -8. Nerd Font https://www.nerdfonts.com/ or https://github.com/ryanoasis/nerd-fonts -9. Windows Terminal (Windows) https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-id&gl=id -10. Powershell (windows) https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-id&gl=id +1. C++ https://www.msys2.org/ +1. GIT https://git-scm.com/download/win +1. NodeJs https://nodejs.org/en/ +1. Ripgrep https://github.com/BurntSushi/ripgrep +1. Lazygit https://github.com/jesseduffield/lazygit +1. Nerd Font https://www.nerdfonts.com/ or https://github.com/ryanoasis/nerd-fonts +1. Windows Terminal (Windows) https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-id&gl=id +1. Powershell (windows) https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-id&gl=id # Windows @@ -92,15 +92,21 @@ git clone https://github.com/pojokcodeid/neovim-starter.git ~/.config/nvim # Uninstall ```bash -# Linux / Macos (unix) +# Linux / MacOS (unix) rm -rf ~/.config/nvim +rm -rf ~/.local/state/nvim rm -rf ~/.local/share/nvim +# Flatpak (linux) +rm -rf ~/.var/app/io.neovim.nvim/config/nvim +rm -rf ~/.var/app/io.neovim.nvim/data/nvim +rm -rf ~/.var/app/io.neovim.nvim/.local/state/nvim + # Windows CMD rd -r ~\AppData\Local\nvim rd -r ~\AppData\Local\nvim-data -# Window PowerShell +# Windows PowerShell rm -Force ~\AppData\Local\nvim rm -Force ~\AppData\Local\nvim-data ``` diff --git a/lazy-lock.json b/lazy-lock.json index 0eae901..eccf21c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,8 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "Eva-Theme.nvim": { "branch": "master", "commit": "9d743346eb0e7647d79468fff6f57352cd102655" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "5271933f7cea9f6b1c7de953379469010ed4553a" }, + "LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" }, "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, @@ -19,7 +20,6 @@ "code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, - "dracula.nvim": { "branch": "main", "commit": "96c9d19ce81b26053055ad6f688277d655b3f7d2" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, @@ -47,7 +47,7 @@ "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-lint": { "branch": "master", "commit": "cc26ae6a620298bb3f33b0e0681f99a10ae57781" }, - "nvim-lspconfig": { "branch": "master", "commit": "a182334ba933e58240c2c45e6ae2d9c7ae313e00" }, + "nvim-lspconfig": { "branch": "master", "commit": "77d3fdfb3554632c7a3b101ded643d422de7626f" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 49ca510..6213a17 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -53,13 +53,13 @@ pcode.extras = { pcode.themes = { -- note: open remark only one -- **:: Eva Theme ::** -- - -- evatheme = "Eva-Dark", + evatheme = "Eva-Dark", -- evatheme = "Eva-Dark-Italic", -- evatheme = "Eva-Dark-Bold", -- evatheme = "Eva-Light", -- -- **:: Dracula Theme ::** -- - dracula = "dracula", + -- dracula = "dracula", -- dracula = "dracula-soft", -- -- **:: Onedarkpro Theme ::** -- From 04f3bfc8a31e78be91353953386f523740556cac Mon Sep 17 00:00:00 2001 From: pojok code Date: Tue, 10 Jun 2025 22:57:15 +0700 Subject: [PATCH 52/59] enc: update config transparant --- lazy-lock.json | 2 +- lua/pcode/plugins/cmp.lua | 2 ++ lua/pcode/plugins/extras/transparent.lua | 4 ++++ lua/pcode/user/options.lua | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index eccf21c..20e1ed8 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,7 +2,7 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Eva-Theme.nvim": { "branch": "master", "commit": "9d743346eb0e7647d79468fff6f57352cd102655" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" }, + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, diff --git a/lua/pcode/plugins/cmp.lua b/lua/pcode/plugins/cmp.lua index bb23ff7..2046a29 100644 --- a/lua/pcode/plugins/cmp.lua +++ b/lua/pcode/plugins/cmp.lua @@ -2,6 +2,8 @@ return { { "L3MON4D3/LuaSnip", event = "InsertEnter", + version = "v2.*", + build = "make install_jsregexp", opts = { history = true, delete_check_events = "TextChanged", diff --git a/lua/pcode/plugins/extras/transparent.lua b/lua/pcode/plugins/extras/transparent.lua index 2241527..137aa4c 100644 --- a/lua/pcode/plugins/extras/transparent.lua +++ b/lua/pcode/plugins/extras/transparent.lua @@ -55,6 +55,10 @@ return { -- create auto command to set transparent vim.cmd("TransparentDisable") vim.cmd("TransparentEnable") + vim.api.nvim_set_hl(0, "MasonHeader", { bold = true, bg = "NONE", fg = "#838FA7" }) + vim.api.nvim_set_hl(0, "MasonMutedBlock", { bg = "NONE", fg = "#838FA7" }) + vim.api.nvim_set_hl(0, "MasonHighlightBlockBold", { bold = true, bg = "NONE", fg = "#ABB2BF" }) + vim.api.nvim_set_hl(0, "LazyH1", { bold = true, bg = "NONE", fg = "#ABB2BF" }) end, }, { diff --git a/lua/pcode/user/options.lua b/lua/pcode/user/options.lua index 7f8888c..19d30d8 100644 --- a/lua/pcode/user/options.lua +++ b/lua/pcode/user/options.lua @@ -61,7 +61,7 @@ vim.loader.enable() -- Disable statusline in dashboard vim.api.nvim_create_autocmd("FileType", { - pattern = { "dbout", "dbui", "http", "httpResult" }, + pattern = { "dbout", "dbui", "http", "httpResult", "checkhealth", "qf", "help", "lazy" }, callback = function() local opt = vim.opt opt.number = false -- Print line number From f3761c699af5fc1d1dedabdfcdcf540f19bde40e Mon Sep 17 00:00:00 2001 From: pojok code Date: Wed, 11 Jun 2025 21:13:56 +0700 Subject: [PATCH 53/59] enc: update config mason backdrop --- lazy-lock.json | 9 +- lua/pcode/plugins/dressing.lua | 34 --- lua/pcode/plugins/extras/dressing.lua | 34 +++ lua/pcode/plugins/extras/nvimmenu.lua | 13 +- lua/pcode/plugins/extras/tinydignostic.lua | 11 + lua/pcode/plugins/nvimtree.lua | 235 +++++++++++--------- lua/pcode/plugins/theme/catppuccin.lua | 1 + lua/pcode/plugins/theme/dracula.lua | 1 + lua/pcode/plugins/theme/evatheme.lua | 1 + lua/pcode/plugins/theme/github.lua | 1 + lua/pcode/plugins/theme/gruvbox.lua | 1 + lua/pcode/plugins/theme/jetbrains.lua | 1 + lua/pcode/plugins/theme/onedarkpro.lua | 245 +++++++++++---------- lua/pcode/plugins/theme/sublimetext.lua | 1 + lua/pcode/plugins/theme/tokyonight.lua | 1 + lua/pcode/user/default.lua | 4 +- 16 files changed, 316 insertions(+), 277 deletions(-) delete mode 100644 lua/pcode/plugins/dressing.lua create mode 100644 lua/pcode/plugins/extras/dressing.lua create mode 100644 lua/pcode/plugins/extras/tinydignostic.lua diff --git a/lazy-lock.json b/lazy-lock.json index 20e1ed8..9aae565 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -20,9 +20,8 @@ "code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, - "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, + "gitsigns.nvim": { "branch": "main", "commit": "731b581428ec6c1ccb451b95190ebbc6d7006db7" }, "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, @@ -34,7 +33,7 @@ "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, - "neotest-golang": { "branch": "main", "commit": "c452301848418baf244e2da34491157bca7614c1" }, + "neotest-golang": { "branch": "main", "commit": "0a0acff3cf9a0bf140c84ea9e66d818df7c2608f" }, "neotest-plenary": { "branch": "master", "commit": "3523adcf9ffaad1911960c5813b0136c1b63a2ec" }, "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, @@ -61,16 +60,16 @@ "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" }, + "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, "smart-splits.nvim": { "branch": "master", "commit": "9af865e451e55a9835fae6862dd7c55396870ecb" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, - "transparent.nvim": { "branch": "main", "commit": "d41ae9b56ac2706cb3db4b16afe5cd6903013937" }, "vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, - "volt": { "branch": "main", "commit": "c45d5f48da8e802e608b5c6da471ca4d84276dfb" }, + "volt": { "branch": "main", "commit": "2aa99a4e388c840597441a901209cbdafe8472ed" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } diff --git a/lua/pcode/plugins/dressing.lua b/lua/pcode/plugins/dressing.lua deleted file mode 100644 index ad00f44..0000000 --- a/lua/pcode/plugins/dressing.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - "stevearc/dressing.nvim", - lazy = true, - init = function() - ---@diagnostic disable-next-line: duplicate-set-field - vim.ui.select = function(...) - require("lazy").load({ plugins = { "dressing.nvim" } }) - return vim.ui.select(...) - end - ---@diagnostic disable-next-line: duplicate-set-field - vim.ui.input = function(...) - require("lazy").load({ plugins = { "dressing.nvim" } }) - return vim.ui.input(...) - end - end, - opts = { - input = { - title_pos = "center", - relative = "editor", - default_prompt = "➤ ", - win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" }, - prefer_width = 30, - max_width = { 140, 0.9 }, - min_width = { 50, 0.2 }, - }, - select = { - backend = { "telescope", "builtin" }, - builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } }, - }, - }, - config = function(_, opts) - require("dressing").setup(opts) - end, -} diff --git a/lua/pcode/plugins/extras/dressing.lua b/lua/pcode/plugins/extras/dressing.lua new file mode 100644 index 0000000..c881169 --- /dev/null +++ b/lua/pcode/plugins/extras/dressing.lua @@ -0,0 +1,34 @@ +return { + "stevearc/dressing.nvim", + lazy = true, + init = function() + ---@diagnostic disable-next-line: duplicate-set-field + vim.ui.select = function(...) + require("lazy").load({ plugins = { "dressing.nvim" } }) + return vim.ui.select(...) + end + ---@diagnostic disable-next-line: duplicate-set-field + vim.ui.input = function(...) + require("lazy").load({ plugins = { "dressing.nvim" } }) + return vim.ui.input(...) + end + end, + opts = { + input = { + title_pos = "center", + relative = "editor", + default_prompt = "➤ ", + win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" }, + prefer_width = 30, + max_width = { 140, 0.9 }, + min_width = { 50, 0.2 }, + }, + select = { + backend = { "telescope", "builtin" }, + builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } }, + }, + }, + config = function(_, opts) + require("dressing").setup(opts) + end, +} diff --git a/lua/pcode/plugins/extras/nvimmenu.lua b/lua/pcode/plugins/extras/nvimmenu.lua index a9dbf00..e2d1506 100644 --- a/lua/pcode/plugins/extras/nvimmenu.lua +++ b/lua/pcode/plugins/extras/nvimmenu.lua @@ -1,12 +1,13 @@ return { { - "nvchad/menu", + "nvzone/menu", lazy = true, event = { "VeryLazy" }, dependencies = { - { "nvchad/volt", lazy = true }, + { "nvzone/volt", lazy = true }, + { "nvzone/showkeys", cmd = "ShowkeysToggle", lazy = true }, { - "nvchad/minty", + "nvzone/minty", cmd = { "Shades", "Huefy" }, lazy = true, }, @@ -22,10 +23,12 @@ return { end, {}) -- mouse users + nvimtree users! - vim.keymap.set("n", "", function() + vim.keymap.set({ "n", "v" }, "", function() + require("menu.utils").delete_old_menus() vim.cmd.exec('"normal! \\"') - local options = vim.bo.ft == "NvimTree" and "nvimtree" or "default" + local buf = vim.api.nvim_win_get_buf(vim.fn.getmousepos().winid) + local options = vim.bo[buf].ft == "NvimTree" and "nvimtree" or "default" require("menu").open(options, opts) end, {}) end, diff --git a/lua/pcode/plugins/extras/tinydignostic.lua b/lua/pcode/plugins/extras/tinydignostic.lua new file mode 100644 index 0000000..60d864d --- /dev/null +++ b/lua/pcode/plugins/extras/tinydignostic.lua @@ -0,0 +1,11 @@ +return { + "rachartier/tiny-inline-diagnostic.nvim", + event = "VeryLazy", -- Or `LspAttach` + priority = 1000, -- needs to be loaded in first + config = function() + require("tiny-inline-diagnostic").setup({ + preset = "powerline", + }) + vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics + end, +} diff --git a/lua/pcode/plugins/nvimtree.lua b/lua/pcode/plugins/nvimtree.lua index 47a4bc4..e845450 100644 --- a/lua/pcode/plugins/nvimtree.lua +++ b/lua/pcode/plugins/nvimtree.lua @@ -1,45 +1,60 @@ return { - "nvim-tree/nvim-tree.lua", - cmd = { "NvimTreeFindFileToggle", "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" }, - keys = { - { "e", "NvimTreeToggle", desc = "󰙅 Explorer" }, - }, - opts = function(_, opts) - local icons = require("pcode.user.icons") - opts.disable_netrw = true - opts.hijack_cursor = true - opts.sync_root_with_cwd = true - opts.update_focused_file = { - enable = true, - update_root = false, - } - opts.view = { - adaptive_size = false, - centralize_selection = true, - width = 30, - side = "left", - preserve_window_proportions = false, - number = false, - relativenumber = false, - signcolumn = "yes", - float = { - enable = false, - quit_on_focus_loss = true, - open_win_config = { - relative = "editor", - border = "rounded", - width = 30, - height = 30, - row = 1, - col = 1, - }, - }, - } - opts.renderer = { - root_folder_label = false, - highlight_git = true, - indent_markers = { enable = true }, - --[[ indent_markers = { + "nvim-tree/nvim-tree.lua", + cmd = { "NvimTreeFindFileToggle", "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" }, + keys = { + { "e", "NvimTreeToggle", desc = "󰙅 Explorer" }, + }, + opts = function(_, opts) + local icons = require("pcode.user.icons") + opts.auto_reload_on_write = false + opts.disable_netrw = false + opts.hijack_cursor = false + opts.hijack_netrw = true + opts.hijack_unnamed_buffer_when_opening = false + opts.sync_root_with_cwd = true + opts.sort = { + sorter = "name", + folders_first = true, + files_first = false, + } + opts.root_dirs = {} + opts.prefer_startup_root = false + opts.sync_root_with_cwd = true + opts.reload_on_bufenter = false + opts.respect_buf_cwd = false + opts.on_attach = "default" + opts.select_prompts = false + opts.update_focused_file = { + enable = true, + update_root = false, + } + opts.view = { + adaptive_size = false, + centralize_selection = true, + width = 30, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + float = { + enable = false, + quit_on_focus_loss = true, + open_win_config = { + relative = "editor", + border = "rounded", + width = 30, + height = 30, + row = 1, + col = 1, + }, + }, + } + opts.renderer = { + root_folder_label = false, + highlight_git = true, + indent_markers = { enable = true }, + --[[ indent_markers = { enable = true, inline_arrows = true, icons = { @@ -49,73 +64,73 @@ return { none = " ", }, }, ]] - icons = { - webdev_colors = true, - git_placement = "before", - padding = " ", - symlink_arrow = " ➛ ", - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - }, - glyphs = { - default = icons.ui.Text, - symlink = icons.ui.FileSymlink, - bookmark = icons.ui.BookMark, - folder = { - arrow_closed = icons.ui.ChevronShortRight, - arrow_open = icons.ui.ChevronShortDown, - default = icons.ui.Folder, - open = icons.ui.FolderOpen, - empty = icons.ui.EmptyFolder, - empty_open = icons.ui.EmptyFolderOpen, - symlink = icons.ui.FolderSymlink, - symlink_open = icons.ui.FolderOpen, - }, - git = { - unstaged = icons.git.FileUnstaged, - staged = icons.git.FileStaged, - unmerged = icons.git.FileUnmerged, - renamed = icons.git.FileRenamed, - untracked = icons.git.FileUntracked, - deleted = icons.git.FileDeleted, - ignored = icons.git.FileIgnored, - }, - }, - }, - special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" }, - symlink_destination = true, - } - opts.filters = { - dotfiles = false, - git_clean = false, - no_buffer = false, - custom = { "node_modules", "\\.cache", "\\.git" }, - exclude = { - ".gitignore", - ".prettierignore", - }, - } - opts.notify = { - threshold = vim.log.levels.INFO, - } - opts.git = { - enable = true, - ignore = false, - show_on_dirs = true, - show_on_open_dirs = true, - disable_for_dirs = {}, - timeout = 400, - } - return opts - end, - config = function(_, opts) - require("nvim-tree").setup(opts) - local api = require("nvim-tree.api") - api.events.subscribe(api.events.Event.FileCreated, function(file) - vim.cmd("edit " .. file.fname) - end) - end, + icons = { + webdev_colors = true, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = icons.ui.Text, + symlink = icons.ui.FileSymlink, + bookmark = icons.ui.BookMark, + folder = { + arrow_closed = icons.ui.ChevronShortRight, + arrow_open = icons.ui.ChevronShortDown, + default = icons.ui.Folder, + open = icons.ui.FolderOpen, + empty = icons.ui.EmptyFolder, + empty_open = icons.ui.EmptyFolderOpen, + symlink = icons.ui.FolderSymlink, + symlink_open = icons.ui.FolderOpen, + }, + git = { + unstaged = icons.git.FileUnstaged, + staged = icons.git.FileStaged, + unmerged = icons.git.FileUnmerged, + renamed = icons.git.FileRenamed, + untracked = icons.git.FileUntracked, + deleted = icons.git.FileDeleted, + ignored = icons.git.FileIgnored, + }, + }, + }, + special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" }, + symlink_destination = true, + } + opts.filters = { + dotfiles = false, + git_clean = false, + no_buffer = false, + custom = { "node_modules", "\\.cache", "\\.git" }, + exclude = { + ".gitignore", + ".prettierignore", + }, + } + opts.notify = { + threshold = vim.log.levels.INFO, + } + opts.git = { + enable = true, + ignore = false, + show_on_dirs = true, + show_on_open_dirs = true, + disable_for_dirs = {}, + timeout = 400, + } + return opts + end, + config = function(_, opts) + require("nvim-tree").setup(opts) + local api = require("nvim-tree.api") + api.events.subscribe(api.events.Event.FileCreated, function(file) + vim.cmd("edit " .. file.fname) + end) + end, } diff --git a/lua/pcode/plugins/theme/catppuccin.lua b/lua/pcode/plugins/theme/catppuccin.lua index e9afeee..b4e5c68 100644 --- a/lua/pcode/plugins/theme/catppuccin.lua +++ b/lua/pcode/plugins/theme/catppuccin.lua @@ -49,6 +49,7 @@ return { Normal = { fg = colors.text, bg = transparent and colors.none or colors.base }, NormalNC = { fg = colors.text, bg = transparent and colors.none or colors.base }, StatusLine = { fg = colors.text, bg = colors.none }, + MasonBackdrop = { link = "NormalFloat" }, } end, highlight_overrides = { diff --git a/lua/pcode/plugins/theme/dracula.lua b/lua/pcode/plugins/theme/dracula.lua index 21d5a22..095ac32 100644 --- a/lua/pcode/plugins/theme/dracula.lua +++ b/lua/pcode/plugins/theme/dracula.lua @@ -50,6 +50,7 @@ return { LspReferenceWrite = { bg = "#3b4261" }, WinBar = { bg = colors.bg }, WinBarNC = { fg = colors.fg, bg = colors.bg }, + MasonBackdrop = { link = "NormalFloat" }, }, transparent_bg = false, } diff --git a/lua/pcode/plugins/theme/evatheme.lua b/lua/pcode/plugins/theme/evatheme.lua index ce04a2d..4c441b6 100644 --- a/lua/pcode/plugins/theme/evatheme.lua +++ b/lua/pcode/plugins/theme/evatheme.lua @@ -23,6 +23,7 @@ return { hi(0, "NormalFloat", { bg = color.background }) hi(0, "TabLine", { bg = color.background }) hi(0, "NormalNC", { bg = color.background }) + hi(0, "MasonBackdrop", { link = "NormalFloat" }) hi(0, "@tag.delimiter.javascript", { fg = color.punctuation }) hi(0, "@tag.delimiter.tsx", { fg = color.punctuation }) -- git diff --git a/lua/pcode/plugins/theme/github.lua b/lua/pcode/plugins/theme/github.lua index 99f226c..dd346b2 100644 --- a/lua/pcode/plugins/theme/github.lua +++ b/lua/pcode/plugins/theme/github.lua @@ -53,6 +53,7 @@ return { specs = {}, groups = { all = { + MasonBackdrop = { link = "NormalFloat" }, illuminatedWord = { bg = "#3b4261" }, illuminatedCurWord = { bg = "#3b4261" }, IlluminatedWordText = { bg = "#3b4261" }, diff --git a/lua/pcode/plugins/theme/gruvbox.lua b/lua/pcode/plugins/theme/gruvbox.lua index 909d896..f1856cc 100644 --- a/lua/pcode/plugins/theme/gruvbox.lua +++ b/lua/pcode/plugins/theme/gruvbox.lua @@ -18,6 +18,7 @@ return { ["FoldColumn"] = { bg = "NONE" }, ["Folded"] = { bg = "NONE" }, ["SignColumn"] = { bg = "NONE" }, + ["MasonBackdrop"] = { link = "NormalFloat" }, }, } end, diff --git a/lua/pcode/plugins/theme/jetbrains.lua b/lua/pcode/plugins/theme/jetbrains.lua index e877813..b35ec37 100644 --- a/lua/pcode/plugins/theme/jetbrains.lua +++ b/lua/pcode/plugins/theme/jetbrains.lua @@ -33,6 +33,7 @@ return { hi(0, "TelescopePromptNormal", { bg = colors.dark, fg = colors.grey }) hi(0, "TelescopePromptPrefix", { bg = colors.dark, fg = colors.red }) hi(0, "TelescopeResultsTitle", { bg = colors.olive_green, fg = colors.very_dark_gray }) + hi(0, "MasonBackdrop", { link = "NormalFloat" }) end, }) local colorscheme = pcode.themes.jetbrains or "darcula-dark" diff --git a/lua/pcode/plugins/theme/onedarkpro.lua b/lua/pcode/plugins/theme/onedarkpro.lua index 1298d91..1687b3e 100644 --- a/lua/pcode/plugins/theme/onedarkpro.lua +++ b/lua/pcode/plugins/theme/onedarkpro.lua @@ -1,124 +1,125 @@ return { - "olimorris/onedarkpro.nvim", - priority = 1000, - config = function() - local is_transparent = false - require("onedarkpro").setup({ - styles = { - types = "NONE", - methods = "NONE", - numbers = "NONE", - strings = "NONE", - comments = "italic", - keywords = "bold,italic", - constants = "NONE", - functions = "italic", - operators = "NONE", - variables = "NONE", - parameters = "NONE", - conditionals = "italic", - virtual_text = "NONE", - tags = "italic", - }, - colors = { - bg_statusline = "#282c34", - onedark = { - green = "#99c379", - gray = "#8094b4", - red = "#e06c75", - purple = "#c678dd", - yellow = "#e5c07a", - blue = "#61afef", - cyan = "#56b6c2", - indentline = "#3b4261", - float_bg = "#282c34", - }, - onedark_dark = { - bg_statusline = "#000", - }, - }, - options = { - cursorline = true, - transparency = is_transparent, - terminal_colors = true, - }, - highlights = { - -- overide cursor line fill colors - LineNr = { fg = "#49505E" }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. - CursorLineNr = { fg = "${blue}" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. - CursorLine = { bg = "#333842" }, - Cursor = { fg = "${bg}", bg = "${fg}" }, -- character under the cursor - lCursor = { fg = "${bg}", bg = "${fg}" }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') - CursorIM = { fg = "${bg}", bg = "${fg}" }, -- like Cursor, but used when in IME mode |CursorIM| - CursorColumn = { bg = "#333842" }, -- Screen-column at the cursor, when 'cursorcolumn' is set. - -- overide nvimtree folder icon fill color - NvimTreeFolderIcon = { fg = "${gray}" }, - -- overide nvimtree text fill color folder opened - NvimTreeOpenedFolderName = { fg = "${blue}" }, - -- overide nvimtree text fill color root folder - NvimTreeRootFolder = { fg = "${yellow}" }, - NvimTreeSpecialFile = { fg = "${orange}" }, - NvimTreeWinSeparator = { fg = "#202329" }, - NvimTreeIndentMarker = { fg = "#3E4450" }, - -- overide nvimtree cursorline - NvimTreeCursorLine = { bg = "#333842" }, - -- overide indenline fill color - IblIndent = { fg = "#3E4450" }, - -- overide cmp cursorline fill color with #333842 - PmenuSel = { bg = "#333842" }, - illuminatedWord = { bg = "#3b4261" }, - illuminatedCurWord = { bg = "#3b4261" }, - IlluminatedWordText = { bg = "#3b4261" }, - IlluminatedWordRead = { bg = "#3b4261" }, - IlluminatedWordWrite = { bg = "#3b4261" }, - StatusLine = { fg = "#f8f8f2", bg = is_transparent and "NONE" or "${bg}" }, - StatusLineTerm = { fg = "#f8f8f2", bg = "${bg}" }, - BufferLineFill = { bg = is_transparent and "NONE" or "${bg}" }, - ["@string.special.url.html"] = { fg = "${green}" }, - ["@lsp.type.parameter"] = { fg = "${gray}" }, - -- ["@text.uri.html"] = { fg = "${green}" }, - -- ["@tag.javascript"] = { fg = "${red}" }, - -- ["@tag.attribute"] = { fg = "${orange}", style = "italic" }, - -- ["@constructor.javascript"] = { fg = "${red}" }, - -- ["@variable"] = { fg = "${fg}", style = "NONE" }, -- various variable names - -- ["@variable.builtin"] = { fg = "${red}", style = "NONE" }, - -- ["@variable.member"] = "${cyan}", - -- ["@variable.parameter"] = "${red}", - -- ["@property"] = { fg = "${cyan}" }, -- similar to `@field` - ["@property.lua"] = { fg = "${red}", bg = "NONE" }, - ["@lsp.type.property.lua"] = { fg = "${cyan}", bg = "NONE" }, - ["@lsp.type.variable.lua"] = { fg = "${red}", bg = "NONE" }, - NvimTreeGitDirty = { fg = "${yellow}" }, - Pmenu = { fg = "${fg}", bg = "${bg}" }, - PmenuThumb = { bg = "${gray}" }, -- Popup menu: Thumb of the scrollbar. - -- overide lualine fill color with bg color - LualineNormal = { bg = "${bg}" }, - -- overide lualine_c fill color with bg color - LualineC = { bg = "${bg}" }, - -- overide lualine_x fill color with bg color - LualineX = { bg = "${bg}" }, - -- overide which-key fill color with bg color - -- WhichKey = { bg = "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeySeperator = { bg = "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyDesc = { fg = "${red}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyFloat = { bg = "${bg}" }, - WhichKeyFloat = { bg = is_transparent and "NONE" or "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyValue = { bg = "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyBorder = { bg = "${bg}" }, - LspInfoBorder = { fg = "${fg}" }, - NormalFloat = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, - 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" }, - }, - }) - local colorscheme = pcode.themes.onedarkpro or "onedark" - vim.cmd("colorscheme " .. colorscheme) - end, + "olimorris/onedarkpro.nvim", + priority = 1000, + config = function() + local is_transparent = false + require("onedarkpro").setup({ + styles = { + types = "NONE", + methods = "NONE", + numbers = "NONE", + strings = "NONE", + comments = "italic", + keywords = "bold,italic", + constants = "NONE", + functions = "italic", + operators = "NONE", + variables = "NONE", + parameters = "NONE", + conditionals = "italic", + virtual_text = "NONE", + tags = "italic", + }, + colors = { + bg_statusline = "#282c34", + onedark = { + green = "#99c379", + gray = "#8094b4", + red = "#e06c75", + purple = "#c678dd", + yellow = "#e5c07a", + blue = "#61afef", + cyan = "#56b6c2", + indentline = "#3b4261", + float_bg = "#282c34", + }, + onedark_dark = { + bg_statusline = "#000", + }, + }, + options = { + cursorline = true, + transparency = is_transparent, + terminal_colors = true, + }, + highlights = { + -- overide cursor line fill colors + LineNr = { fg = "#49505E" }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + CursorLineNr = { fg = "${blue}" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + CursorLine = { bg = "#333842" }, + Cursor = { fg = "${bg}", bg = "${fg}" }, -- character under the cursor + lCursor = { fg = "${bg}", bg = "${fg}" }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') + CursorIM = { fg = "${bg}", bg = "${fg}" }, -- like Cursor, but used when in IME mode |CursorIM| + CursorColumn = { bg = "#333842" }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + -- overide nvimtree folder icon fill color + NvimTreeFolderIcon = { fg = "${gray}" }, + -- overide nvimtree text fill color folder opened + NvimTreeOpenedFolderName = { fg = "${blue}" }, + -- overide nvimtree text fill color root folder + NvimTreeRootFolder = { fg = "${yellow}" }, + NvimTreeSpecialFile = { fg = "${orange}" }, + NvimTreeWinSeparator = { fg = "#202329" }, + NvimTreeIndentMarker = { fg = "#3E4450" }, + -- overide nvimtree cursorline + NvimTreeCursorLine = { bg = "#333842" }, + -- overide indenline fill color + IblIndent = { fg = "#3E4450" }, + -- overide cmp cursorline fill color with #333842 + PmenuSel = { bg = "#333842" }, + illuminatedWord = { bg = "#3b4261" }, + illuminatedCurWord = { bg = "#3b4261" }, + IlluminatedWordText = { bg = "#3b4261" }, + IlluminatedWordRead = { bg = "#3b4261" }, + IlluminatedWordWrite = { bg = "#3b4261" }, + StatusLine = { fg = "#f8f8f2", bg = is_transparent and "NONE" or "${bg}" }, + StatusLineTerm = { fg = "#f8f8f2", bg = "${bg}" }, + BufferLineFill = { bg = is_transparent and "NONE" or "${bg}" }, + ["@string.special.url.html"] = { fg = "${green}" }, + ["@lsp.type.parameter"] = { fg = "${gray}" }, + -- ["@text.uri.html"] = { fg = "${green}" }, + -- ["@tag.javascript"] = { fg = "${red}" }, + -- ["@tag.attribute"] = { fg = "${orange}", style = "italic" }, + -- ["@constructor.javascript"] = { fg = "${red}" }, + -- ["@variable"] = { fg = "${fg}", style = "NONE" }, -- various variable names + -- ["@variable.builtin"] = { fg = "${red}", style = "NONE" }, + -- ["@variable.member"] = "${cyan}", + -- ["@variable.parameter"] = "${red}", + -- ["@property"] = { fg = "${cyan}" }, -- similar to `@field` + ["@property.lua"] = { fg = "${red}", bg = "NONE" }, + ["@lsp.type.property.lua"] = { fg = "${cyan}", bg = "NONE" }, + ["@lsp.type.variable.lua"] = { fg = "${red}", bg = "NONE" }, + NvimTreeGitDirty = { fg = "${yellow}" }, + Pmenu = { fg = "${fg}", bg = "${bg}" }, + PmenuThumb = { bg = "${gray}" }, -- Popup menu: Thumb of the scrollbar. + -- overide lualine fill color with bg color + LualineNormal = { bg = "${bg}" }, + -- overide lualine_c fill color with bg color + LualineC = { bg = "${bg}" }, + -- overide lualine_x fill color with bg color + LualineX = { bg = "${bg}" }, + -- overide which-key fill color with bg color + -- WhichKey = { bg = "${bg}" }, + -- -- overide which-key fill color with bg color + -- WhichKeySeperator = { bg = "${bg}" }, + -- -- overide which-key fill color with bg color + -- WhichKeyDesc = { fg = "${red}" }, + -- -- overide which-key fill color with bg color + -- WhichKeyFloat = { bg = "${bg}" }, + WhichKeyFloat = { bg = is_transparent and "NONE" or "${bg}" }, + -- -- overide which-key fill color with bg color + -- WhichKeyValue = { bg = "${bg}" }, + -- -- overide which-key fill color with bg color + -- WhichKeyBorder = { bg = "${bg}" }, + LspInfoBorder = { fg = "${fg}" }, + NormalFloat = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, + 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" }, + MasonBackdrop = { link = "NormalFloat" }, + }, + }) + local colorscheme = pcode.themes.onedarkpro or "onedark" + vim.cmd("colorscheme " .. colorscheme) + end, } diff --git a/lua/pcode/plugins/theme/sublimetext.lua b/lua/pcode/plugins/theme/sublimetext.lua index e49479e..9546d40 100644 --- a/lua/pcode/plugins/theme/sublimetext.lua +++ b/lua/pcode/plugins/theme/sublimetext.lua @@ -12,6 +12,7 @@ return { -- custom hilights local hi = vim.api.nvim_set_hl hi(0, "FoldColumn", { bg = colors.bg2 }) + hi(0, "MasonBackdrop", { link = "NormalFloat" }) end, }) end, diff --git a/lua/pcode/plugins/theme/tokyonight.lua b/lua/pcode/plugins/theme/tokyonight.lua index 5dd30a3..bb519af 100644 --- a/lua/pcode/plugins/theme/tokyonight.lua +++ b/lua/pcode/plugins/theme/tokyonight.lua @@ -71,6 +71,7 @@ return { highlights["@tag.attribute"] = { fg = colors.green1, italic = true } -- highlights["@keyword.function"] = { fg = colors.blue, italic = true } -- highlights["@function"] = { fg = colors.blue, italic = true } + highlights.MasonBackdrop = { link = "NormalFloat" } end, }) end, diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 6213a17..7f3e7d8 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -48,6 +48,8 @@ pcode.extras = { lspsignatur = false, telescopetreesiterinfo = true, fidget = false, + tinydignostic = false, + dressing = false, } -- activate config themes pcode.themes = { @@ -93,6 +95,6 @@ pcode.themes = { -- github = "github_dark_dimmed", } -- activate config transparent_bg -pcode.transparent = true +pcode.transparent = false pcode.localcode = true pcode.snippets_path = vim.fn.stdpath("config") .. "/mysnippets" From d41d9b4cf5b7981bbe86847433cd572400df8f54 Mon Sep 17 00:00:00 2001 From: pojok code Date: Sat, 14 Jun 2025 16:17:17 +0700 Subject: [PATCH 54/59] fix: nvim menu create new file --- lazy-lock.json | 17 +++++++++-------- lua/pcode/plugins/extras/dressing.lua | 8 ++++---- lua/pcode/plugins/extras/tinydignostic.lua | 13 ++++++++++++- lua/pcode/user/custom.lua | 18 +++++++++++++++++- lua/pcode/user/default.lua | 2 +- 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 9aae565..c7b5a32 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -20,6 +20,7 @@ "code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "731b581428ec6c1ccb451b95190ebbc6d7006db7" }, "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, @@ -30,7 +31,7 @@ "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, - "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, + "mini.indentscope": { "branch": "main", "commit": "5fdc3edf7bb1b6365980c2c47dac2f19ec93c97b" }, "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, "neotest-golang": { "branch": "main", "commit": "0a0acff3cf9a0bf140c84ea9e66d818df7c2608f" }, @@ -41,18 +42,18 @@ "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, - "nvim-dap": { "branch": "master", "commit": "ea82027c3447dc1a022be9a9884de276c05cd33a" }, + "nvim-dap": { "branch": "master", "commit": "40a8189b8a57664a1850b0823fdcb3ac95b9f635" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, - "nvim-lint": { "branch": "master", "commit": "cc26ae6a620298bb3f33b0e0681f99a10ae57781" }, - "nvim-lspconfig": { "branch": "master", "commit": "77d3fdfb3554632c7a3b101ded643d422de7626f" }, + "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, + "nvim-lspconfig": { "branch": "master", "commit": "7ad4a11cc5742774877c529fcfb2702f7caf75e4" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, - "nvim-scrollview": { "branch": "main", "commit": "b65192ef2e39c456e8dc5f8f5cdd9b8d13f121e4" }, - "nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" }, + "nvim-scrollview": { "branch": "main", "commit": "a313032d62ee630aeac9d5408817f2e834bc9aa9" }, + "nvim-tree.lua": { "branch": "master", "commit": "6b5b36659688767fb9f133bb83024ab1466fe5cd" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, @@ -61,7 +62,7 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" }, "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, - "smart-splits.nvim": { "branch": "master", "commit": "9af865e451e55a9835fae6862dd7c55396870ecb" }, + "smart-splits.nvim": { "branch": "master", "commit": "dcc9a886ac7214db6dd67d27044b8388b628dcb6" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, @@ -69,7 +70,7 @@ "vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, - "volt": { "branch": "main", "commit": "2aa99a4e388c840597441a901209cbdafe8472ed" }, + "volt": { "branch": "main", "commit": "7b8c5e790120d9f08c8487dcb80692db6d2087a1" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } diff --git a/lua/pcode/plugins/extras/dressing.lua b/lua/pcode/plugins/extras/dressing.lua index c881169..a7a750e 100644 --- a/lua/pcode/plugins/extras/dressing.lua +++ b/lua/pcode/plugins/extras/dressing.lua @@ -8,10 +8,10 @@ return { return vim.ui.select(...) end ---@diagnostic disable-next-line: duplicate-set-field - vim.ui.input = function(...) - require("lazy").load({ plugins = { "dressing.nvim" } }) - return vim.ui.input(...) - end + -- vim.ui.input = function(...) + -- require("lazy").load({ plugins = { "dressing.nvim" } }) + -- return vim.ui.input(...) + -- end end, opts = { input = { diff --git a/lua/pcode/plugins/extras/tinydignostic.lua b/lua/pcode/plugins/extras/tinydignostic.lua index 60d864d..42a20ab 100644 --- a/lua/pcode/plugins/extras/tinydignostic.lua +++ b/lua/pcode/plugins/extras/tinydignostic.lua @@ -5,7 +5,18 @@ return { config = function() require("tiny-inline-diagnostic").setup({ preset = "powerline", + -- signs = { + -- left = "", + -- right = "", + -- diag = "●", + -- arrow = "  ", + -- up_arrow = "  ", + -- vertical = " │", + -- vertical_end = " └", + -- }, + blend = { + factor = 0.22, + }, }) - vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics end, } diff --git a/lua/pcode/user/custom.lua b/lua/pcode/user/custom.lua index cd0e85c..d370589 100644 --- a/lua/pcode/user/custom.lua +++ b/lua/pcode/user/custom.lua @@ -47,7 +47,23 @@ return { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) vim.list_extend(opts.skip_config, {}) - opts.virtual_text = true + opts.virtual_text = false + vim.diagnostic.config({ virtual_lines = { current_line = true } }) + -- sample custom diagnostic icon + vim.diagnostic.config({ + underline = false, + virtual_text = false, + update_in_insert = false, + severity_sort = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = " ", + [vim.diagnostic.severity.WARN] = " ", + [vim.diagnostic.severity.HINT] = " ", + [vim.diagnostic.severity.INFO] = " ", + }, + }, + }) end, }, -- add whichkey mappings diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 7f3e7d8..0d8c0d0 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -49,7 +49,7 @@ pcode.extras = { telescopetreesiterinfo = true, fidget = false, tinydignostic = false, - dressing = false, + dressing = true, } -- activate config themes pcode.themes = { From d31ffccdca8aa4ceab9c9f30c4aaf2638e2974d3 Mon Sep 17 00:00:00 2001 From: pojok code Date: Sat, 14 Jun 2025 19:46:00 +0700 Subject: [PATCH 55/59] enc: overide command TSInstallInfo --- lua/pcode/plugins/_treesitter.lua | 93 ++++++++++++++++--------------- lua/pcode/user/keymaps.lua | 77 +++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 45 deletions(-) diff --git a/lua/pcode/plugins/_treesitter.lua b/lua/pcode/plugins/_treesitter.lua index 335be0e..dd80401 100644 --- a/lua/pcode/plugins/_treesitter.lua +++ b/lua/pcode/plugins/_treesitter.lua @@ -1,47 +1,50 @@ return { - { "nvim-lua/plenary.nvim", event = "VeryLazy" }, - { - "nvim-treesitter/nvim-treesitter", - event = { "BufRead", "VeryLazy" }, - version = false, - build = ":TSUpdate", - lazy = true, - cmd = { - "TSInstall", - "TSInstallInfo", - "TSInstallSync", - "TSUpdate", - "TSUpdateSync", - "TSUninstall", - "TSUninstallInfo", - "TSInstallFromGrammar", - }, - opts = function() - return { - highlight = { enable = true }, - indent = { enable = true }, - ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" }, - incremental_selection = { - enable = true, - }, - autopairs = { - enable = true, - }, - } - end, - config = function(_, opts) - if type(opts.ensure_installed) == "table" then - ---@type table - local added = {} - opts.ensure_installed = vim.tbl_filter(function(lang) - if added[lang] then - return false - end - added[lang] = true - return true - end, opts.ensure_installed) - end - require("nvim-treesitter.configs").setup(opts) - end, - }, + { "nvim-lua/plenary.nvim", event = "VeryLazy" }, + { + "nvim-treesitter/nvim-treesitter", + event = { "BufRead", "VeryLazy" }, + version = false, + build = ":TSUpdate", + lazy = true, + cmd = { + "TSInstall", + -- "TSInstallInfo", + "TSInstallSync", + "TSUpdate", + "TSUpdateSync", + "TSUninstall", + "TSUninstallInfo", + "TSInstallFromGrammar", + }, + opts = function() + return { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" }, + incremental_selection = { + enable = true, + }, + autopairs = { + enable = true, + }, + } + end, + config = function(_, opts) + if type(opts.ensure_installed) == "table" then + ---@type table + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then + return false + end + added[lang] = true + return true + end, opts.ensure_installed) + end + require("nvim-treesitter.configs").setup(opts) + vim.api.nvim_create_user_command("TSInstallInfo", function() + vim.cmd("Telescope treesitter_info") + end, {}) + end, + }, } diff --git a/lua/pcode/user/keymaps.lua b/lua/pcode/user/keymaps.lua index 39f8c5f..a260663 100644 --- a/lua/pcode/user/keymaps.lua +++ b/lua/pcode/user/keymaps.lua @@ -91,3 +91,80 @@ keymap("n", "", "terminal live-server", opts) -- close current buffer keymap("n", "", "lua require('auto-bufferline.configs.utils').bufremove()", opts) + +-- vim.keymap.set("n", "ti", function() +-- local api = vim.api +-- local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() +-- local parsers = vim.tbl_keys(parser_configs) +-- table.sort(parsers) +-- +-- local choices = {} +-- local lookup = {} +-- +-- for _, parser in ipairs(parsers) do +-- local is_installed = #api.nvim_get_runtime_file("parser/" .. parser .. ".so", false) > 0 +-- +-- local label = (is_installed and "[✓] " or "[✗] ") .. parser +-- table.insert(choices, label) +-- lookup[label] = parser +-- end +-- +-- vim.ui.select(choices, { +-- prompt = "Treesitter ([✓]= installed, [✗] = not installed)", +-- }, function(choice) +-- if choice then +-- local parser_name = lookup[choice] +-- if parser_name then +-- vim.cmd("TSInstall " .. parser_name) +-- end +-- end +-- end) +-- end, { desc = "Install Treesitter" }) +-- +-- vim.keymap.set("n", "tu", function() +-- local parsers = require("nvim-treesitter.info").installed_parsers() +-- table.sort(parsers) +-- local choices = {} +-- local lookup = {} +-- +-- for _, parser in ipairs(parsers) do +-- local label = "[✓] " .. parser +-- table.insert(choices, label) +-- lookup[label] = parser +-- end +-- +-- vim.ui.select(choices, { +-- prompt = "Uninstall Treesitter", +-- }, function(choice) +-- if choice then +-- local parser_name = lookup[choice] +-- if parser_name then +-- vim.cmd("TSUninstall " .. parser_name) +-- end +-- end +-- end) +-- end, { desc = "Uninstall Treesitter" }) + +vim.api.nvim_create_user_command("TSIsInstalled", function() + local parsers = require("nvim-treesitter.info").installed_parsers() + table.sort(parsers) + local choices = {} + local lookup = {} + + for _, parser in ipairs(parsers) do + local label = "[✓] " .. parser + table.insert(choices, label) + lookup[label] = parser + end + + vim.ui.select(choices, { + prompt = "Uninstall Treesitter", + }, function(choice) + if choice then + local parser_name = lookup[choice] + if parser_name then + vim.cmd("TSUninstall " .. parser_name) + end + end + end) +end, {}) From bf60de3aa1997e5b65d67d5a7793d923b6f6a1f0 Mon Sep 17 00:00:00 2001 From: pojok code Date: Sat, 14 Jun 2025 21:13:57 +0700 Subject: [PATCH 56/59] fix:disable dressing input --- lua/pcode/plugins/extras/dressing.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/pcode/plugins/extras/dressing.lua b/lua/pcode/plugins/extras/dressing.lua index a7a750e..cafd8c9 100644 --- a/lua/pcode/plugins/extras/dressing.lua +++ b/lua/pcode/plugins/extras/dressing.lua @@ -1,5 +1,5 @@ return { - "stevearc/dressing.nvim", + "pojokcodeid/dressing.nvim", lazy = true, init = function() ---@diagnostic disable-next-line: duplicate-set-field @@ -15,6 +15,7 @@ return { end, opts = { input = { + enabled = false, title_pos = "center", relative = "editor", default_prompt = "➤ ", From 82d6ba288902c4422f737343ebb0fb785a7f5ea6 Mon Sep 17 00:00:00 2001 From: pojok code Date: Sat, 14 Jun 2025 21:37:42 +0700 Subject: [PATCH 57/59] enc: add telescope diff file --- lazy-lock.json | 1 + lua/pcode/plugins/extras/telescopediff.lua | 26 ++++++++++++++++++++++ lua/pcode/user/default.lua | 1 + 3 files changed, 28 insertions(+) create mode 100644 lua/pcode/plugins/extras/telescopediff.lua diff --git a/lazy-lock.json b/lazy-lock.json index c7b5a32..7b99297 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -63,6 +63,7 @@ "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" }, "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, "smart-splits.nvim": { "branch": "master", "commit": "dcc9a886ac7214db6dd67d27044b8388b628dcb6" }, + "telescope-diff.nvim": { "branch": "master", "commit": "c797b722516e871b51def7e69266f0cc9875bacf" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, diff --git a/lua/pcode/plugins/extras/telescopediff.lua b/lua/pcode/plugins/extras/telescopediff.lua new file mode 100644 index 0000000..c122598 --- /dev/null +++ b/lua/pcode/plugins/extras/telescopediff.lua @@ -0,0 +1,26 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "jemag/telescope-diff.nvim", + }, + config = function() + require("telescope").load_extension("diff") + end, + keys = { + { + "sd", + function() + require("telescope").extensions.diff.diff_files({ hidden = true }) + end, + desc = "Diff 2 Files", + }, + { + "sD", + function() + require("telescope").extensions.diff.diff_current({ hidden = true }) + end, + desc = "Diff Current File", + }, + }, +} diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 0d8c0d0..8c8ee5f 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -50,6 +50,7 @@ pcode.extras = { fidget = false, tinydignostic = false, dressing = true, + telescopediff = true, } -- activate config themes pcode.themes = { From 5df3f7b2abd023db94c3330d44962bcde164a001 Mon Sep 17 00:00:00 2001 From: pojok code Date: Mon, 16 Jun 2025 05:54:53 +0700 Subject: [PATCH 58/59] enc: add new command --- lazy-lock.json | 6 +- lua/pcode/plugins/lang/golang.lua | 4 + lua/pcode/user/autocmd.lua | 231 ++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+), 3 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 7b99297..7ba420e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -27,7 +27,7 @@ "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "bef29b653ba71d442816bf56286c2a686210be04" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f17d02b928a18ab88a50d374be036ab5f499fde4" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, @@ -52,8 +52,8 @@ "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, - "nvim-scrollview": { "branch": "main", "commit": "a313032d62ee630aeac9d5408817f2e834bc9aa9" }, - "nvim-tree.lua": { "branch": "master", "commit": "6b5b36659688767fb9f133bb83024ab1466fe5cd" }, + "nvim-scrollview": { "branch": "main", "commit": "095181bc2adb64af670dae73208871a731f0bb86" }, + "nvim-tree.lua": { "branch": "master", "commit": "d87b41ca537e2131622d48a6c25ccf2fbe0e5d62" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, diff --git a/lua/pcode/plugins/lang/golang.lua b/lua/pcode/plugins/lang/golang.lua index aceb426..9f6a0ba 100644 --- a/lua/pcode/plugins/lang/golang.lua +++ b/lua/pcode/plugins/lang/golang.lua @@ -11,6 +11,10 @@ return { opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} vim.list_extend(opts.ensure_installed, { "gopls" }) + -- add run command for current filebuffer + vim.api.nvim_create_user_command("RunGo", function() + vim.cmd("term go run " .. vim.fn.expand("%")) + end, {}) end, }, { diff --git a/lua/pcode/user/autocmd.lua b/lua/pcode/user/autocmd.lua index 8ecb083..b2eacb0 100644 --- a/lua/pcode/user/autocmd.lua +++ b/lua/pcode/user/autocmd.lua @@ -124,3 +124,234 @@ vim.api.nvim_create_autocmd("ExitPre", { -- vim.api.nvim_set_keymap("n", "rg", "terminalgradle run", { noremap = true, silent = true }) -- end, -- }) + +-- Extras +local function lsp_status() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients and vim.lsp.get_clients({ bufnr = bufnr }) + or vim.lsp.get_active_clients({ bufnr = bufnr }) + + if #clients == 0 then + print("󰅚 No LSP clients attached") + return + end + + print("󰒋 LSP Status for buffer " .. bufnr .. ":") + print("─────────────────────────────────") + + for i, client in ipairs(clients) do + print(string.format("󰌘 Client %d: %s (ID: %d)", i, client.name, client.id)) + print(" Root: " .. (client.config.root_dir or "N/A")) + print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", ")) + + -- Check capabilities + local caps = client.server_capabilities + local features = {} + if caps.completionProvider then + table.insert(features, "completion") + end + if caps.hoverProvider then + table.insert(features, "hover") + end + if caps.definitionProvider then + table.insert(features, "definition") + end + if caps.referencesProvider then + table.insert(features, "references") + end + if caps.renameProvider then + table.insert(features, "rename") + end + if caps.codeActionProvider then + table.insert(features, "code_action") + end + if caps.documentFormattingProvider then + table.insert(features, "formatting") + end + + print(" Features: " .. table.concat(features, ", ")) + print("") + end +end + +vim.api.nvim_create_user_command("LspStatus", lsp_status, { desc = "Show detailed LSP status" }) + +local function check_lsp_capabilities() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients and vim.lsp.get_clients({ bufnr = bufnr }) + or vim.lsp.get_active_clients({ bufnr = bufnr }) + + if #clients == 0 then + print("No LSP clients attached") + return + end + + for _, client in ipairs(clients) do + print("Capabilities for " .. client.name .. ":") + local caps = client.server_capabilities + + local capability_list = { + { "Completion", caps.completionProvider }, + { "Hover", caps.hoverProvider }, + { "Signature Help", caps.signatureHelpProvider }, + { "Go to Definition", caps.definitionProvider }, + { "Go to Declaration", caps.declarationProvider }, + { "Go to Implementation", caps.implementationProvider }, + { "Go to Type Definition", caps.typeDefinitionProvider }, + { "Find References", caps.referencesProvider }, + { "Document Highlight", caps.documentHighlightProvider }, + { "Document Symbol", caps.documentSymbolProvider }, + { "Workspace Symbol", caps.workspaceSymbolProvider }, + { "Code Action", caps.codeActionProvider }, + { "Code Lens", caps.codeLensProvider }, + { "Document Formatting", caps.documentFormattingProvider }, + { "Document Range Formatting", caps.documentRangeFormattingProvider }, + { "Rename", caps.renameProvider }, + { "Folding Range", caps.foldingRangeProvider }, + { "Selection Range", caps.selectionRangeProvider }, + } + + for _, cap in ipairs(capability_list) do + local status = cap[2] and "✓" or "✗" + print(string.format(" %s %s", status, cap[1])) + end + print("") + end +end + +vim.api.nvim_create_user_command("LspCapabilities", check_lsp_capabilities, { desc = "Show LSP capabilities" }) + +local function lsp_diagnostics_info() + local bufnr = vim.api.nvim_get_current_buf() + local diagnostics = vim.diagnostic.get(bufnr) + + local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 } + + for _, diagnostic in ipairs(diagnostics) do + local severity = vim.diagnostic.severity[diagnostic.severity] + counts[severity] = counts[severity] + 1 + end + + print("󰒡 Diagnostics for current buffer:") + print(" Errors: " .. counts.ERROR) + print(" Warnings: " .. counts.WARN) + print(" Info: " .. counts.INFO) + print(" Hints: " .. counts.HINT) + print(" Total: " .. #diagnostics) +end + +vim.api.nvim_create_user_command("LspDiagnostics", lsp_diagnostics_info, { desc = "Show LSP diagnostics count" }) + +local function lsp_info() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients and vim.lsp.get_clients({ bufnr = bufnr }) + or vim.lsp.get_active_clients({ bufnr = bufnr }) + + print("═══════════════════════════════════") + print(" LSP INFORMATION ") + print("═══════════════════════════════════") + print("") + + -- Basic info + print("󰈙 Language client log: " .. vim.lsp.get_log_path()) + print("󰈔 Detected filetype: " .. vim.bo.filetype) + print("󰈮 Buffer: " .. bufnr) + print("󰈔 Root directory: " .. (vim.fn.getcwd() or "N/A")) + print("") + + if #clients == 0 then + print("󰅚 No LSP clients attached to buffer " .. bufnr) + print("") + print("Possible reasons:") + print(" • No language server installed for " .. vim.bo.filetype) + print(" • Language server not configured") + print(" • Not in a project root directory") + print(" • File type not recognized") + return + end + + print("󰒋 LSP clients attached to buffer " .. bufnr .. ":") + print("─────────────────────────────────") + + for i, client in ipairs(clients) do + print(string.format("󰌘 Client %d: %s", i, client.name)) + print(" ID: " .. client.id) + print(" Root dir: " .. (client.config.root_dir or "Not set")) + print(" Command: " .. table.concat(client.config.cmd or {}, " ")) + print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", ")) + + -- Server status + if client.is_stopped() then + print(" Status: 󰅚 Stopped") + else + print(" Status: 󰄬 Running") + end + + -- Workspace folders + if client.workspace_folders and #client.workspace_folders > 0 then + print(" Workspace folders:") + for _, folder in ipairs(client.workspace_folders) do + print(" • " .. folder.name) + end + end + + -- Attached buffers count + local attached_buffers = {} + for buf, _ in pairs(client.attached_buffers or {}) do + table.insert(attached_buffers, buf) + end + print(" Attached buffers: " .. #attached_buffers) + + -- Key capabilities + local caps = client.server_capabilities + local key_features = {} + if caps.completionProvider then + table.insert(key_features, "completion") + end + if caps.hoverProvider then + table.insert(key_features, "hover") + end + if caps.definitionProvider then + table.insert(key_features, "definition") + end + if caps.documentFormattingProvider then + table.insert(key_features, "formatting") + end + if caps.codeActionProvider then + table.insert(key_features, "code_action") + end + + if #key_features > 0 then + print(" Key features: " .. table.concat(key_features, ", ")) + end + + print("") + end + + -- Diagnostics summary + local diagnostics = vim.diagnostic.get(bufnr) + if #diagnostics > 0 then + print("󰒡 Diagnostics Summary:") + local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 } + + for _, diagnostic in ipairs(diagnostics) do + local severity = vim.diagnostic.severity[diagnostic.severity] + counts[severity] = counts[severity] + 1 + end + + print(" 󰅚 Errors: " .. counts.ERROR) + print(" 󰀪 Warnings: " .. counts.WARN) + print(" 󰋽 Info: " .. counts.INFO) + print(" 󰌶 Hints: " .. counts.HINT) + print(" Total: " .. #diagnostics) + else + print("󰄬 No diagnostics") + end + + print("") + print("Use :LspLog to view detailed logs") + print("Use :LspCapabilities for full capability list") +end + +-- Create command +vim.api.nvim_create_user_command("LspInfo2", lsp_info, { desc = "Show comprehensive LSP information" }) From dc19ff45d805953a6bb92d5c77bc9b3ef81a775c Mon Sep 17 00:00:00 2001 From: pojok code Date: Sat, 21 Jun 2025 13:33:57 +0700 Subject: [PATCH 59/59] enc: update default config --- lazy-lock.json | 21 +++---- lua/pcode/plugins/coderunner.lua | 96 +++++++++++++++++-------------- lua/pcode/plugins/lang/golang.lua | 42 +++++++++++++- lua/pcode/plugins/nvimtree.lua | 38 ++++++++++++ lua/pcode/user/default.lua | 7 ++- 5 files changed, 144 insertions(+), 60 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 7ba420e..1608a3f 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -22,12 +22,11 @@ "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "731b581428ec6c1ccb451b95190ebbc6d7006db7" }, - "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, + "gitsigns.nvim": { "branch": "main", "commit": "1b0350ab707713b2bc6c236151f1a324175347b1" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "f17d02b928a18ab88a50d374be036ab5f499fde4" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f54e3c11fc9ebfcfc27e696182b0295b071d0811" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, @@ -39,30 +38,29 @@ "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-autopairs": { "branch": "master", "commit": "2647cce4cb64fb35c212146663384e05ae126bdf" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, - "nvim-dap": { "branch": "master", "commit": "40a8189b8a57664a1850b0823fdcb3ac95b9f635" }, + "nvim-dap": { "branch": "master", "commit": "2edd6375692d9ac1053d50acfe415c1eb2ba92d0" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, - "nvim-lspconfig": { "branch": "master", "commit": "7ad4a11cc5742774877c529fcfb2702f7caf75e4" }, + "nvim-lspconfig": { "branch": "master", "commit": "0112e1f77983141e1453bd37d124302f1c876c46" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, "nvim-scrollview": { "branch": "main", "commit": "095181bc2adb64af670dae73208871a731f0bb86" }, - "nvim-tree.lua": { "branch": "master", "commit": "d87b41ca537e2131622d48a6c25ccf2fbe0e5d62" }, + "nvim-tree.lua": { "branch": "master", "commit": "b0b49552c9462900a882fe772993b01d780445fe" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, - "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" }, "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, - "smart-splits.nvim": { "branch": "master", "commit": "dcc9a886ac7214db6dd67d27044b8388b628dcb6" }, + "smart-splits.nvim": { "branch": "master", "commit": "0098e376638602bc6aaf779bb8531b840a3fe26e" }, "telescope-diff.nvim": { "branch": "master", "commit": "c797b722516e871b51def7e69266f0cc9875bacf" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, @@ -73,6 +71,5 @@ "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, "volt": { "branch": "main", "commit": "7b8c5e790120d9f08c8487dcb80692db6d2087a1" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, - "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }, - "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } + "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" } } diff --git a/lua/pcode/plugins/coderunner.lua b/lua/pcode/plugins/coderunner.lua index f3e21ef..f614432 100644 --- a/lua/pcode/plugins/coderunner.lua +++ b/lua/pcode/plugins/coderunner.lua @@ -2,51 +2,63 @@ -- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt" local pyrun = "python -u" if vim.fn.has("win32") == 0 then - pyrun = "python3 -u" + pyrun = "python3 -u" end local rfile = { - java = "cd $dir && javac $fileName && java $fileNameWithoutExt", - python = pyrun, - typescript = "ts-node $dir/$fileName", - rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt", - cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", - scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css", - javascript = 'node "$dir/$fileName"', - go = "go run .", + java = "cd $dir && javac $fileName && java $fileNameWithoutExt", + python = pyrun, + typescript = "ts-node $dir/$fileName", + rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt", + cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", + scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css", + javascript = 'node "$dir/$fileName"', + -- go = "go run .", + go = "go run $fileName", } +local runProject = {} +local cwd = vim.fn.getcwd() +local go_mod_path = cwd .. "/go.mod" +if vim.fn.filereadable(go_mod_path) ~= 0 then + runProject[cwd] = { + name = "Go Project (cwd)", + command = "go run .", + } +end + return { - "CRAG666/code_runner.nvim", - lazy = true, - cmd = { "RunCode", "RunFile", "RunProject", "RunClose" }, - opts = { - filetype = rfile, - mode = "float", - focus = true, - startinsert = true, - term = { - position = "bot", - size = 50, - }, - float = { - close_key = "", - border = "rounded", - height = 0.8, - width = 0.8, - x = 0.5, - y = 0.5, - border_hl = "FloatBorder", - float_hl = "Normal", - blend = 0, - }, - }, - config = function(_, opts) - require("code_runner").setup(opts) - end, - keys = { - { "r", "", desc = "  Run", mode = "n" }, - { "rr", "RunCode", desc = "Run Code", mode = "n" }, - { "rf", "RunFile", desc = "Run File", mode = "n" }, - { "rp", "RunProject", desc = "Run Project", mode = "n" }, - }, + "CRAG666/code_runner.nvim", + lazy = true, + cmd = { "RunCode", "RunFile", "RunProject", "RunClose" }, + opts = { + filetype = rfile, + project = runProject, + mode = "float", + focus = true, + startinsert = true, + term = { + position = "bot", + size = 50, + }, + float = { + close_key = "", + border = "rounded", + height = 0.8, + width = 0.8, + x = 0.5, + y = 0.5, + border_hl = "FloatBorder", + float_hl = "Normal", + blend = 0, + }, + }, + config = function(_, opts) + require("code_runner").setup(opts) + end, + keys = { + { "r", "", desc = "  Run", mode = "n" }, + { "rr", "RunCode", desc = "Run Code", mode = "n" }, + { "rf", "RunFile", desc = "Run File", mode = "n" }, + { "rp", "RunProject", desc = "Run Project", mode = "n" }, + }, } diff --git a/lua/pcode/plugins/lang/golang.lua b/lua/pcode/plugins/lang/golang.lua index 9f6a0ba..a5cf93c 100644 --- a/lua/pcode/plugins/lang/golang.lua +++ b/lua/pcode/plugins/lang/golang.lua @@ -11,9 +11,45 @@ return { opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} vim.list_extend(opts.ensure_installed, { "gopls" }) - -- add run command for current filebuffer - vim.api.nvim_create_user_command("RunGo", function() - vim.cmd("term go run " .. vim.fn.expand("%")) + vim.api.nvim_create_user_command("GoRun", function() + local filename = vim.fn.expand("%:p") -- path lengkap file aktif + if not filename:match("%.go$") then + vim.notify("current file is not a go file.", vim.log.levels.WARN, { title = "GoRun" }) + return + end + + local Terminal = require("toggleterm.terminal").Terminal + local go_runner = Terminal:new({ + cmd = "go run " .. filename, + direction = "float", + close_on_exit = false, + hidden = true, + }) + + go_runner:toggle() + end, {}) + vim.api.nvim_create_user_command("GoBuild", function() + local cwd = vim.fn.getcwd() + local go_mod_path = cwd .. "/go.mod" + if vim.fn.filereadable(go_mod_path) == 0 then + vim.notify("current project is not a go project.", vim.log.levels.WARN, { title = "GoBuild" }) + return + end + + local Terminal = require("toggleterm.terminal").Terminal + -- create file exe jika os adalah windows + local filename = "output" + if vim.fn.has("win32") == 1 then + filename = "output.exe" + end + local go_runner = Terminal:new({ + cmd = "go build -o " .. filename .. " && ./" .. filename, + direction = "float", + close_on_exit = false, + hidden = true, + }) + + go_runner:toggle() end, {}) end, }, diff --git a/lua/pcode/plugins/nvimtree.lua b/lua/pcode/plugins/nvimtree.lua index e845450..8227fc3 100644 --- a/lua/pcode/plugins/nvimtree.lua +++ b/lua/pcode/plugins/nvimtree.lua @@ -127,6 +127,44 @@ return { return opts end, config = function(_, opts) + if pcode.nvimtree_float then + -- set nvimtree float view (default left side) + opts.view = { + adaptive_size = false, + centralize_selection = true, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + float = { + enable = true, + open_win_config = function() + local screen_w = vim.opt.columns:get() + ---@diagnostic disable-next-line: undefined-field + local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() + local window_w = screen_w * 0.5 + local window_h = screen_h * 0.9 + local window_w_int = math.floor(window_w) + local window_h_int = math.floor(window_h) + local center_x = (screen_w - window_w) / 2 + ---@diagnostic disable-next-line: undefined-field + local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() + return { + border = "rounded", + relative = "editor", + row = center_y, + col = center_x, + width = window_w_int, + height = window_h_int, + } + end, + }, + width = function() + return math.floor(vim.opt.columns:get() * 0.5) + end, + } + end require("nvim-tree").setup(opts) local api = require("nvim-tree.api") api.events.subscribe(api.events.Event.FileCreated, function(file) diff --git a/lua/pcode/user/default.lua b/lua/pcode/user/default.lua index 8c8ee5f..9bac5ae 100644 --- a/lua/pcode/user/default.lua +++ b/lua/pcode/user/default.lua @@ -27,12 +27,12 @@ pcode.extras = { minianimate = false, neoscroll = false, nvimufo = false, - refactoring = true, + refactoring = false, rest = false, treesittercontex = false, codeium = true, colorizer = true, - dap = true, + dap = false, deviconcolor = true, illuminate = true, indentscupe = true, @@ -44,7 +44,7 @@ pcode.extras = { verticalcolumn = true, visualmulti = true, yanky = true, - zenmode = true, + zenmode = false, lspsignatur = false, telescopetreesiterinfo = true, fidget = false, @@ -99,3 +99,4 @@ pcode.themes = { pcode.transparent = false pcode.localcode = true pcode.snippets_path = vim.fn.stdpath("config") .. "/mysnippets" +pcode.nvimtree_float = false