This commit is contained in:
Oliver Hartmann 2022-08-31 10:56:40 +02:00
commit bf80f95a9a
2 changed files with 53 additions and 27 deletions

View File

@ -18,33 +18,57 @@ vim.keymap.set('n', '<S-F11>', ":lua require('dap').step_out()<CR>", opts)
-- detached = true; -- detached = true;
-- }; -- };
-- } -- }
-- dap.configurations.python = { local dap, dapui = require("dap"), require("dapui")
-- { dap.listeners.after.event_initialized["dapui_config"] = function()
-- -- The first three options are required by nvim-dap dapui.open()
-- type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python` end
-- request = 'launch'; dap.listeners.before.event_terminated["dapui_config"] = function()
-- name = "Launch file"; dapui.close()
-- end
-- -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options dap.listeners.before.event_exited["dapui_config"] = function()
-- dapui.close()
-- program = "${file}"; -- This configuration will launch the current file if used. end
-- 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. local function getVenvSuffix()
-- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable. if vim.loop.os_uname().sysname == 'Linux' then
-- local venv = os.getenv("VIRTUAL_ENV") return 'bin/python'
-- return string.format("%s\\bin\\python.exe",venv) elseif vim.loop.os_uname().sysname == 'Windows_NT' then
-- -- local cwd = vim.fn.getcwd() return 'Scripts/python.exe'
-- -- if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then end
-- -- return cwd .. '/venv/bin/python' end
-- -- elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
-- -- return cwd .. '/.venv/bin/python' function getPythonEnv()
-- -- else
-- -- return '/usr/bin/python' local venv = os.getenv("VIRTUAL_ENV")
-- -- end if venv ~= nil then
-- end; return string.format("%s\\bin\\python.exe",venv)
-- }, end
-- }
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/' .. getVenvSuffix()) == 1 then
return cwd .. '/venv/' .. getVenvSuffix()
elseif vim.fn.executable(cwd .. '/.venv/' .. getVenvSuffix()) == 1 then
return cwd .. '/.venv/' .. getVenvSuffix()
else
if vim.loop.os_uname().sysname == 'Linux' then
return '/usr/bin/python'
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
return os.getenv('SCOOP') .. '/apps/python/current/python.exe'
end
end
end
dap.configurations.python = {
{
type = 'python';
request = 'launch';
name = "Launch file with venv";
justMyCode = false;
program = "${file}";
pythonPath = getPythonEnv();
},
}
require('dap-python').setup('C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python') require('dap-python').setup('C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python')
table.insert(require('dap').configurations.python, { table.insert(require('dap').configurations.python, {

View File

@ -1,2 +1,4 @@
vim.g.gruvbox_baby_telescope_theme = 1 vim.g.gruvbox_baby_telescope_theme = 1
local colors = require("gruvbox-baby.colors").config()
vim.g.gruvbox_baby_highlights = {Visual = {bg = '#384741'}}
vim.cmd[[colorscheme gruvbox-baby]] vim.cmd[[colorscheme gruvbox-baby]]