I haven't been able to find documentation on how vim knows if register contents came from a linewise-selection vs characterwise or blockwise selection.
For example, given the text below:
Hello there my name is Markus
and I went to the store to buy
bananas and motor oil
If I select the first line in linewise visual mode, yank it to a specific register, and save the register contents to a file, the register contents are only what I had selected:
Now, if I then reload the unnamed register (@"
) with the contents of /tmp/output.txt
, and paste it, it pastes as if I had selected it in characterwise or blockwise visual mode:
I have to assume that vim is tracking how register contents are set, and that if it is done directly from a yank/cut/delete/etc., it saves which visual mode it was done in.
That being said, how exactly does that work? I'm working on a plugin, and I'd like to be able to tell vim to paste text as if they were originally copied in linewise or characterwise visual mode.