-
Notifications
You must be signed in to change notification settings - Fork 0
/
.neovim.lua
82 lines (74 loc) · 2.92 KB
/
.neovim.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
-- debuging should be like qt-creator
Plug('neovim/nvim-lspconfig')
Plug('williamboman/mason.nvim')
Plug('williamboman/mason-lspconfig.nvim')
Plug('mfussenegger/nvim-dap')
Plug('mfussenegger/nvim-dap-python')
Plug('nvim-neotest/nvim-nio')
Plug('rcarriga/nvim-dap-ui')
vim.api.nvim_set_keymap('n', 'å', ":lua require'dap'.toggle_breakpoint()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'ä', ":lua require'dap'.step_into()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'ö', ":lua require'dap'.step_over()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'æ', ":lua require'dap'.continue()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'ø', ":lua require'dapui'.toggle()<CR>", { noremap = true, silent = true })
-- See
-- https://sourceware.org/gdb/current/onlinedocs/gdb.html/Interpreters.html
-- https://sourceware.org/gdb/current/onlinedocs/gdb.html/Debugger-Adapter-Protocol.html
-- Require DAP and DAP-Python
local dap = require("dap")
require("dap-python").setup("python")
-- Python configuration
dap.configurations.python = {
{
-- The most basic Python configuration
name = "Launch file",
type = "python",
request = "launch",
program = "${file}", -- This will launch the current file
pythonPath = function()
local venv_path = vim.fn.getenv("VIRTUAL_ENV")
if venv_path and venv_path ~= vim.NIL and venv_path ~= '' then
return venv_path .. "/bin/python"
else
return "/usr/bin/python3" -- Fallback to system python
end
end,
args = function()
local input = vim.fn.input("Arguments: ")
return vim.split(input, " ", true)
end,
},
}
-- C++ configuration with GDB
dap.adapters.gdb = {
type = "executable",
command = "gdb", -- Ensure GDB is installed and available in your PATH
args = { "-i", "dap" }
}
dap.configurations.cpp = {
{
name = 'Launch executable (GDB)',
type = 'gdb',
request = 'launch',
program = '~/TombRaiderLinuxLauncher/TombRaiderLinuxLauncher',
stopOnEntry = false, -- or true if you want to stop at the beginning
cwd = '${workspaceFolder}',
setupCommands = {
{
text = '-enable-pretty-printing', -- Enable pretty-printing for gdb
description = 'enable pretty printing',
ignoreFailures = false
},
},
args = {}, -- Pass arguments to the executable
environment = {}, -- Set environment variables here
}
}
require("dapui").setup()
local nvim_lsp = require('lspconfig')
nvim_lsp.clangd.setup{}
require("mason").setup()
require("mason-lspconfig").setup()
vim.g.current_shiftwidth = 4
-- The style is meant to keep the code narrow, never let it over 80-100
-- With cpplint --filter=-whitespace/braces,-whitespace/newline