@@ -948,6 +948,104 @@ require('lazy').setup({
948948 --
949949 -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
950950 -- { import = 'custom.plugins' },
951+ {
952+ ' mfussenegger/nvim-dap' ,
953+ recommended = true ,
954+ desc = ' Debugging support. Requires language specific adapters to be configured. (see lang extras)' ,
955+
956+ dependencies = {
957+ ' rcarriga/nvim-dap-ui' ,
958+ ' nvim-neotest/nvim-nio' ,
959+ -- virtual text for the debugger
960+ {
961+ ' theHamsta/nvim-dap-virtual-text' ,
962+ opts = {},
963+ },
964+ },
965+
966+ -- stylua: ignore
967+ keys = {
968+ { " <leader>dB" , function () require (" dap" ).set_breakpoint (vim .fn .input (' Breakpoint condition: ' )) end , desc = " Breakpoint Condition" },
969+ { " <F9>" , function () require (" dap" ).toggle_breakpoint () end , desc = " Toggle Breakpoint" },
970+ { " <F5>" , function () require (" dap" ).continue () end , desc = " Run/Continue" },
971+ { " <leader>da" , function () require (" dap" ).continue ({ before = get_args }) end , desc = " Run with Args" },
972+ { " <leader>dC" , function () require (" dap" ).run_to_cursor () end , desc = " Run to Cursor" },
973+ { " <leader>dg" , function () require (" dap" ).goto_ () end , desc = " Go to Line (No Execute)" },
974+ { " <F11>" , function () require (" dap" ).step_into () end , desc = " Step Into" },
975+ { " <leader>dj" , function () require (" dap" ).down () end , desc = " Down" },
976+ { " <leader>dk" , function () require (" dap" ).up () end , desc = " Up" },
977+ { " <leader>dl" , function () require (" dap" ).run_last () end , desc = " Run Last" },
978+ { " <S-F11>" , function () require (" dap" ).step_out () end , desc = " Step Out" },
979+ { " <F10>" , function () require (" dap" ).step_over () end , desc = " Step Over" },
980+ { " <leader>dP" , function () require (" dap" ).pause () end , desc = " Pause" },
981+ { " <leader>dr" , function () require (" dap" ).repl .toggle () end , desc = " Toggle REPL" },
982+ { " <leader>ds" , function () require (" dap" ).session () end , desc = " Session" },
983+ { " <S-F5>" , function () require (" dap" ).terminate () end , desc = " Terminate" },
984+ { " <leader>dw" , function () require (" dap.ui.widgets" ).hover () end , desc = " Widgets" },
985+ },
986+ },
987+ {
988+ ' rcarriga/nvim-dap-ui' ,
989+ dependencies = { ' nvim-neotest/nvim-nio' },
990+ -- stylua: ignore
991+ keys = {
992+ { " <leader>du" , function () require (" dapui" ).toggle ({ }) end , desc = " Dap UI" },
993+ { " <leader>de" , function () require (" dapui" ).eval () end , desc = " Eval" , mode = {" n" , " v" } },
994+ },
995+ opts = {},
996+ config = function (_ , opts )
997+ local dap = require ' dap'
998+ local mason_registry = require ' mason-registry'
999+ local codelldb = mason_registry .get_package ' codelldb'
1000+ local ext_path = codelldb :get_install_path () .. ' /extension/'
1001+ local codelldb_path = ext_path .. ' adapter/codelldb'
1002+ local liblldb_path = ext_path .. ' lldb/lib/liblldb.dylib'
1003+ local dapui = require ' dapui'
1004+ dapui .setup (opts )
1005+ dap .listeners .after .event_initialized [' dapui_config' ] = function ()
1006+ dapui .open {}
1007+ end
1008+ dap .listeners .before .event_terminated [' dapui_config' ] = function ()
1009+ dapui .close {}
1010+ end
1011+ dap .listeners .before .event_exited [' dapui_config' ] = function ()
1012+ dapui .close {}
1013+ end
1014+ dap .adapters .lldb = {
1015+ type = ' executable' ,
1016+ command = codelldb_path , -- adjust as needed, must be absolute path
1017+ name = ' lldb' ,
1018+ }
1019+
1020+ dap .adapters .cpp = {
1021+ type = ' executable' ,
1022+ attach = {
1023+ pidProperty = ' pid' ,
1024+ pidSelect = ' ask' ,
1025+ },
1026+ command = codelldb_path ,
1027+ env = {
1028+ LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = ' YES' ,
1029+ },
1030+ name = ' lldb' ,
1031+ }
1032+
1033+ dap .configurations .cpp = {
1034+ {
1035+ name = ' lldb' ,
1036+ type = ' cpp' ,
1037+ request = ' launch' ,
1038+ program = function ()
1039+ return vim .fn .input (' Path to executable: ' , vim .fn .getcwd () .. ' /Binaries/App/App.exe' , ' file' )
1040+ end ,
1041+ cwd = ' ${workspaceFolder}' ,
1042+ externalTerminal = false ,
1043+ stopOnEntry = false ,
1044+ args = {},
1045+ },
1046+ }
1047+ end ,
1048+ },
9511049 --
9521050 -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
9531051 -- Or use telescope!
@@ -992,5 +1090,7 @@ require('telescope').setup {
9921090 },
9931091 },
9941092}
1093+ vim .fn .sign_define (' DapBreakpoint' , { text = ' 🛑' , texthl = ' ' , linehl = ' ' , numhl = ' ' })
1094+ vim .keymap .set (' n' , ' <leader>rn' , vim .lsp .buf .rename , {})
9951095-- The line beneath this is called `modeline`. See `:help modeline`
9961096-- vim: ts=2 sts=2 sw=2 et
0 commit comments