mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Add nvim-dap
This commit is contained in:
parent
dce7dd58d0
commit
a4ad2c7026
24
home/.config/nvim/lua/pluginconf/nvim-dap.lua
Normal file
24
home/.config/nvim/lua/pluginconf/nvim-dap.lua
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
local vim = require("vim")
|
||||||
|
local cmd = vim.cmd
|
||||||
|
|
||||||
|
-- Define dap mappings (:help dap-mapping)
|
||||||
|
local prefix = ":lua require('dap')."
|
||||||
|
Keymap("n", "<F5>", prefix .. "continue()<CR>")
|
||||||
|
Keymap("n", "<F10>", prefix .. "step_over()<CR>")
|
||||||
|
Keymap("n", "<F11>", prefix .. "step_into()<CR>")
|
||||||
|
Keymap("n", "<leader><F11>", prefix .. "step_out()<CR>")
|
||||||
|
Keymap("n", "<F9>", prefix .. "toggle_breakpoint()<CR>")
|
||||||
|
Keymap("n", "<leader><F9>", prefix .. "set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>")
|
||||||
|
Keymap("n", "<F8>", prefix .. "set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>")
|
||||||
|
Keymap("n", "<leader>di", prefix .. "repl.open()<CR>")
|
||||||
|
Keymap("n", "<leader>dl", prefix .. "run_last()<CR>")
|
||||||
|
|
||||||
|
-- Setup dap for python (requires nvim-dap-python plugin)
|
||||||
|
require('dap-python').setup('/usr/bin/python') -- Path to python with `debugpy` library installed
|
||||||
|
require('dap-python').test_runner = 'pytest' -- Use pytest to run unit tests
|
||||||
|
|
||||||
|
-- Python mappings
|
||||||
|
local pyprefix = ":lua require('dap-python')."
|
||||||
|
Keymap("n", "<leader>dptm", pyprefix .. "test_method()<CR>")
|
||||||
|
Keymap("n", "<leader>dptc", pyprefix .. "test_class()<CR>")
|
||||||
|
Keymap("v", "<leader>ds", "<ESC>" .. pyprefix .. "debug_selection()<CR>")
|
|
@ -85,6 +85,11 @@ return require("packer").startup({
|
||||||
"tpope/vim-commentary",
|
"tpope/vim-commentary",
|
||||||
config = get_plugin_file("commentary.lua")
|
config = get_plugin_file("commentary.lua")
|
||||||
})
|
})
|
||||||
|
use({
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
config = get_plugin_file("nvim-dap.lua"),
|
||||||
|
requires = { "mfussenegger/nvim-dap-python", opt = true },
|
||||||
|
})
|
||||||
use({
|
use({
|
||||||
"junegunn/fzf",
|
"junegunn/fzf",
|
||||||
run = function() fn['fzf#install']() end,
|
run = function() fn['fzf#install']() end,
|
||||||
|
|
Loading…
Reference in a new issue