3

I know that the :oldfiles command will show you a history of the files you last had open; but how do I open the last n files in one command...for instance, say I want to open files 0-n in the :oldfiles list, is there a way to do that?

  • Note: Using :browse oldfiles will allow you to pick one from the list, but it doesn't open say the last n files. – leeand00 Jun 7 '17 at 3:09
4

The files listed by :oldfiles are also available as a list in v:oldfiles, so something like:

for f in v:oldfiles[:10]
    exec "badd" f
endfor

Using an appropriate value instead of 10, of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.