diff options
| author | ZyX <kp-pav@yandex.ru> | 2017-11-19 22:05:22 +0300 |
|---|---|---|
| committer | ZyX <kp-pav@yandex.ru> | 2017-11-19 22:05:22 +0300 |
| commit | 03a129aacf7e4b77ceaccc71251ecb5bf41d2a8f (patch) | |
| tree | a3a05c99fe20de98aafbdea9314aa0d76f71aee9 /runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | |
| parent | 6ea3a08fdbb276fe64dda60c5fb934360327ed39 (diff) | |
| parent | de8b1fd1dee5a91b2893fccc53cfd11631ccba38 (diff) | |
| download | rneovim-03a129aacf7e4b77ceaccc71251ecb5bf41d2a8f.tar.gz rneovim-03a129aacf7e4b77ceaccc71251ecb5bf41d2a8f.tar.bz2 rneovim-03a129aacf7e4b77ceaccc71251ecb5bf41d2a8f.zip | |
Merge branch 'master' into expression-parser
Diffstat (limited to 'runtime/pack/dist/opt/termdebug/plugin/termdebug.vim')
| -rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim new file mode 100644 index 0000000000..b002cad4c6 --- /dev/null +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -0,0 +1,40 @@ +" Debugger commands. +" +" WORK IN PROGRESS - much doesn't work yet +" +" Open two terminal windows: +" 1. run a pty, as with ":term NONE" +" 2. run gdb, passing the pty +" The current window is used to edit source code and follows gdb. +" +" Author: Bram Moolenaar +" Copyright: Vim license applies + +" In case this gets loaded twice. +if exists(':Termdebug') + finish +endif + +command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>) + +if !exists('debugger') + let debugger = 'gdb' +endif + +func s:StartDebug(cmd) + " Open a terminal window without a job, to run the debugged program + let s:ptybuf = term_start('NONE', {}) + let pty = job_info(term_getjob(s:ptybuf))['tty'] + + " Open a terminal window to run the debugger. + let cmd = [g:debugger, '-tty', pty, a:cmd] + echomsg 'executing "' . join(cmd) . '"' + let gdbbuf = term_start(cmd, { + \ 'exit_cb': function('s:EndDebug'), + \ 'term_finish': 'close' + \ }) +endfunc + +func s:EndDebug(job, status) + exe 'bwipe! ' . s:ptybuf +endfunc |