I just couldn't think of a quick way to take a subset of a file, where some # of lines had been randomly deleted. Since VIM doesn't have its own random() command you have to turn to some external method of determining which lines to delete. My solution was ruby:
:ruby VIM.command(String(rand(VIM::Buffer.current.count-1)+1) +"|d")
To repeat the command several times I couldn't think of anything better than a macro recording:
:let @l=':ruby VIM.command(String(rand(VIM::Buffer.current.count-1)+1) +"|d")^M'
Where '^M' is really Control-J cariage return. Then to do it...uh, 30,000 times I just typed 30000@l
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment