xolox / vim-session

Extended session management for Vim (:mksession on steroids)
http://peterodding.com/code/vim/session/
961 stars 80 forks source link

Provide a single autocommand after session is loaded #141

Closed blueyed closed 8 years ago

blueyed commented 8 years ago

There is SessionLoadPost already, but it gets executed for each buffer/window.

I would like to have a callback to adjust settings according to the loaded session, e.g. viminfo / shada (Neovim), but dislike the overhead of it being called X times.

mMontu commented 8 years ago

What about disabling the autocmd on the first execution?

  augroup MySessionLoadPost
    autocmd!
    au SessionLoadPost * call SessionLoadPostSettings()
  augroup END

  function! SessionLoadPostSettings()
     " my settings (...)
     au! MySessionLoadPost
  endfunction
blueyed commented 8 years ago

@mMontu Good idea, thanks!