سؤال

Normally, I am using <shift-v> and <up(or)down> to select some lines of code in vim. Then I use <y-y> to yank the lines. Then, I do <p> for pasting the code at the desired location.

I used this step for a long time and had no issues. Recently, I started noticing that when I yank more than 10 lines and paste them, only 2 of the lines are pasted.

What could be the reason for this? If anybody knows alternate ways of selecting multiple lines, yanking and pasting it, please let me know.

هل كانت مفيدة؟

المحلول

I have never seen where lines get lost when I paste them. However, when you use visual mode (shift-v), usually you only need the first "y" to yank lines. It's likely that when you press the second "y" and move down, you are actually yanking the top two lines (which is what is supposed to happen). You probably just need to stop pressing "y" twice. (Hint: press "y" once in visual mode, or twice when you want to yank the current line in normal mode).

You can yank multiple lines in a variety of other ways. For example, 14yy will yank 14 lines. If you use gvim, you can use the mouse cursor to select text. You can also do y14j to yank the next fourteen lines, since y, followed by a movement command, copies everything in that movement command.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top