Upon writing a code, sometimes I open a terminal split with :term
to test it by issuing some commands and checking some output. As an example, this is a fragment of what I have executed in a split terminal:
...
I$[12:38]~/Stack>cat file
time;area;temperature;pumpmotor;diameter
1;2;3;4;5
6;7;8;9;10
I$[12:38]~/Stack>awk -f measurements.awk file
I$[12:38]~/Stack>cat *.csv
time,area,diameter
1,2,5
6,7,10
...
Now, I wish to copy that that snippet and paste it on my browser (for an answer in Stack :)), so what I usually do is
C-W N
Put the terminal in "text-mode";- Position the cursor in the last line I want to copy, in this case
6,7,10
; V
Start visual mode and go up to the first line I want to copy,I$[12:38]~/Stack>cat file
;"+y
Yank the selection to clipboard.
That does the job as expected, but the prompt is distracting and useless, thus I want to reduce it to I$
(ideally it would shrink to $
, but that would add still more complexity to the task and I prefer to drop it). But since that is a terminal, I cannot modify it with :'<,'>s/\[.*>/ /
between steps 3 and 4 to get rid of the prompt before yanking.
Is there some easy intermediate step to sanitize the prompt without resorting to copy the terminal contents to an additional ordinary buffer? In case I were not clear, the clipboard should contain:
I$ cat file
time;area;temperature;pumpmotor;diameter
1;2;3;4;5
6;7;8;9;10
I$ awk -f measurements.awk file
I$ cat *.csv
time,area,diameter
1,2,5
6,7,10