How to execute file that I\'m editing in Vi(m) and get output in split window (like in SciTE)?
Of course I could execute it like that:
:!scriptname
<
I have a shortcut for that in my vimrc:
nmap :w:silent !chmod 755 %:silent !./% > .tmp.xyz
\ :tabnew:r .tmp.xyz:silent !rm .tmp.xyz:redraw!
This writes the current buffer, makes the current file executable (unix only), executes it (unix only) and redirects the output to .tmp.xyz, then creates a new tab, reads the file and then deletes it.
Breaking it down:
:w write current buffer
:silent !chmod 755 % make file executable
:silent !./% > .tmp.xyz execute file, redirect output
:tabnew new tab
:r .tmp.xyz read file in new tab
:silent !rm .tmp.xyz remove file
:redraw! in terminal mode, vim get scrambled
this fixes it