diff --git a/README.md b/README.md index 65b87c7..b706d2d 100644 --- a/README.md +++ b/README.md @@ -360,6 +360,8 @@ or simply put your cursor in a struct and do | GoDebug -s | stop debug session and unmap debug keymap | | GoDbgKeys | show debug keymaps in a floating window (guihua) | | GoBreakToggle | GoDebug -b | +| GoDbgStop | Same as GoDebug -s | +| GoDbgContinue | Continue debug session | | BreakCondition | conditional break | Notes: @@ -573,6 +575,7 @@ require('go').setup({ dap_debug = true, -- set to false to disable dap dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua -- false: do not use keymap in go/dap.lua. you must define your own. + -- windows: use visual studio keymap dap_debug_gui = true, -- set to true to enable dap gui, highly recommand dap_debug_vt = true, -- set to true to enable dap virtual text build_tags = "tag1,tag2", -- set default build tags diff --git a/doc/go.txt b/doc/go.txt index 925b587..cf3c6b3 100644 --- a/doc/go.txt +++ b/doc/go.txt @@ -269,6 +269,12 @@ COMMANDS *go-nvim-commands* :GoDbgKeys *:GoDbgKeys* Display keymaps for debuger +:GoDbgStop *:GoDbgStop* + Stop debug session and unmap all keymaps, same as GoDebug -s + +:GoDbgContinue *:GoDbgStop* + Continue debug session, keymap `c` + :GoCreateLaunch *:GoCreateLaunch* Create alaunch.json @@ -338,6 +344,7 @@ You can setup go.nvim with following options: dap_debug_gui = true, dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua -- false: do not use keymap in go/dap.lua. you must define your own. + -- windows: use visual studio style of keymap dap_vt = true, -- false, true and 'all frames' textobjects = true, gopls_cmd = nil, --- you can provide gopls path and cmd if it not in PATH, e.g. cmd = { "/home/ray/.local/nvim/data/lspinstall/go/gopls" } diff --git a/lua/go.lua b/lua/go.lua index 94ac7f0..139e84b 100644 --- a/lua/go.lua +++ b/lua/go.lua @@ -229,7 +229,8 @@ function go.setup(cfg) vim.cmd([[command! DapUiFloat lua require("dapui").float_element()]]) vim.cmd([[command! DapUiToggle lua require("dapui").toggle()]]) - vim.cmd([[command! GoDbgStop lua require'go.dap'.stop()]]) + vim.cmd([[command! GoDbgStop lua require'go.dap'.stop(true)]]) + vim.cmd([[command! GoDbgContinue lua require'dap'.continue()]]) end require("go.project").load_project() diff --git a/lua/go/dap.lua b/lua/go/dap.lua index c996351..6371663 100644 --- a/lua/go/dap.lua +++ b/lua/go/dap.lua @@ -141,6 +141,7 @@ function M.debug_keys() }) end + local close_events = { "CursorMoved", "CursorMovedI", "BufHidden", "InsertCharPre" } local config = { close_events = close_events, focusable = true, border = "single" } vim.lsp.util.open_floating_preview(keymap_help, "lua", config) diff --git a/lua/go/term.lua b/lua/go/term.lua index 72980d3..10509f9 100644 --- a/lua/go/term.lua +++ b/lua/go/term.lua @@ -48,10 +48,16 @@ local term = function(opts) if opts.autoclose == nil then opts.autoclose = true end + -- run in neovim shell + if type(opts.cmd) == "table" then + opts.cmd = table.concat(opts.cmd, " ") + end + + utils.log(opts) local buf, win, closer = guihua_term.floating_term(opts) api.nvim_command("setlocal nobuflisted") api.nvim_buf_set_var(cur_buf, "go_float_terminal_win", { buf, win }) - + api.nvim_buf_set_var(cur_buf, "shellcmdflag", "shell-unquoting") return buf, win, closer end