0

:source Session.vim causes some noise. Within (Neo)Vim I can simply run :silent exec "source Session.vim" to silence it, but how can I silence vim -S when I load my session from the command line?

I tried to do vim +silent exec "source Session.vim", but it actually opens a buffer called source Session.vim instead.

1 Answer 1

2

This works:

vim +silent\ exec\ \"source\ Session.vim\"

Maybe there is a more elegant way. EDIT: Yes there is in the comments, thanks a lot for commenting.

3
  • 4
    That exec is useless. $ vim +sil\ so\ Session.vim is enough. But the real solution would be to make sure that your session file is clean.
    – romainl
    Commented Mar 15, 2023 at 8:14
  • 2
    Also, $vim +'sil so Session.vim' or $vim +"sil so Session.vim" so you don't need the backslash escapes for the spaces. Feel free to update your answer to include the alternatives.
    – filbranden
    Commented Mar 15, 2023 at 14:47
  • 1
    @filbranden I figured vim +'sil! so Session.vim' is perfect as it won't even throw an error when the file does not exist yet. Commented Jan 15 at 10:15

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.