diff --git a/lua/plugins.lua b/lua/plugins.lua index ca04052..23bcf19 100755 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -206,42 +206,14 @@ return require("packer").startup({function() after = "friendly-snippets" } + -- DAP, debugger use { "mfussenegger/nvim-dap", + event = "BufRead", } use { "Pocco81/DAPInstall.nvim", - cmd = { - "lua require'dap'.continue()", - "lua require'dap'.run()", - "lua require'dap'.run_last()", - "lua require'dap'.launch()", - "lua require'dap'.terminate()", - "lua require'dap'.disconnect()", - "lua require'dap'.close()", - "lua require'dap'.attach()", - "lua require'dap'.set_breakpoint()", - "lua require'dap'.toggle_breakpoint()", - "lua require'dap'.list_breakpoints()", - "lua require'dap'.set_exception_breakpoints()", - "lua require'dap'.step_over()", - "lua require'dap'.step_into()", - "lua require'dap'.step_out()", - "lua require'dap'.step_back()", - "lua require'dap'.pause()", - "lua require'dap'.reverse_continue()", - "lua require'dap'.up()", - "lua require'dap'.down()", - "lua require'dap'.run_to_cursor()", - "lua require'dap'.repl.open()", - "lua require'dap'.repl.toggle()", - "lua require'dap'.repl.close()", - "lua require'dap'.set_log_level()", - "lua require'dap'.session()", - "DIInstall", - "DIUninstall", - "DIList", - }, + after = "nvim-dap" } use { "rcarriga/nvim-dap-ui", @@ -250,7 +222,6 @@ return require("packer").startup({function() require("plugins/dap") end } - -- Code formatter. use { "sbdchd/neoformat", diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 254e5d0..646198f 100755 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,3 +1,9 @@ + +local present, dap = pcall(require, "dap") +if not present then + return +end + -- dap-install configurations local dap_install = require("dap-install") dap_install.setup { @@ -12,50 +18,11 @@ end -- dap-ui configurations -require("dapui").setup({ - icons = { expanded = "▾", collapsed = "▸" }, - mappings = { - -- Use a table to apply multiple mappings - expand = { "", "<2-LeftMouse>" }, - open = "o", - remove = "d", - edit = "e", - repl = "r", - }, - sidebar = { - -- You can change the order of elements in the sidebar - elements = { - -- Provide as ID strings or tables with "id" and "size" keys - { - id = "scopes", - size = 0.25, -- Can be float or integer > 1 - }, - { id = "breakpoints", size = 0.25 }, - { id = "stacks", size = 0.25 }, - { id = "watches", size = 00.25 }, - }, - size = 40, - position = "left", -- Can be "left", "right", "top", "bottom" - }, - tray = { - elements = { "repl" }, - size = 10, - position = "bottom", -- Can be "left", "right", "top", "bottom" - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = "single", -- Border style. Can be "single", "double" or "rounded" - mappings = { - close = { "q", "" }, - }, - }, - windows = { indent = 1 }, -}) +require("dapui").setup({}) - -vim.fn.sign_define('DapBreakpoint', {text='●', texthl='', linehl='', numhl=''}) - - -local dap = require('dap') dap.defaults.fallback.terminal_win_cmd = 'ToggleTerm' +vim.fn.sign_define('DapBreakpoint', {text='● ', texthl='DiagnosticSignError', linehl='', numhl=''}) +vim.fn.sign_define('DapBreakpointCondition', {text='● ', texthl='DiagnosticSignWarn', linehl='', numhl=''}) +vim.fn.sign_define('DapLogPoint', {text='● ', texthl='DiagnosticSignInfo', linehl='', numhl=''}) +vim.fn.sign_define('DapStopped', {text='→ ', texthl='DiagnosticSignWarn', linehl='', numhl=''}) +vim.fn.sign_define('DapBreakpointReject', {text='●' , texthl='DiagnosticSignHint', linehl='', numhl=''})