I am not sure this is a solution, as this might have too many nasty side effects. But one way to reset lost marks, is to re-read the viminfo file.
So after you have accidentally pressed ma
, you can issue :rviminfo!
to re-read the viminfo file. The !
causes it to overwrite all marks, registers, command-line histories, search history... from the current session (so this solution might not work all the time).
In fact, it should be possible to edit the viminfo file, just keeping the marks section, save it as a temporary file and then using :rviminfo! temp_viminfo_with_marks
to just restore the marks for each particular file.