2

Vim's TermDebug is brilliant. A real game changer for my development workflow.

My only problem with it is that I often have multiple separate gvim windows running, with different sources in each (maybe one has the code I'm writing, and another has the tests for that code). When debugging with TermDebug the source window will open new files as needed. But if that file is already being edited in another Gvim window I get the VIM -ATTENTION Swap file ".foo.cpp.swap" already exists! dialog and have to confirm I want to open it.

I don't usually need to edit those sources if I'm just stepping through a stack frame before getting to the code I actually want to debug. So is there any way to tell TermDebug to open new source files readonly by default, so I don't get that dialog?

i.e. can I tell TermDebug to use view to open files in the Source window, instead of using edit?

Or can I get TermDebug to set autocmd SwapExists * let v:swapchoice = "o" temporarily while I'm debugging, then reset it afterwards?

If this isn't currently possible I might have to go digging through the code ...

Edit: I tried adding this to my vimrc:

au User TermdebugStartPre augroup jw_termdebug<CR>autocmd SwapExists * let v:swapchoice = "o"<CR>augroup END<CR>
au User TermdebugStopPost autocmd! jw_termdebug

But it doesn't seem to work.

New contributor
Jonathan Wakely is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2

Your Answer

Jonathan Wakely is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.