chore(cleanup): removed or commented unused snippits or comments

This commit is contained in:
2026-07-25 18:28:16 +02:00
parent 3b4a464a94
commit 2c7d6acc04
8 changed files with 125 additions and 143 deletions
+110 -112
View File
@@ -1,116 +1,114 @@
local dap = require "dap" -- local dap = require "dap"
dap.adapters.python = function(cb, config) -- dap.adapters.python = function(cb, config)
if config.request == "attach" then -- if config.request == "attach" then
---@diagnostic disable-next-line: undefined-field -- local port = (config.connect or config).port
local port = (config.connect or config).port -- local host = (config.connect or config).host or "127.0.0.1"
---@diagnostic disable-next-line: undefined-field -- cb {
local host = (config.connect or config).host or "127.0.0.1" -- type = "server",
cb { -- port = assert(
type = "server", -- port,
port = assert( -- "`connect.port` is required for a python `attach` configuration"
port, -- ),
"`connect.port` is required for a python `attach` configuration" -- host = host,
), -- options = { source_filetype = "python" },
host = host, -- }
options = { source_filetype = "python" }, -- else
} -- cb {
else -- type = "executable",
cb { -- command = "path/to/virtualenvs/debugpy/bin/python",
type = "executable", -- args = { "-m", "debugpy.adapter" },
command = "path/to/virtualenvs/debugpy/bin/python", -- options = { source_filetype = "python" },
args = { "-m", "debugpy.adapter" }, -- }
options = { source_filetype = "python" }, -- end
} -- end
end
end
dap.configurations.python = {
{
-- The first three options are required by nvim-dap
type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
request = "launch",
name = "Launch file",
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
program = "${file}", -- This configuration will launch the current file if used.
pythonPath = function()
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
return cwd .. "/venv/bin/python"
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
return cwd .. "/.venv/bin/python"
else
return "/home/zach/miniconda3/bin/python"
end
end,
},
}
dap.adapters.lldb = {
type = "executable",
command = "/usr/bin/lldb-vscode", -- adjust as needed, must be absolute path
name = "lldb",
}
dap.configurations.cpp = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input(
"Path to executable: ",
vim.fn.getcwd() .. "/",
"file"
)
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
-- 💀
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
-- --
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope -- dap.configurations.python = {
-- {
-- -- The first three options are required by nvim-dap
-- type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
-- request = "launch",
-- name = "Launch file",
-- --
-- Otherwise you might get the following error: -- -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
-- --
-- Error on launch: Failed to attach to the target process -- program = "${file}", -- This configuration will launch the current file if used.
-- pythonPath = function()
-- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
-- local cwd = vim.fn.getcwd()
-- if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
-- return cwd .. "/venv/bin/python"
-- elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
-- return cwd .. "/.venv/bin/python"
-- else
-- return "/home/zach/miniconda3/bin/python"
-- end
-- end,
-- },
-- }
-- --
-- But you should be aware of the implications: -- dap.adapters.lldb = {
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html -- type = "executable",
-- runInTerminal = false, -- command = "/usr/bin/lldb-vscode", -- adjust as needed, must be absolute path
}, -- name = "lldb",
} -- }
--
dap.adapters["pwa-node"] = { -- dap.configurations.cpp = {
type = "server", -- {
host = "localhost", -- name = "Launch",
port = "${port}", -- type = "lldb",
executable = { -- request = "launch",
command = "node", -- program = function()
-- 💀 Make sure to update this path to point to your installation -- return vim.fn.input(
args = { -- "Path to executable: ",
"%HOME/.config/nvim/java-dap/js-debug/src/dapDebugServer.js", -- vim.fn.getcwd() .. "/",
"${port}", -- "file"
}, -- )
}, -- end,
} -- cwd = "${workspaceFolder}",
-- stopOnEntry = false,
dap.configurations.javascript = { -- args = {},
{ --
type = "pwa-node", -- -- 💀
request = "launch", -- -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
name = "Launch file", -- --
program = "${file}", -- -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
cwd = "${workspaceFolder}", -- --
}, -- -- Otherwise you might get the following error:
} -- --
-- -- Error on launch: Failed to attach to the target process
dap.configurations.java = { -- --
{ type = "java", name = "Debug", request = "launch", program = "${file}" }, -- -- But you should be aware of the implications:
} -- -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
-- -- runInTerminal = false,
-- },
-- }
--
-- dap.adapters["pwa-node"] = {
-- type = "server",
-- host = "localhost",
-- port = "${port}",
-- executable = {
-- command = "node",
-- -- 💀 Make sure to update this path to point to your installation
-- args = {
-- "%HOME/.config/nvim/java-dap/js-debug/src/dapDebugServer.js",
-- "${port}",
-- },
-- },
-- }
--
-- dap.configurations.javascript = {
-- {
-- type = "pwa-node",
-- request = "launch",
-- name = "Launch file",
-- program = "${file}",
-- cwd = "${workspaceFolder}",
-- },
-- }
--
-- dap.configurations.java = {
-- { type = "java", name = "Debug", request = "launch", program = "${file}" },
-- }
-2
View File
@@ -8,8 +8,6 @@ local highlight = {
"RainbowCyan", "RainbowCyan",
} }
local hooks = require "ibl.hooks" local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function() hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
+3 -9
View File
@@ -7,7 +7,6 @@ local function get_coc_lsp_client()
for _, client in pairs(clients) do for _, client in pairs(clients) do
if client["state"] == "running" then if client["state"] == "running" then
local client_name = client["id"] local client_name = client["id"]
-- Remove 'languageserver.' prefix if it exists
client_name = client_name:gsub("^languageserver%.", "") client_name = client_name:gsub("^languageserver%.", "")
return client_name return client_name
end end
@@ -21,7 +20,6 @@ local function spell()
return "" return ""
end end
--- show indicator for Chinese IME
local function ime_state() local function ime_state()
if vim.g.is_mac then if vim.g.is_mac then
local layout = local layout =
@@ -43,12 +41,10 @@ local diff = function()
local info = local info =
{ added = add_num, modified = modify_num, removed = remove_num } { added = add_num, modified = modify_num, removed = remove_num }
-- vim.print(info)
return info return info
end end
local virtual_env = function() local virtual_env = function()
-- only show virtual env for Python
if vim.bo.filetype ~= "python" then return "" end if vim.bo.filetype ~= "python" then return "" end
local conda_env = os.getenv "CONDA_DEFAULT_ENV" local conda_env = os.getenv "CONDA_DEFAULT_ENV"
@@ -81,10 +77,7 @@ require("lualine").setup {
lualine_b = { lualine_b = {
{ {
"branch", "branch",
fmt = function(name, _) fmt = function(name, _) return string.sub(name, 1, 20) end,
-- truncate branch name in case the name is too long
return string.sub(name, 1, 20)
end,
color = { gui = "italic,bold" }, color = { gui = "italic,bold" },
separator = { right = "" }, separator = { right = "" },
}, },
@@ -132,4 +125,5 @@ require("lualine").setup {
extensions = { "quickfix", "fugitive", "nvim-tree" }, extensions = { "quickfix", "fugitive", "nvim-tree" },
} }
vim.o.laststatus = 0 -- required for some reason -> avoid two bar lualine /w tmux -- also in options, but has to be here as well
vim.o.laststatus = 0;
-5
View File
@@ -21,8 +21,6 @@ require("notify").setup {
end, end,
} }
-- Utility functions shared between progress reports for LSP and DAP
local client_notifs = {} local client_notifs = {}
local function get_notif_data(client_id, token) local function get_notif_data(client_id, token)
@@ -63,9 +61,6 @@ local function format_message(message, percentage)
return (percentage and percentage .. "%\t" or "") .. (message or "") return (percentage and percentage .. "%\t" or "") .. (message or "")
end end
-- LSP integration
-- Make sure to also have the snippet with the common helper functions in your config!
vim.lsp.handlers["$/progress"] = function(_, result, ctx) vim.lsp.handlers["$/progress"] = function(_, result, ctx)
local client_id = ctx.client_id local client_id = ctx.client_id
-1
View File
@@ -1,4 +1,3 @@
-- Default options:
require("gruvbox").setup { require("gruvbox").setup {
terminal_colors = true, -- add neovim terminal colors terminal_colors = true, -- add neovim terminal colors
undercurl = true, undercurl = true,
-1
View File
@@ -1,2 +1 @@
-- Lua
require("onedarkpro").setup {} require("onedarkpro").setup {}
-1
View File
@@ -1,4 +1,3 @@
local time = tonumber(os.date "%H")
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/" vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/"