diff --git a/lua/config/dap.lua b/lua/config/dap.lua index 2b41683..6cabfe6 100644 --- a/lua/config/dap.lua +++ b/lua/config/dap.lua @@ -1,116 +1,114 @@ -local dap = require "dap" -dap.adapters.python = function(cb, config) - if config.request == "attach" then - ---@diagnostic disable-next-line: undefined-field - local port = (config.connect or config).port - ---@diagnostic disable-next-line: undefined-field - local host = (config.connect or config).host or "127.0.0.1" - cb { - type = "server", - port = assert( - port, - "`connect.port` is required for a python `attach` configuration" - ), - host = host, - options = { source_filetype = "python" }, - } - else - cb { - type = "executable", - command = "path/to/virtualenvs/debugpy/bin/python", - args = { "-m", "debugpy.adapter" }, - options = { source_filetype = "python" }, - } - 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 - -- - -- Otherwise you might get the following error: - -- - -- Error on launch: Failed to attach to the target process - -- - -- 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}" }, -} +-- local dap = require "dap" +-- dap.adapters.python = function(cb, config) +-- if config.request == "attach" then +-- local port = (config.connect or config).port +-- local host = (config.connect or config).host or "127.0.0.1" +-- cb { +-- type = "server", +-- port = assert( +-- port, +-- "`connect.port` is required for a python `attach` configuration" +-- ), +-- host = host, +-- options = { source_filetype = "python" }, +-- } +-- else +-- cb { +-- type = "executable", +-- command = "path/to/virtualenvs/debugpy/bin/python", +-- args = { "-m", "debugpy.adapter" }, +-- options = { source_filetype = "python" }, +-- } +-- 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 +-- -- +-- -- Otherwise you might get the following error: +-- -- +-- -- Error on launch: Failed to attach to the target process +-- -- +-- -- 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}" }, +-- } diff --git a/lua/config/indent-blankline.lua b/lua/config/indent-blankline.lua index 0aa1a03..3a4bfdd 100644 --- a/lua/config/indent-blankline.lua +++ b/lua/config/indent-blankline.lua @@ -8,8 +8,6 @@ local highlight = { "RainbowCyan", } 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() vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) diff --git a/lua/config/inlay-hints.lua b/lua/config/inlay-hints.lua index f649c7f..9bea549 100644 --- a/lua/config/inlay-hints.lua +++ b/lua/config/inlay-hints.lua @@ -127,13 +127,13 @@ vim.lsp.config("jdtls", { }) vim.lsp.config("phpactor", { - settings = { - language_server_worse_reflection = { - inlay_hints = { - enable = true, -- Master switch - types = true, -- Variable type hints - params = true, -- Parameter name hints - }, + settings = { + language_server_worse_reflection = { + inlay_hints = { + enable = true, -- Master switch + types = true, -- Variable type hints + params = true, -- Parameter name hints + }, + }, }, - }, }) diff --git a/lua/config/lualine.lua b/lua/config/lualine.lua index 973aeba..11ea172 100644 --- a/lua/config/lualine.lua +++ b/lua/config/lualine.lua @@ -7,7 +7,6 @@ local function get_coc_lsp_client() for _, client in pairs(clients) do if client["state"] == "running" then local client_name = client["id"] - -- Remove 'languageserver.' prefix if it exists client_name = client_name:gsub("^languageserver%.", "") return client_name end @@ -21,7 +20,6 @@ local function spell() return "" end ---- show indicator for Chinese IME local function ime_state() if vim.g.is_mac then local layout = @@ -43,12 +41,10 @@ local diff = function() local info = { added = add_num, modified = modify_num, removed = remove_num } - -- vim.print(info) return info end local virtual_env = function() - -- only show virtual env for Python if vim.bo.filetype ~= "python" then return "" end local conda_env = os.getenv "CONDA_DEFAULT_ENV" @@ -81,10 +77,7 @@ require("lualine").setup { lualine_b = { { "branch", - fmt = function(name, _) - -- truncate branch name in case the name is too long - return string.sub(name, 1, 20) - end, + fmt = function(name, _) return string.sub(name, 1, 20) end, color = { gui = "italic,bold" }, separator = { right = "" }, }, @@ -132,4 +125,5 @@ require("lualine").setup { 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; diff --git a/lua/config/notify.lua b/lua/config/notify.lua index 8ddf99d..712506d 100644 --- a/lua/config/notify.lua +++ b/lua/config/notify.lua @@ -21,8 +21,6 @@ require("notify").setup { end, } --- Utility functions shared between progress reports for LSP and DAP - local client_notifs = {} 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 "") 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) local client_id = ctx.client_id diff --git a/lua/config/themedark.lua b/lua/config/themedark.lua index f05f6c1..e6622d8 100644 --- a/lua/config/themedark.lua +++ b/lua/config/themedark.lua @@ -1,4 +1,3 @@ --- Default options: require("gruvbox").setup { terminal_colors = true, -- add neovim terminal colors undercurl = true, diff --git a/lua/config/themelight.lua b/lua/config/themelight.lua index d1ab089..d756180 100644 --- a/lua/config/themelight.lua +++ b/lua/config/themelight.lua @@ -1,2 +1 @@ --- Lua require("onedarkpro").setup {} diff --git a/lua/globals.lua b/lua/globals.lua index 0fc4544..f420615 100644 --- a/lua/globals.lua +++ b/lua/globals.lua @@ -1,4 +1,3 @@ -local time = tonumber(os.date "%H") vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/"