Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use :browse oldfiles command to open recent files quickly. The list becomes very long with time -- I have 100 items in the list and need to tap space to complete this action. I want to reduce this list or show only last 10-20 items.

  • How to set the limit for the history of opened files?
share|improve this question
up vote 8 down vote accepted

:browse oldfiles and :oldfiles read from the viminfo file, so changing the maximum number of previously edited files to be remembered in the 'viminfo' option should work. You can do this by changing the number after the ' character in the viminfo option.

For example, doing :set viminfo='50 would mean that only 50 old files are remembered.

However, this will overwrite everything currently set in the the 'viminfo' option, so make sure to set the other desired options as well. For example, doing :set viminfo='50,<50,s10,h would also mean that the maximum number of lines saved for each register would be 50, the maximum size of saved items is 10 KB and the effect of 'hlsearch' is disabled when loading the viminfo file.

For more on this topic, see :help 'viminfo'.

NOTE: You may need to wipe your viminfo file before the change will take effect, since all of your old files past your max number will be remembered still.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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