Prerequirements

  • You know how to setup and configure neovim plugins.
  • You use UNIX-like OS

Step-by-Step guide

  1. Install the next neovim plugins
-- Example with packer.nvim 
use("mfussenegger/nvim-dap")
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
  1. Install vscode-lldb

    1. Download file specific to your system https://github.com/vadimcn/vscode-lldb/releases
    2. Unpack it by unzip utility. In my case I unpacked it to ~/Sources/lldb The result of execution unzip codelldb-x86_64-linux.vsix in ~/Sources/lldb: img
    3. codelldb execution file is available by path: ~/Sources/lldb/extension/adapter
  2. Configure nvim-dap in your init.lua

local dap = require("dap")

dap.adapters.codelldb = {
  type = 'server',
  port = "${port}",
  executable = {
    -- Change this to your path!
    command = '/home/kurotych/Sources/lldb/extension/adapter/codelldb',
    args = {"--port", "${port}"},
  }
}

dap.configurations.rust= {
  {
    name = "Launch file",
    type = "codelldb",
    request = "launch",
    program = function()
      return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
    end,
    cwd = '${workspaceFolder}',
    stopOnEntry = false,
  },
}

require("dapui").setup({})
  1. Open any rust program and execute in neovim command line :lua require("dap").toggle_breakpoint() where you can stop your program
    Screenshotimg
  2. Run :lua require("dap").continue() in neovim command line to start debugging
    Screenshotimg
  3. Run :lua require("dapui").open()
    Screenshotimg
    You can navigate through debug windows by mouse.
    Execte :lua require("dapui").close() - to close all debug windows

Keybindings

local dap = require('dap')
vim.keymap.set('n', '<F5>', function() dap.continue() end)
vim.keymap.set('n', '<F10>', function() dap.step_over() end)
vim.keymap.set('n', '<F11>', function() dap.step_into() end)
vim.keymap.set('n', '<F12>', function() dap.step_out() end)
vim.keymap.set('n', '<Leader>b', function() dap.toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>dl', function() dap.run_last() end)
vim.keymap.set('n', '<Leader>df', function() require("dapui").float_element('scopes', { enter = true }) end)

Additional info

You can find at plugins repositories nvim-dap and nvim-dap-ui

dapui float_element Screenshotimg