Understand this sounds vary unsmart, but still ask here to learn vim way to do it.
let's say, we have your yanked the entire line in vim.( but the entire line only has few text ). now we would like to paste the text/entire line into some texts. where there are some other texts. ex:
hello world!
yanked text
we can yanked the entire line of "yanked text" by shift + v, then y. now we would like to paste the yanked text between hello world. as:
hello yanked text world!
Understand we could yanked the text only at the beginning instead of the entire line.
Q: after we yanked the entire line, then can we paste the yanked text between texts only? (instead of pasting the entire line) since yanking entire line seems much faster.
One option is to define new text objects:
The
iltext object will capture text on the line, minus any whitespace, whereas thealtext object will capture the whole line, including whitespace (but not the newline asyydoes:Then you can use
yilandpto insert it in the middle of some other line. doingyilordiletc. on the above, then moving the cursor (indicated in the example below by a^) to the middle of a different line of text:and pressing
pgives:and pressing
pgives: