Add function to print a command output to the buffer

This commit is contained in:
Rane Brown 2019-12-21 09:10:39 -07:00
parent 7ad0ad36dc
commit f18bb6bc57

View File

@ -67,8 +67,20 @@ Before (Define functions):
" Write current file: helper to hide `set bt=` " Write current file: helper to hide `set bt=`
function! WriteMe() function! WriteMe()
set bt= set buftype=
write % write %
endfunction endfunction
" print a command output to the buffer
function! PrintCommand(cmd)
redir => message
silent execute a:cmd
redir END
if empty(message)
Log 'no output'
else
silent put=message
endif
endfunction
# vim: ft=vim # vim: ft=vim