Reputation:
Now, I'm using Linux and VI editor. During I use VI I have some problem. When I use block copy into the text, that texts are overwrited on the original text.
How do I block copy into the original text not overwrite in VI?
Upvotes: 4
Views: 1085
Reputation: 172638
If you've yanked a blockwise visual selection, pasting that will insert the block at the current position, into the existing text, without adding new lines or shifting existing text downwards. That's the expected behavior; you're effectively handling a square "cutout" of text, separate from the underlying text structure.
If you're handling complete line(s) (and based on your screenshot, you're doing just that), the correct approach is to select and yank the text linewise; i.e. use Shift + V instead of Ctrl + V for the selection (or [count]yy
in normal mode, which is faster if you know the number of lines).
If you really need to yank a square block, and paste this as new lines, there are the following approaches:
10o<Esc>`[
), then paste.:call setreg('', '', 'al')
glp
command that forces linewise pasting, regardless of how the text was yanked.Upvotes: 2
Reputation: 2096
In vi or vim editor you need to go in visual block mode from command mode using ctrl+v. before going to visual block mode move cursor to the block you want to copy. then press ctrl+v. and select your block.After selecting you just press single y for copy. Then move to cursor end of the file and press p to paste. Thats it.
Upvotes: 0