I want to automate something I started using.
Short story is I have a file with some lines and I want to execute each line every now and then and see its' output, but I don't want it to override the contents of the buffer containing the commands. Instead, I rather store it in a new buffer/tab so that when I close everything nothing is stored.
I did something with mktemp, but I want to use vim's internal capabilities.
My workflow is currently as follows:
- select the command I want to execute (example:
ping 8.8.8.8
) - execute
:tabnew | r! <YANKED TEXT>
where I get<YANKED TEXT>
from usingctrl+r
Output is stored in a new tab, but I want to automate it, preferably using vmap <somekey>
somehow to be able to press a key to evaluate a command and see its' output in a new buffer/tab.
I don't know how to mimic what I currently do to a vmap
binding. I tried vmap <F2> tabnew | r! @"
which failed (probably for some obvious reason).
Nice to have:
- I don't want to use plugins for this, seems simple enough to accomplish.
- I don't want to write complex vimscripts.
- I want to understand each step.
Pointers to what to read to accomplish this would be great as well.