all repos — dotfiles @ ea333c82d09f370b1a0a8e9a1f87e9570571043f

my *nix dotfiles

nvim/lua/dapx.lua (view raw)

  1local dap = require 'dap'
  2local dapui = require 'dapui'
  3
  4dap.set_log_level('INFO')
  5
  6dap.configurations.go = {
  7  {
  8    type = "go",
  9    name = "Debug",
 10    request = "launch",
 11    program = "${file}",
 12  },
 13}
 14
 15dap.adapters.go = {
 16  type = "server",
 17  port = "${port}",
 18  executable = {
 19    command = 'dlv',
 20    args = { "dap", "-l", "127.0.0.1:${port}" },
 21  },
 22}
 23
 24require 'dap-go'.setup {
 25  dap_configurations = {
 26    {
 27      type = "go",
 28      name = "Debug (main.go)",
 29      request = "launch",
 30      program = "${workspaceFolderBasename}/cmd/main.go",
 31    },
 32    {
 33      type = "go",
 34      name = "Debug (Build Flags & Arguments)",
 35      request = "launch",
 36      program = "${file}",
 37      args = require("dap-go").get_arguments,
 38      buildFlags = require("dap-go").get_build_flags,
 39    },
 40  },
 41}
 42
 43dapui.setup {
 44  controls = {
 45    element = "repl",
 46    enabled = true,
 47    icons = {
 48      disconnect = "",
 49      pause = "",
 50      play = "",
 51      run_last = "",
 52      step_back = "",
 53      step_into = "",
 54      step_out = "",
 55      step_over = "",
 56      terminate = ""
 57    }
 58  },
 59  expand_lines = false,
 60  icons = { expanded = "", collapsed = "" },
 61  mappings = {
 62    open = "o",
 63    remove = "d",
 64    edit = "e",
 65    repl = "r",
 66    toggle = "t",
 67  },
 68  layouts = {
 69    {
 70      elements = {
 71        "scopes",
 72        "repl",
 73      },
 74      size = 0.3,
 75      position = "bottom"
 76    },
 77    {
 78      elements = {
 79        "breakpoints"
 80      },
 81      size = 0.1,
 82      position = "left",
 83    },
 84  },
 85  floating = {
 86    max_height = nil,
 87    max_width = nil,
 88    border = "single",
 89    mappings = {
 90      close = { "q", "<Esc>" },
 91    },
 92  },
 93  windows = { indent = 1 },
 94  render = {
 95    max_type_length = nil,
 96  },
 97}
 98
 99dap.listeners.before.attach.dapui_config = function()
100  dapui.open()
101end
102dap.listeners.before.launch.dapui_config = function()
103  dapui.open()
104end
105--dap.listeners.before.event_terminated.dapui_config = function()
106--  dapui.close()
107--end
108dap.listeners.before.event_exited.dapui_config = function()
109  dapui.close()
110end
111
112vim.fn.sign_define('DapBreakpoint', {text = ''})
113
114require 'dapui.config.highlights'.setup()