diff options
author | Blubber <f2005278@mvrht.com> | 2016-10-26 00:34:58 +0200 |
---|---|---|
committer | Blubber <f2005278@mvrht.com> | 2016-10-26 00:34:58 +0200 |
commit | dd0521705dd9d534f7905594423b05953fbba545 (patch) | |
tree | cc8fbf4973869bb6826795ba3951481a2f847946 | |
parent | 6a95f364778f4281b7b927578a9f516fbf059ac2 (diff) | |
download | dotfiles-dd0521705dd9d534f7905594423b05953fbba545.tar.gz dotfiles-dd0521705dd9d534f7905594423b05953fbba545.zip |
created branch to develop AsyncCmdProcessor for vim8+
-rw-r--r-- | vimrc | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -348,3 +348,41 @@ command! -nargs=* SCons call TriggerSCons(<f-args>) "endif "}}} +"{{{ Sandbox +let s:sandbox_enable = 1 +if s:sandbox_enable + function! StdOutCB(job, message) + endfunction + + function! JobExitCB(job, status) + "unlet g:stdout_buffer + "unlet g:stderr_buffer + "execute 'cbuffer ' . g:stderr_buffer + endfunction + + " TODO: need to debug why stdout_buffer/stdout_buffer are not shown + " and why output is not correctly written to these buffers?! + " when running AsyncCmdProcessor, line 1 of currently open buffer is overwritten + function! AsyncCmdProcessor(cmd) + let l:current_buffer = bufnr('') + " create & delete buffer for stdout + let g:stdout_buffer = bufnr('stdout_buffer', 1) + execute g:stdout_buffer . 'bufdo %d' + " create & delete buffer for stderr + let g:stderr_buffer = bufnr('stderr_buffer', 1) + execute g:stderr_buffer . 'bufdo %d' + + "execute 'sbuffer' . g:stdout_buffer + + " switch to current buffer + execute 'b ' . l:current_buffer + + let job = job_start(a:cmd, { 'out_io': 'buffer', + \ 'out_name': 'stdout_buffer', + \ 'out_cb': 'StdOutCB', + \ 'err_io': 'buffer', + \ 'err_name': 'stderr_buffer', + \ 'exit_cb': 'JobExitCB'}) + endfunction +endif +"}}} |