However, g:MRU_File is only read at startup, and further changes are ignored. How about always reading the current value of this variable?
" Default to global MRU if no local mru found.
" Start with global MRU if local mru is empty.
" Add .mru to to .git/info/exclude (maybe best in the git template) to avoid clutter
let s:global_mru_file = g:MRU_File
function s:set_local_mru()
let s:local_mru_file = findfile('.mru', getcwd(-1)..';')
if empty(s:local_mru_file)
let s:local_mru_file = s:global_mru_file
elseif getfsize(s:local_mru_file) == 0 && exists('*filecopy')
call delete(s:local_mru_file)
call filecopy(s:global_mru_file, s:local_mru_file)
endif
let g:MRU_File = s:local_mru_file
endfunction
call s:set_local_mru()
" " " Reloading MRU is not respected by MRU plugin!
" " Make Sessions respect local MRU.
" " Since view session files do not set v:this_session and keep the global
" " current working directory, we skip those for reloading viminfo.
" let v:this_session = ''
" let s:last_session = ''
" autocmd vimrc SessionLoadPost *
" \ if v:this_session !=# s:last_session |
" \ let s:last_session = v:this_session | call s:set_local_mru() |
" \ endif
For what it's worth, similar to this snippet for project-local Viminfo here a snippet for a project-local MRU.
However,
g:MRU_File
is only read at startup, and further changes are ignored. How about always reading the current value of this variable?