diff --git a/lua/core/init.lua b/lua/core/init.lua index f6a298a..df0d77a 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -1,11 +1,12 @@ -require "custom.default" -require "custom.dashboard" -require "config.lazy_lib" -require "user.colorscheme" -require "user.keymaps" -require "core.neovide" -require "custom.autocmd" -require "custom.keymaps" +_G.pcode = _G.pcode or {} +require("custom.default") +require("custom.dashboard") +require("config.lazy_lib") +require("user.colorscheme") +require("user.keymaps") +require("core.neovide") +require("custom.autocmd") +require("custom.keymaps") -- require("user.snip") -- require("user.nvim-tree") -- require("user.options") diff --git a/lua/custom/autocmd.lua b/lua/custom/autocmd.lua index d6d992a..21da11f 100644 --- a/lua/custom/autocmd.lua +++ b/lua/custom/autocmd.lua @@ -1,4 +1,4 @@ -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local transparent_mode = pcode.transparent_mode or 0 if transparent_mode ~= nil then if transparent_mode == 1 then vim.cmd "TransparentDisable" diff --git a/lua/custom/default.lua b/lua/custom/default.lua index 61673a6..6d1cefe 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -14,10 +14,10 @@ -- solarized-osaka -- darcula-dark -- juliana -vim.g.pcode_colorscheme = "darcula-dark" +pcode.colorscheme = "darcula-dark" -- 0 =off 1= on -vim.g.pcode_transparent_mode = 0 +pcode.transparent_mode = 0 -- rounded -- roundedall -- square @@ -25,40 +25,40 @@ vim.g.pcode_transparent_mode = 0 -- parallelogram -- transparent -- default -vim.g.pcode_lualinetheme = "roundedall" +pcode.lualinetheme = "roundedall" -- 0 disable progress -- 1 lualine lsp progress -- 2 fidget progress -vim.g.pcode_progress = 1 +pcode.progress = 1 -- 0 = on full text mode info, -- 1 = on initial mode + logo -- 2 = logo only -- 3 = initial only -- 4 = off -vim.g.pcode_show_mode = 3 +pcode.show_mode = 3 -- 1 ( format jalan) 0 (fromat off) -vim.g.pcode_format_on_save = 1 -vim.g.pcode_format_timeout_ms = 5000 +pcode.format_on_save = 1 +pcode.format_timeout_ms = 5000 -- ini hanya untuk lsp yg tidak support masson -- untuk referesi support language kunjungi link dibawah -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md -vim.g.pcode_lsp_installer = { +pcode.lsp_installer = { -- "yamlls", -- tambahkan di bawah sini setelah melakukan :masoninstall } -- use for lsp diagnostics virtual text -vim.g.pcode_lsp_virtualtext = true +pcode.lsp_virtualtext = true -- use for lsp ghost text config -vim.g.pcode_lspghost_text = false +pcode.lspghost_text = false -- untuk referesi support language kunjungi link dibawah -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md -vim.g.pcode_mason_ensure_installed = { -- sebelumnya register_lsp +pcode.mason_ensure_installed = { -- sebelumnya register_lsp -- "yamlls", -- "intelephense", -- "marksman", @@ -68,24 +68,24 @@ vim.g.pcode_mason_ensure_installed = { -- sebelumnya register_lsp -- "kotlin_language_server", -- tambahkan di bawah sini setelah melakukan :masoninstall } -vim.g.pcode_unregister_lsp = { +pcode.unregister_lsp = { "jdtls", -- tambahkan di bawah ini } -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md -vim.g.pcode_null_ls_ensure_installed = { +pcode.null_ls_ensure_installed = { "stylua", } -- dap instal hanya support linux dan mac -- https://github.com/jay-babu/mason-nvim-dap.nvim/blob/main/lua/mason-nvim-dap/mappings/source.lua -- atau gunakan :MasonInstall -vim.g.pcode_dap_ensure_installed = { +pcode.dap_ensure_installed = { -- "python", } -- https://github.com/folke/which-key.nvim -vim.g.pcode_whichkey = { +pcode.whichkey = { -- contoh penambahan ["k"] = { name = "Example", @@ -99,44 +99,44 @@ vim.g.pcode_whichkey = { -- https://github.com/CRAG666/code_runner.nvim -- ready default java, python, typescript, javascript, rust, cpp, scss -vim.g.pcode_coderunner = { +pcode.coderunner = { go = "go run $fileName", html = "live-server $dir/$fileName", } -- 0 = normal -- 1 = float -vim.g.pcode_nvimtree_isfloat = 0 +pcode.nvimtree_isfloat = 0 -vim.g.pcode_tailwindcolorizer = false +pcode.tailwindcolorizer = false -- https://github.com/Exafunction/codeium.vim -vim.g.pcode_codeium = false +pcode.codeium = false -- https://github.com/Exafunction/codeium.nvim -vim.g.pcode_codeium_nvim = true +pcode.codeium_nvim = true -- https://github.com/kevinhwang91/nvim-ufo -vim.g.pcode_nvimufo = false +pcode.nvimufo = false -- https://github.com/echasnovski/mini.indentscope -vim.g.pcode_indentscope = true +pcode.indentscope = true -- https://github.com/echasnovski/mini.animate -vim.g.pcode_minianimate = false +pcode.minianimate = false -vim.g.pcode_disable_cmpdoc = false +pcode.disable_cmpdoc = false -- https://github.com/rachartier/tiny-devicons-auto-colors.nvim -vim.g.pcode_adaptive_color_icon = true +pcode.adaptive_color_icon = true -- https://github.com/lukas-reineke/virt-column.nvim -vim.g.pcode_columnline = true +pcode.columnline = true ---@alias telescope_themes ---| "cursor" # see `telescope.themes.get_cursor()` ---| "dropdown" # see `telescope.themes.get_dropdown()` ---| "ivy" # see `telescope.themes.get_ivy()` ---| "center" # retain the default telescope theme -vim.g.pcode_telescope_theme_find_file = "center" -vim.g.pcode_telescope_theme_live_grep = "dropdown" +pcode.telescope_theme_find_file = "center" +pcode.telescope_theme_live_grep = "dropdown" -- https://github.com/kristijanhusak/vim-dadbod-ui -vim.g.pcode_database = false +pcode.database = false -- https://github.com/nvim-neotest/neotest-jest -vim.g.pcode_jest = true -vim.g.pcode_jest_command = "npm test -- " -vim.g.pcode_jest_config = "jest.config.mjs" +pcode.jest = true +pcode.jest_command = "npm test -- " +pcode.jest_config = "jest.config.mjs" diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 94478dd..6aa7d92 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -1,4 +1,4 @@ -local lspghost_text = vim.g.pcode_lspghost_text or false +local lspghost_text = pcode.lspghost_text or false local icons = require("user.icons").ui local cmp_documentation = { border = icons.Border, @@ -100,7 +100,7 @@ return { winhighlight = "Normal:bg,FloatBorder:BorderBG,CursorLine:PmenuSel,Search:None", scrollbar = true, }, - documentation = vim.g.pcode_disable_cmpdoc and cmp.config.disable or cmp_documentation, + documentation = pcode.disable_cmpdoc and cmp.config.disable or cmp_documentation, }, experimental = { ghost_text = lspghost_text, diff --git a/lua/plugins/codeium.lua b/lua/plugins/codeium.lua index 3ae1a6a..03116ea 100644 --- a/lua/plugins/codeium.lua +++ b/lua/plugins/codeium.lua @@ -1,5 +1,5 @@ local M = {} -if vim.g.pcode_codeium then +if pcode.codeium then M.codeium = { "Exafunction/codeium.vim", enabled = true, diff --git a/lua/plugins/codeiumnvim.lua b/lua/plugins/codeiumnvim.lua index 6b3dc90..db2ce2d 100644 --- a/lua/plugins/codeiumnvim.lua +++ b/lua/plugins/codeiumnvim.lua @@ -1,4 +1,4 @@ -if vim.g.pcode_codeium_nvim then +if pcode.codeium_nvim then return { -- codeium cmp source { diff --git a/lua/plugins/coderunner.lua b/lua/plugins/coderunner.lua index bbe7574..dca10e3 100644 --- a/lua/plugins/coderunner.lua +++ b/lua/plugins/coderunner.lua @@ -10,7 +10,7 @@ local rfile = { javascript = 'node "$dir/$fileName"', } -local runscript = vim.g.pcode_coderunner or {} +local runscript = pcode.coderunner or {} rfile = vim.tbl_deep_extend("force", runscript, rfile) return { "CRAG666/code_runner.nvim", diff --git a/lua/plugins/database.lua b/lua/plugins/database.lua index b7562c7..16df78a 100644 --- a/lua/plugins/database.lua +++ b/lua/plugins/database.lua @@ -1,5 +1,5 @@ local M = {} -if vim.g.pcode_database then +if pcode.database then return { "kristijanhusak/vim-dadbod-ui", dependencies = { diff --git a/lua/plugins/deviconcolor.lua b/lua/plugins/deviconcolor.lua index 2b9bb67..50f163c 100644 --- a/lua/plugins/deviconcolor.lua +++ b/lua/plugins/deviconcolor.lua @@ -1,5 +1,5 @@ local M = {} -if vim.g.pcode_adaptive_color_icon then +if pcode.adaptive_color_icon then M = { "rachartier/tiny-devicons-auto-colors.nvim", event = "VeryLazy", diff --git a/lua/plugins/indentscupe.lua b/lua/plugins/indentscupe.lua index 39904a7..2fc9504 100644 --- a/lua/plugins/indentscupe.lua +++ b/lua/plugins/indentscupe.lua @@ -1,10 +1,10 @@ local icons = vim.g.pcode_icons -if vim.g.pcode_indentscope and true or false then +if pcode.indentscope and true or false then return { "echasnovski/mini.indentscope", version = false, -- wait till new 0.7.0 release to put it back on semver event = "BufReadPre", - enabled = vim.g.pcode_indentscope and true or false, + enabled = pcode.indentscope and true or false, opts = { symbol = icons.ui.LineMiddle, options = { try_as_border = true }, diff --git a/lua/plugins/lspprogress.lua b/lua/plugins/lspprogress.lua index d8a920e..403e343 100644 --- a/lua/plugins/lspprogress.lua +++ b/lua/plugins/lspprogress.lua @@ -20,13 +20,13 @@ end local fidget = true local lualine = false -if vim.g.pcode_progress == 1 then +if pcode.progress == 1 then fidget = false lualine = true -elseif vim.g.pcode_progress == 2 then +elseif pcode.progress == 2 then fidget = true lualine = false -elseif vim.g.pcode_progress == 0 then +elseif pcode.progress == 0 then fidget = false lualine = false else diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 7b54e6b..f8fcac5 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -9,7 +9,7 @@ return { -- check config for theme local set_theme = "auto" local bubbles_theme - local color = vim.g.pcode_colorscheme + local color = pcode.colorscheme switch(color, { ["tokyonight"] = function() set_theme = "auto" @@ -44,7 +44,7 @@ return { end local gettheme = require "user.utils.lualine_template" - local theme_option = vim.g.pcode_lualinetheme or "rounded" + local theme_option = pcode.lualinetheme or "rounded" local theme = gettheme.rounded(bubbles_theme) if theme_option == "rounded" then theme = gettheme.rounded(bubbles_theme) diff --git a/lua/plugins/mini-animate.lua b/lua/plugins/mini-animate.lua index 0b975f0..24e80ed 100644 --- a/lua/plugins/mini-animate.lua +++ b/lua/plugins/mini-animate.lua @@ -1,10 +1,10 @@ -if not vim.g.neovide and vim.g.pcode_minianimate and true or false then +if not vim.g.neovide and pcode.minianimate and true or false then return { -- animations { "echasnovski/mini.animate", event = "BufRead", - enabled = not vim.g.neovide and vim.g.pcode_minianimate and true or false, + enabled = not vim.g.neovide and pcode.minianimate and true or false, opts = function() -- don't use animate when scrolling with the mouse local mouse_scrolled = false diff --git a/lua/plugins/nvimtree.lua b/lua/plugins/nvimtree.lua index 741981d..60be97d 100644 --- a/lua/plugins/nvimtree.lua +++ b/lua/plugins/nvimtree.lua @@ -1,6 +1,6 @@ local icons = vim.g.pcode_icons local set_view = {} -if vim.g.pcode_nvimtree_isfloat == 1 then +if pcode.nvimtree_isfloat == 1 then set_view = require("user.utils.nvimtree").float else set_view = require("user.utils.nvimtree").normal diff --git a/lua/plugins/nvimufo.lua b/lua/plugins/nvimufo.lua index 2b690f6..53c2104 100644 --- a/lua/plugins/nvimufo.lua +++ b/lua/plugins/nvimufo.lua @@ -12,7 +12,7 @@ local icons = vim.g.pcode_icons.folding local M = {} -if vim.g.pcode_nvimufo then +if pcode.nvimufo then M.ufo = { "kevinhwang91/nvim-ufo", dependencies = { diff --git a/lua/plugins/tailwind.lua b/lua/plugins/tailwind.lua index 77c2479..4943989 100644 --- a/lua/plugins/tailwind.lua +++ b/lua/plugins/tailwind.lua @@ -1,5 +1,5 @@ local M = {} -if vim.g.pcode_tailwindcolorizer then +if pcode.tailwindcolorizer then M.tailwind = { { "NvChad/nvim-colorizer.lua", diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 54bf9e3..fceece8 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -10,15 +10,15 @@ return { local live_grep = { only_sort_text = true, } - if vim.g.pcode_telescope_theme_find_file and vim.g.pcode_telescope_theme_find_file ~= "center" then + if pcode.telescope_theme_find_file and pcode.telescope_theme_find_file ~= "center" then find_files = { - theme = vim.g.pcode_telescope_theme_find_file, + theme = pcode.telescope_theme_find_file, hidden = true, } end - if vim.g.pcode_telescope_theme_live_grep and vim.g.pcode_telescope_theme_live_grep ~= "center" then + if pcode.telescope_theme_live_grep and pcode.telescope_theme_live_grep ~= "center" then live_grep = { - theme = vim.g.pcode_telescope_theme_live_grep, + theme = pcode.telescope_theme_live_grep, only_sort_text = true, } end diff --git a/lua/plugins/test_jest.lua b/lua/plugins/test_jest.lua index 3b54e48..c960900 100644 --- a/lua/plugins/test_jest.lua +++ b/lua/plugins/test_jest.lua @@ -1,6 +1,6 @@ local M = {} -local config_file = vim.g.pcode_jest_config or "jest.config.ts" -if vim.g.pcode_jest then +local config_file = pcode.jest_config or "jest.config.ts" +if pcode.jest then M = { { "nvim-neotest/neotest", @@ -12,7 +12,7 @@ if vim.g.pcode_jest then opts = { adapters = { ["neotest-jest"] = { - jestCommand = vim.g.pcode_jest_command or "npm test -- ", + jestCommand = pcode.jest_command or "npm test -- ", jestConfigFile = function() local file = vim.fn.expand("%:p") if string.find(file, "/packages/") then diff --git a/lua/plugins/themes/_globalvar.lua b/lua/plugins/themes/_globalvar.lua index fc00d8a..ceee4d5 100644 --- a/lua/plugins/themes/_globalvar.lua +++ b/lua/plugins/themes/_globalvar.lua @@ -25,7 +25,7 @@ _G.extract = function(text) end _G.all_trim = function(s) - return s:match "^%s*(.-)%s*$" + return s:match("^%s*(.-)%s*$") end return {} diff --git a/lua/plugins/themes/catppuccin.lua b/lua/plugins/themes/catppuccin.lua index 3e0866a..9fd6478 100644 --- a/lua/plugins/themes/catppuccin.lua +++ b/lua/plugins/themes/catppuccin.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if substring(tostring(color), "catppuccin") and true or false then return { diff --git a/lua/plugins/themes/dracula.lua b/lua/plugins/themes/dracula.lua index dd62dfd..f6027f1 100644 --- a/lua/plugins/themes/dracula.lua +++ b/lua/plugins/themes/dracula.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if (color == "dracula") and true or false then return { diff --git a/lua/plugins/themes/github.lua b/lua/plugins/themes/github.lua index 9dc35a4..0ca082e 100644 --- a/lua/plugins/themes/github.lua +++ b/lua/plugins/themes/github.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if substring(tostring(color), "github") and true or false then return { diff --git a/lua/plugins/themes/gruvbox.lua b/lua/plugins/themes/gruvbox.lua index bacfdf1..6b1d3e6 100644 --- a/lua/plugins/themes/gruvbox.lua +++ b/lua/plugins/themes/gruvbox.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if (color == "gruvbox-baby") and true or false then return { "luisiacc/gruvbox-baby", diff --git a/lua/plugins/themes/jetbrains.lua b/lua/plugins/themes/jetbrains.lua index 202567f..06ab59a 100644 --- a/lua/plugins/themes/jetbrains.lua +++ b/lua/plugins/themes/jetbrains.lua @@ -1,4 +1,4 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" +local color = pcode.colorscheme or "gruvbox-baby" if (color == "darcula-dark") and true or false then return { diff --git a/lua/plugins/themes/juliana.lua b/lua/plugins/themes/juliana.lua index d96df91..0d58e82 100644 --- a/lua/plugins/themes/juliana.lua +++ b/lua/plugins/themes/juliana.lua @@ -1,4 +1,4 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" +local color = pcode.colorscheme or "gruvbox-baby" if (color == "juliana") and true or false then return { diff --git a/lua/plugins/themes/material.lua b/lua/plugins/themes/material.lua index 5dada21..f4f7bd1 100644 --- a/lua/plugins/themes/material.lua +++ b/lua/plugins/themes/material.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 local materialstyle = extract(color)[2] or "oceanic" local material_style = (materialstyle == "deepocean") and "deep ocean" or materialstyle diff --git a/lua/plugins/themes/nightfox.lua b/lua/plugins/themes/nightfox.lua index 307ec7d..537e303 100644 --- a/lua/plugins/themes/nightfox.lua +++ b/lua/plugins/themes/nightfox.lua @@ -1,6 +1,6 @@ local nightfox = false -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 switch(color, { ["nightfox"] = function() nightfox = true diff --git a/lua/plugins/themes/nord.lua b/lua/plugins/themes/nord.lua index c7939a5..bdb8e98 100644 --- a/lua/plugins/themes/nord.lua +++ b/lua/plugins/themes/nord.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if (color == "nord") and true or false then return { diff --git a/lua/plugins/themes/onedarkpro.lua b/lua/plugins/themes/onedarkpro.lua index 38c3f70..d78c8d8 100644 --- a/lua/plugins/themes/onedarkpro.lua +++ b/lua/plugins/themes/onedarkpro.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if substring(tostring(color), "onedark") and true or false then return { diff --git a/lua/plugins/themes/solarizedosaka.lua b/lua/plugins/themes/solarizedosaka.lua index f2122e9..e75516d 100644 --- a/lua/plugins/themes/solarizedosaka.lua +++ b/lua/plugins/themes/solarizedosaka.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if substring(tostring(color), "solarized") and true or false then return { diff --git a/lua/plugins/themes/sonokai.lua b/lua/plugins/themes/sonokai.lua index 546d22b..938714a 100644 --- a/lua/plugins/themes/sonokai.lua +++ b/lua/plugins/themes/sonokai.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if substring(tostring(color), "sonokai") and true or false then return { diff --git a/lua/plugins/themes/tokyonight.lua b/lua/plugins/themes/tokyonight.lua index 8da0249..0cbc20d 100644 --- a/lua/plugins/themes/tokyonight.lua +++ b/lua/plugins/themes/tokyonight.lua @@ -1,5 +1,5 @@ -local color = vim.g.pcode_colorscheme or "gruvbox-baby" -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local color = pcode.colorscheme or "gruvbox-baby" +local transparent_mode = pcode.transparent_mode or 0 if substring(tostring(color), "tokyonight") and true or false then return { @@ -14,7 +14,7 @@ if substring(tostring(color), "tokyonight") and true or false then local transp = false local sidebar = "normal" --"dark , transparent, normal" local hilight = "#292e42" - local tras = vim.g.pcode_transparent_mode or 0 + local tras = pcode.transparent_mode or 0 if tras == 1 then transp = true sidebar = "transparent" diff --git a/lua/plugins/transparant.lua b/lua/plugins/transparant.lua index 74fd70a..a9a8243 100644 --- a/lua/plugins/transparant.lua +++ b/lua/plugins/transparant.lua @@ -1,7 +1,7 @@ local transparent = false local clear_lualine = false -local transparent_mode = vim.g.pcode_transparent_mode or 0 +local transparent_mode = pcode.transparent_mode or 0 if transparent_mode ~= nil then if transparent_mode == 1 then transparent = true diff --git a/lua/plugins/vertcolumn.lua b/lua/plugins/vertcolumn.lua index 4e48f46..d562a4c 100644 --- a/lua/plugins/vertcolumn.lua +++ b/lua/plugins/vertcolumn.lua @@ -1,5 +1,5 @@ local M = {} -if vim.g.pcode_columnline then +if pcode.columnline then M = { { "lukas-reineke/virt-column.nvim", diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 13906fb..2cc8310 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -95,7 +95,7 @@ return { nowait = true, -- use `nowait` when creating keymaps } - local wkey = vim.g.pcode_whichkey or {} + local wkey = pcode.whichkey or {} local which_key = require("which-key") which_key.setup(opts) which_key.register(require("user.utils.whichkey").mappings, opt) diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index 8d4ac4e..2249032 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,4 +1,4 @@ -local colorscheme = vim.g.pcode_colorscheme or "gruvbox-baby" +local colorscheme = pcode.colorscheme or "gruvbox-baby" if substring(tostring(colorscheme), "sonokai") then colorscheme = "sonokai" diff --git a/lua/user/format_onsave.lua b/lua/user/format_onsave.lua index e49bdbe..ed98e60 100644 --- a/lua/user/format_onsave.lua +++ b/lua/user/format_onsave.lua @@ -1,5 +1,5 @@ local run = 0 -local frmt = vim.g.pcode_format_on_save or 0 +local frmt = pcode.format_on_save or 0 if frmt == 1 then run = 1 else @@ -32,7 +32,7 @@ if run == 1 then augroup _lsp autocmd! " autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms =200, filter=format_filter} - autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms=vim.g.pcode_format_timeout_ms or 5000 ,filter=FORMAT_FILTER} + autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms=pcode.format_timeout_ms or 5000 ,filter=FORMAT_FILTER} augroup end ]] end diff --git a/lua/user/lsp/config.lua b/lua/user/lsp/config.lua index 45a6457..f51dd44 100644 --- a/lua/user/lsp/config.lua +++ b/lua/user/lsp/config.lua @@ -8,7 +8,7 @@ local lspconfig = require("lspconfig") -- local servers = { "jsonls", "sumneko_lua","html","cssls","tsserver"} -- local servers = { "jdtls", "yamlls" } local servers = {} -local installer = vim.g.pcode_lsp_installer or {} +local installer = pcode.lsp_installer or {} for _, client in pairs(installer) do table.insert(servers, client) end diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index f0ad1e0..7292e3c 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -5,7 +5,7 @@ if not status_cmp_ok then return end -local lspvitualtext = vim.g.pcode_lsp_virtualtext or false +local lspvitualtext = pcode.lsp_virtualtext or false local icons = vim.g.pcode_icons M.capabilities = vim.lsp.protocol.make_client_capabilities() diff --git a/lua/user/lsp/mason_cfg.lua b/lua/user/lsp/mason_cfg.lua index 40547b1..9139041 100644 --- a/lua/user/lsp/mason_cfg.lua +++ b/lua/user/lsp/mason_cfg.lua @@ -11,12 +11,12 @@ local function idxOf(array, value) return nil end -local mason_install = vim.g.pcode_mason_ensure_installed or {} +local mason_install = pcode.mason_ensure_installed or {} for _, client in pairs(mason_install) do table.insert(servers, client) end -local unregis_lsp = vim.g.pcode_unregister_lsp or {} +local unregis_lsp = pcode.unregister_lsp or {} local icons = vim.g.pcode_icons.ui local settings = { diff --git a/lua/user/lsp/null-lscfg.lua b/lua/user/lsp/null-lscfg.lua index 417ec21..cfaabd1 100644 --- a/lua/user/lsp/null-lscfg.lua +++ b/lua/user/lsp/null-lscfg.lua @@ -21,7 +21,7 @@ if data_ok then end -- load data null-ls -local nullls_data = vim.g.pcode_null_ls_ensure_installed or {} +local nullls_data = pcode.null_ls_ensure_installed or {} for _, nullls in pairs(nullls_data) do table.insert(ensure_installed, nullls) end @@ -34,7 +34,7 @@ if mason_ok then end local run = 0 -local frmt = vim.g.pcode_format_on_save or 0 +local frmt = pcode.format_on_save or 0 if frmt == 1 then run = 1 end diff --git a/lua/user/mason_dap.lua b/lua/user/mason_dap.lua index e7b4aaa..9091c31 100644 --- a/lua/user/mason_dap.lua +++ b/lua/user/mason_dap.lua @@ -1,5 +1,5 @@ local sources = {} -local dap_data = vim.g.pcode_dap_ensure_installed or {} +local dap_data = pcode.dap_ensure_installed or {} for _, nullls in pairs(dap_data) do table.insert(sources, nullls) end diff --git a/lua/user/tokyonight.lua b/lua/user/tokyonight.lua index 5f8b4ac..673596f 100644 --- a/lua/user/tokyonight.lua +++ b/lua/user/tokyonight.lua @@ -5,7 +5,7 @@ end local transp = false local sidebar = "normal" --"dark , transparent, normal" local hilight = "#292e42" -local tras = vim.g.pcode_transparent_mode or 0 +local tras = pcode.transparent_mode or 0 if tras == 1 then transp = true sidebar = "transparent" diff --git a/lua/user/utils/lualine_component.lua b/lua/user/utils/lualine_component.lua index 68b316e..5ba0154 100644 --- a/lua/user/utils/lualine_component.lua +++ b/lua/user/utils/lualine_component.lua @@ -53,7 +53,7 @@ return { codeium = { function() - if vim.g.pcode_codeium then + if pcode.codeium then local codeium = all_trim(vim.api.nvim_call_function("codeium#GetStatusString", {})) if codeium then if codeium == "OFF" then @@ -69,7 +69,7 @@ return { end end, color = function() - if vim.g.pcode_codeium then + if pcode.codeium then local codeium = all_trim(vim.api.nvim_call_function("codeium#GetStatusString", {})) return { fg = codeium == "OFF" and "#3E4452" or "#50fa7b" } else @@ -164,13 +164,13 @@ return { padding = 1, separator = { left = " " }, fmt = function(str) - if vim.g.pcode_show_mode == 1 then + if pcode.show_mode == 1 then return icons.ui.Neovim .. " " .. (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 2 then + elseif pcode.show_mode == 2 then return icons.ui.Neovim - elseif vim.g.pcode_show_mode == 3 then + elseif pcode.show_mode == 3 then return (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 4 then + elseif pcode.show_mode == 4 then return nil else return icons.ui.Neovim .. " " .. str @@ -182,13 +182,13 @@ return { padding = 1, separator = { left = " ", right = "" }, fmt = function(str) - if vim.g.pcode_show_mode == 1 then + if pcode.show_mode == 1 then return icons.ui.Neovim .. " " .. (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 2 then + elseif pcode.show_mode == 2 then return icons.ui.Neovim - elseif vim.g.pcode_show_mode == 3 then + elseif pcode.show_mode == 3 then return (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 4 then + elseif pcode.show_mode == 4 then return nil else return icons.ui.Neovim .. " " .. str @@ -200,13 +200,13 @@ return { padding = 1, separator = { left = " ", right = "" }, fmt = function(str) - if vim.g.pcode_show_mode == 1 then + if pcode.show_mode == 1 then return icons.ui.Neovim .. " " .. (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 2 then + elseif pcode.show_mode == 2 then return icons.ui.Neovim - elseif vim.g.pcode_show_mode == 3 then + elseif pcode.show_mode == 3 then return (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 4 then + elseif pcode.show_mode == 4 then return nil else return icons.ui.Neovim .. " " .. str @@ -218,13 +218,13 @@ return { padding = 1, separator = { left = " ", right = "" }, fmt = function(str) - if vim.g.pcode_show_mode == 1 then + if pcode.show_mode == 1 then return icons.ui.Neovim .. " " .. (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 2 then + elseif pcode.show_mode == 2 then return icons.ui.Neovim - elseif vim.g.pcode_show_mode == 3 then + elseif pcode.show_mode == 3 then return (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 4 then + elseif pcode.show_mode == 4 then return nil else return icons.ui.Neovim .. " " .. str @@ -237,13 +237,13 @@ return { padding = 1, separator = { left = " " }, fmt = function(str) - if vim.g.pcode_show_mode == 1 then + if pcode.show_mode == 1 then return icons.ui.Neovim .. " " .. (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 2 then + elseif pcode.show_mode == 2 then return icons.ui.Neovim - elseif vim.g.pcode_show_mode == 3 then + elseif pcode.show_mode == 3 then return (mode_map[str] or str) - elseif vim.g.pcode_show_mode == 4 then + elseif pcode.show_mode == 4 then return nil else return icons.ui.Neovim .. " " .. str diff --git a/lua/user/utils/whichkey.lua b/lua/user/utils/whichkey.lua index fb1da30..d9377a7 100644 --- a/lua/user/utils/whichkey.lua +++ b/lua/user/utils/whichkey.lua @@ -278,11 +278,11 @@ M.mappings = { }, } -if vim.g.pcode_codeium then +if pcode.codeium then table.insert(M.mappings, { ["c"] = { ":call codeium#Chat()", "󰭹 Codeium Chat" } }) end -if vim.g.pcode_database then +if pcode.database then table.insert(M.mappings, { ["D"] = { name = " 󰆼 DBUI",