My Neovim verion:
NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info
Installed rgrep
(This is for fuzzysearch file plugin)
Following by this tutorial: ThePrimeagen - 0 to LSP : Neovim RC From Scratch
Just add this line into the config in <your path>/lua/l3azh/set.lua
vim.opt.clipboard="unnamedplus"
Using this packeage Nvim-dap
Config for go
:
- Get package via
Packer
plugin:use 'mfussenegger/nvim-dap'
- Using
Mason
from theLSP-zero
plugin to install those packages:delve
(This package is required for debug),golangci-lint
,gopls
,gotests
- Creating a config and a adpater for dap-go:
<your path>/after/plugin/nvim_dap.lua
as following content:
local dap = require("dap")
dap.adapters.delve = {
type = 'server',
port = '${port}',
executable = {
command = 'dlv',
args = {'dap', '-l', '127.0.0.1:${port}'},
}
}
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
dap.configurations.go = {
{
type = "delve",
name = "Debug",
request = "launch",
program = "${file}"
},
{
type = "delve",
name = "Debug test", -- configuration for debugging test files
request = "launch",
mode = "test",
program = "${file}"
},
-- works with go.mod packages and sub packages
{
type = "delve",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}"
}
}
- Creating key-maping:
vim.keymap.set('n', '<F7>', function() require('dap').continue() end)
vim.keymap.set('n', '<F8>', function() require('dap').step_over() end)
vim.keymap.set('n', '<F9>', function() require('dap').step_into() end)
vim.keymap.set('n', '<F10>', function() require('dap').step_out() end)
vim.keymap.set('n', '<Leader>b', function() require('dap').toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>B', function() require('dap').set_breakpoint() end)
vim.keymap.set('n', '<F5>', function()
local widgets = require('dap.ui.widgets')
local my_sidebarsc = widgets.sidebar(widgets.scopes)
my_sidebarsc.open()
local my_sidebarsf = widgets.sidebar(widgets.frames)
my_sidebarsf.open()
end)
- Done - Formore detail please watch Debugging In Neovim (ft BashBunni) or read document on Nvim-dap