문제

im trying to copy 300 lines from one file to another, in source file i type "300yy", it says it has yanked 300 lines.

go to destination file and press p, it pastes, but only the first 50 lines.

any idea why it isn't pasting the 300?

도움이 되었습니까?

해결책

As suggested in Vim Tips Wiki, you can adjust the viminfo setting:

:set viminfo?
:set viminfo='100,<1000,s100,h

What the individual bits mean:

  • '100 Marks will be remembered for the last 100 edited files.
  • <1000 Limits the number of lines saved for each register to 1000 lines; if a register contains more than 1000 lines, only the first 1000 lines are saved.
  • s100 Registers with more than 100 KB of text are skipped.
  • h Disables search highlighting when Vim starts.

다른 팁

As Eugene and Zyx said adjusting your viminfo would be the easiest solution

:set viminfo-=<50,s10

An alternate solution would be use :read and/or :write

To read in from file-name.txt into the current buffer

:read file-name.txt

To append the range of line 1 to line 300 from the current buffer to file-to-append.txt

:1,300write >> file-to-append.txt

You can also use marks instead of line numbers such as the visual marks

:'<,'>write >> file-to-append.txt

Of course appending may not be able to fulfill your use case in which the viminfo changes will probably work best.

:help :write
:help :read
:help 'viminfo'
:help :set-=

Stay in the same session (open the new file doing :e path) and you won't have any limitation.

try vim -p file1 file2. It opens each file into a new tab (which is awesome), and it solves the copy/paste limit

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top