generated from 2KAbhishek/bare-minimum
-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdap.lua
107 lines (98 loc) · 2.55 KB
/
dap.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
local dap = require('dap')
local dapui = require('dapui')
local icons = require('lib.icons')
dapui.setup({
icons = { expanded = icons.ui.ArrowClosed, collapsed = icons.ui.ArrowOpen },
mappings = {
expand = { '<CR>', '<2-LeftMouse>' },
open = 'o',
remove = 'd',
edit = 'e',
repl = 'r',
toggle = 't',
},
expand_lines = vim.fn.has('nvim-0.7'),
layouts = {
{
elements = {
{ id = 'scopes', size = 0.25 },
'breakpoints',
'stacks',
'watches',
},
size = 40,
position = 'right',
},
{
elements = {
'repl',
'console',
},
size = 0.25,
position = 'bottom',
},
},
floating = {
max_height = nil,
max_width = nil,
border = 'rounded',
mappings = {
close = { 'q', '<Esc>' },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil,
},
})
vim.fn.sign_define('DapBreakpoint', { text = icons.ui.Bug, texthl = 'DiagnosticSignError', linehl = '', numhl = '' })
dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open()
end
dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close()
end
dap.listeners.before.event_exited['dapui_config'] = function()
dapui.close()
end
dap.adapters.python = {
type = 'executable',
command = '/usr/bin/python',
args = { '-m', 'debugpy.adapter' },
}
dap.configurations.python = {
{
type = 'python',
request = 'launch',
name = 'Launch file',
program = '${file}',
pythonPath = function()
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 '/usr/bin/python'
end
end,
},
}
dap.adapters.ruby = {
type = 'executable',
command = 'bundle',
args = { 'exec', 'readapt', 'stdio' },
}
dap.configurations.ruby = {
{
type = 'ruby',
request = 'launch',
name = 'Rails',
program = 'bundle',
programArgs = { 'exec', 'rails', 's' },
useBundler = true,
},
}
vim.api.nvim_create_user_command('DapUIToggle', function()
require('dapui').toggle()
end, {})