fix: transparant background

This commit is contained in:
asep komarudin 2024-02-24 22:58:09 +07:00
parent 38df56571a
commit 97dda35744
12 changed files with 37 additions and 370 deletions

View file

@ -1,134 +0,0 @@
-- more space in the neovim command line for displaying messages
-- use this function notation to build some variables
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
vim.opt_local.softtabstop = 4
vim.opt_local.ts = 4
vim.opt_local.expandtab = true
local status, jdtls = pcall(require, "jdtls")
if not status then
return
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
local function directory_exists(path)
local f = io.popen("cd " .. path)
local ff = f:read("*all")
if ff:find("ItemNotFoundException") then
return false
else
return true
end
end
local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" }
local root_dir = require("jdtls.setup").find_root(root_markers)
-- calculate workspace dir
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
local workspace_dir = vim.fn.stdpath("data") .. "/site/java/workspace-root/" .. project_name
if directory_exists(workspace_dir) then
else
os.execute("mkdir " .. workspace_dir)
end
-- get the mason install path
local install_path = require("mason-registry").get_package("jdtls"):get_install_path()
-- get the current OS
local os
if vim.fn.has("macunix") then
os = "mac"
elseif vim.fn.has("win32") then
os = "win"
else
os = "linux"
end
local bundles = {}
local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/")
vim.list_extend(bundles, vim.split(vim.fn.glob(mason_path .. "packages/java-test/extension/server/*.jar"), "\n"))
vim.list_extend(
bundles,
vim.split(
vim.fn.glob(mason_path .. "packages/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar"),
"\n"
)
)
local config = {
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",
"-javaagent:" .. install_path .. "/lombok.jar",
"-Xms1g",
"--add-modules=ALL-SYSTEM",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"-jar",
vim.fn.glob(install_path .. "/plugins/org.eclipse.equinox.launcher_*.jar"),
"-configuration",
install_path .. "/config_" .. os,
"-data",
workspace_dir,
},
capabilities = capabilities(),
root_dir = root_dir,
settings = {
java = {},
},
init_options = {
bundles = {
vim.fn.glob(
mason_path .. "packages/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar",
"\n"
),
},
},
}
config["on_attach"] = function(client, bufnr)
local _, _ = pcall(vim.lsp.codelens.refresh)
require("jdtls.dap").setup_dap_main_class_configs()
jdtls.setup_dap({ hotcodereplace = "auto" })
require("user.lsp.handlers").on_attach(client, bufnr)
end
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.java" },
callback = function()
local _, _ = pcall(vim.lsp.codelens.refresh)
end,
})
jdtls.start_or_attach(config)
vim.cmd(
[[command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime(<f-args>)]]
)

View file

@ -17,6 +17,7 @@ end
config = {
colorscheme = opt("colorscheme", "gruvbox-baby"),
transparent_mode = opt("transparent_mode", 0),
clear_lualine = opt("clear_lualine", 0),
progress = opt("progress", 2),
lualine_style = opt("lualine_style", 0),
status_icon = opt("status_icon", 0),

View file

@ -27,7 +27,7 @@ vim.g.pcode_colorscheme = "tokyonight"
-- nightfox
-- 0 =off 1= on
vim.g.pcode_transparent_mode = 1
vim.g.pcode_clear_lualine = 1
-- 0 disable progress
-- 1 lualine lsp progress
-- 2 fidget progress

View file

@ -1,35 +1,35 @@
return {
-- transparant config
-- {
-- "xiyaowong/transparent.nvim",
-- event = "BufWinEnter",
-- cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" },
-- config = function()
-- 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 Lualine
-- require("transparent").clear_prefix("Lualine")
-- require("transparent").setup({
-- extra_groups = {},
-- exclude_groups = {
-- -- disable active selection backgroun
-- "CursorLine",
-- "CursorLineNR",
-- "CursorLineSign",
-- "CursorLineFold",
-- -- disable nvimtree CursorLine
-- "NvimTreeCursorLine",
-- -- disable Neotree CursorLine
-- "NeoTreeCursorLine",
-- },
-- })
-- end,
-- },
{
"xiyaowong/transparent.nvim",
event = "BufWinEnter",
cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" },
config = function()
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 Lualine
require("transparent").clear_prefix("Lualine")
require("transparent").setup({
extra_groups = {},
exclude_groups = {
-- disable active selection backgroun
"CursorLine",
"CursorLineNR",
"CursorLineSign",
"CursorLineFold",
-- disable nvimtree CursorLine
"NvimTreeCursorLine",
-- disable Neotree CursorLine
"NeoTreeCursorLine",
},
})
end,
},
}

View file

@ -1,16 +0,0 @@
return {
"p00f/clangd_extensions.nvim",
dependencies = { "mason-lspconfig.nvim" },
event = "BufRead",
config = function()
require("clangd_extensions").setup({
server = {
on_attach = require("user.lsp.handlers").on_attach,
capabilities = {
offsetEncoding = "utf-8",
require("user.lsp.handlers").capabilities,
},
},
})
end,
}

View file

@ -1,10 +0,0 @@
return {
-- ini contoh override plugins
-- "rcarriga/nvim-dap-ui",
-- event = "BufWinEnter",
-- dependencies = "mfussenegger/nvim-dap",
-- enabled = vim.fn.has("win32") == 0,
-- config = function()
-- require("user.dapui")
-- end,
}

View file

@ -1,13 +0,0 @@
return {
"sigmasd/deno-nvim",
event = "BufRead",
dependencies = { "mason-lspconfig.nvim" },
config = function()
require("deno-nvim").setup({
server = {
on_attach = require("user.lsp.handlers").on_attach,
capabilities = require("user.lsp.handlers").capabilities,
},
})
end,
}

View file

@ -1,22 +0,0 @@
return {
"akinsho/flutter-tools.nvim",
dependencies = { "mason-lspconfig.nvim", "nvim-lua/plenary.nvim" },
event = "BufRead",
config = function()
require("flutter-tools").setup({
server = {
color = {
enabled = true,
},
settings = {
showTodos = true,
completeFunctionCalls = true,
},
on_attach = require("user.lsp.handlers").on_attach,
capabilities = {
require("user.lsp.handlers").capabilities,
},
},
})
end,
}

View file

@ -1,14 +0,0 @@
-- custom plugins disini
return {
{ "nvim-treesitter/nvim-treesitter" },
--- masukan plugin tambahan disini
{ "folke/trouble.nvim", enabled = false }, -- ini untuk disable plugin
-- contoh custom color scheme
-- {
-- "folke/tokyonight.nvim",
-- event = "BufWinEnter",
-- config = function()
-- vim.cmd([[colorscheme tokyonight-night]])
-- end,
-- },
}

View file

@ -1,107 +0,0 @@
return {
"simrat39/rust-tools.nvim",
event = "BufRead",
dependencies = {
"mason-lspconfig.nvim",
{
"saecki/crates.nvim",
tag = "v0.3.0",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("crates").setup({
null_ls = {
enabled = true,
name = "crates.nvim",
},
popup = {
border = "rounded",
},
})
end,
},
},
config = function()
local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/")
local codelldb_adapter = {
type = "server",
port = "${port}",
executable = {
command = mason_path .. "bin/codelldb",
args = { "--port", "${port}" },
-- On windows you may have to uncomment this:
-- detached = false,
},
}
local rt = require("rust-tools")
rt.setup({
tools = {
executor = require("rust-tools/executors").termopen, -- can be quickfix or termopen
reload_workspace_from_cargo_toml = true,
runnables = {
use_telescope = true,
},
inlay_hints = {
auto = true,
only_current_line = false,
show_parameter_hints = false,
parameter_hints_prefix = "<-",
other_hints_prefix = "=>",
max_len_align = false,
max_len_align_padding = 1,
right_align = false,
right_align_padding = 7,
highlight = "Comment",
},
hover_actions = {
border = "rounded",
},
on_initialized = function()
vim.api.nvim_create_autocmd({ "BufWritePost", "BufEnter", "CursorHold", "InsertLeave" }, {
pattern = { "*.rs" },
callback = function()
local _, _ = pcall(vim.lsp.codelens.refresh)
end,
})
end,
},
dap = {
adapter = codelldb_adapter,
},
server = {
on_attach = function(client, bufnr)
require("user.lsp.handlers").on_attach(client, bufnr)
local rt = require("rust-tools")
vim.keymap.set("n", "K", rt.hover_actions.hover_actions, { buffer = bufnr })
end,
capabilities = require("user.lsp.handlers").capabilities,
settings = {
["rust-analyzer"] = {
lens = {
enable = true,
},
checkOnSave = {
enable = true,
command = "clippy",
},
},
},
},
})
local dap = require("dap")
dap.adapters.codelldb = codelldb_adapter
dap.configurations.rust = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
},
}
vim.api.nvim_set_keymap("n", "<m-d>", "<cmd>RustOpenExternalDocs<Cr>", { noremap = true, silent = true })
end,
}

View file

@ -1,18 +0,0 @@
return {
"jose-elias-alvarez/typescript.nvim",
event = "BufRead",
dependencies = { "mason-lspconfig.nvim" },
config = function()
require("typescript").setup({
disable_commands = false, -- prevent the plugin from creating Vim commands
debug = false, -- enable debug logging for commands
go_to_source_definition = {
fallback = true, -- fall back to standard LSP definition on failure
},
server = { -- pass options to lspconfig's setup method
on_attach = require("user.lsp.handlers").on_attach,
capabilities = require("user.lsp.handlers").capabilities,
},
})
end,
}

View file

@ -240,9 +240,9 @@ if data_exists then
lsp_progress = lspprogress.progress
end
local transparent_mode = require("core.config").transparent_mode
if transparent_mode ~= nil then
if transparent_mode == 1 then
local clear_lualine = require("core.config").clear_lualine
if clear_lualine ~= nil then
if clear_lualine == 1 then
lualine.setup({
options = {
icons_enabled = true,