I got a file that looks like this:
G:\some_folder
file1.avi
file2.wav
E:\some_folder2
fileABC.avi
fileDEF.wav
I would like to transfer the file into:
G:\some_folder
G:\some_folder file1.avi
G:\some_folder file2.wav
E:\some_folder2
E:\some_folder2 fileABC.avi
E:\some_folder2 fileDEF.wav
So in other words this might work like this:
look for ^[A-Z]:
copy whole line and add it at the beginning to next lines till you find ^[A-Z]:
is it possible to do that in VIM? If yes, how.
thank you Radek
I would iterate over all lines with :global
; Vim will position the cursor on the beginning of each line. Depending on which kind of line it is, I'd either yank the folder path, or paste it in front:
:%g/^/execute 'normal!' getline('.') =~ '^\S' ? 'y$' : 'P'