And here is another solution, probably not the most efficient one or the cleaner one but I had some time to make some vimscript:
function! PasteAtEndOfLine()
" Check that the selection is blockwise
if ( getregtype('"')[0] != '' )
echo "not blockwise"
return
endif
" Get the selection and split it on new lines
let regcontent = getreg('"')
let lines = split(regcontent, '\n')
" Save the cursor position and the current line
let save_cursor = getpos('.')
let line_number = save_cursor[1]
" For each line add the content of the register at the end
" And go to next line
for line in lines
execute "normal A" . line
let line_number += 1
call setpos('.', [0, line_number, 0, 0])
endfor
" Restore the initial position
call setpos('.', save_cursor)
endfunction
To use it you should:
- Visually select block wise the lines you want to paste from f2.txt: ctrl+vG
- Yank the text to the unnamed register: y
- Go to the first line of f1.txt
- Call the function:
:call PasteAtEndOfLine()
- You're done
:!paste -d '' f1.txt f2.txt
as an answer? ;):set virtualedit=all
, paste the column somewhere to the right, then:%s/,\s*//
. :)