Workaround issues loading session files
ftplugins as ordinary plugins are only loaded once. Though restoring sessions seems to arise issues with the 'tagfunc'.
it is recorded in the session as:
set tagfunc=s:cpptagfuncbut using it resolves the actual scriptname. for example:
:function /cpp
function <snr>80_cpptagfuncbut after restoring a session a mismatch happens. By using :tag or :tsel it complains that <snr>80_cpptagfunc no longer exists and:
:function /cpp
function <snr>84_cpptagfuncthat is, the ftpluing was reloaded but 'tagfunc' keeps pointing to the old one.
Fixing this is relatively easy. no longer reference a script function but a global one. in this case I define the function in an autoload/cpptags.vim script. By doing so:
set tagfunc=cpptags#cpptagfuncand no mismatch is possible.