all repos — dotfiles @ 0a867ad2e58c21d31f0ce106ab5812a152c6b83f

my *nix dotfiles

nvim/lua/dapx.lua (view raw)

 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
local dap = require 'dap'
local dapui = require 'dapui'

dap.set_log_level('INFO')

dap.configurations.go = {
  {
    type = "go",
    name = "Debug",
    request = "launch",
    program = "${file}",
  },
}

dap.adapters.go = {
  type = "server",
  port = "${port}",
  executable = {
    command = 'dlv',
    args = { "dap", "-l", "127.0.0.1:${port}" },
  },
}

require 'dap-go'.setup {
  dap_configurations = {
    {
      type = "go",
      name = "Debug (main.go)",
      request = "launch",
      program = "${workspaceFolderBasename}/cmd/main.go",
    },
  },
}

dapui.setup {
  controls = {
    element = "repl",
    enabled = true,
    icons = {
      disconnect = "■",
      pause = "",
      play = "▶",
      run_last = "≪",
      step_back = "←",
      step_into = "↓",
      step_out = "↑",
      step_over = "→",
      terminate = "✗"
    }
  },
  expand_lines = false,
  icons = { expanded = "▾", collapsed = "▸" },
  mappings = {
    open = "o",
    remove = "d",
    edit = "e",
    repl = "r",
    toggle = "t",
  },
  layouts = {
    {
      elements = {
        "scopes",
        "repl",
      },
      size = 0.3,
      position = "bottom"
    },
    {
      elements = {
        "breakpoints"
      },
      size = 0.1,
      position = "left",
    },
  },
  floating = {
    max_height = nil,
    max_width = nil,
    border = "single",
    mappings = {
      close = { "q", "<Esc>" },
    },
  },
  windows = { indent = 1 },
  render = {
    max_type_length = nil,
  },
}

dap.listeners.before.attach.dapui_config = function()
  dapui.open()
end
dap.listeners.before.launch.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

vim.fn.sign_define('DapBreakpoint', {text = '•'})

require 'dapui.config.highlights'.setup()