1

I've noticed that VIM "forgets" last edited line after some time. Sometimes when I open a file that I haven't been editing since a few days (maybe 3 and more) and type '. in normal mode I'll get the error at the bottom:

E20: Mark not set

Is it a normal VIM behavior? If not, how can I force it to "remember" the last edited line forever? Using

VIM - Vi IMproved 9.0
3
  • 1
    Could you tell us what is your viminfo setting (:set viminfo?)? Jul 1, 2023 at 13:07
  • Do you still have the problem? Jul 2, 2023 at 8:01
  • The output of it is viminfo='100,<50,s10,h
    – ka3ak
    Jul 2, 2023 at 16:57

1 Answer 1

1

I believe that the information is saved in the .viminfo file.

The number of files/buffers for which the marks are stored is controlled by the ' section of the viminfo setting.

To set it to a maximum of 500 files/buffers you can use the following command:

:set viminfo^='500

More information about the viminfo setting with: :help 'viminfo'.

When the number of files/buffers exceed that limit the information from the old files/buffer is removed from the .viminfo file and you get the message you mentioned.

2
  • Thank you. I've set it to 500. If it were 100 before I can imagine that it wasn't enough according to such an algorithm as I edit lots of files. However most of them are forgettable. What I need is probably to force VIM to remember last edited position forever at least of the files in the saved session... So that they are excluded from this rotation. However I don't know whether VIM supports such a setting.
    – ka3ak
    Jul 2, 2023 at 17:01
  • Thanks for the feedback :-) If it solve your problem you can accept the answer using the v button next to the arrow voting buttons. It allow the question to rest ;-) Jul 2, 2023 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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