1

If :mksession or vim -S is used without a filename parameter a default file Session.vim is used. This can be very convenient.

I wonder if there is a way to change this default filename to something different (e.g. .session.vim?

My usecase would simply be to make this file a bit more unobtrusive when placed in a projects directory.

3
  • 1
    You can supply non-default filename parameter as you wish. But you can't change app default without recompiling it from source code. Is this what's your question about?
    – Matt
    Commented May 10, 2022 at 13:30
  • My question is about changing the app default.
    – Paidhi
    Commented May 10, 2022 at 13:40
  • A builtin command cannot be altered. Create your own command instead, for example.
    – Matt
    Commented May 10, 2022 at 14:50

1 Answer 1

3

Fortunately it is relatively easy to compile vim to use a different name if desired: edit src/feature.h to change

#define SESSION_FILE    "Session.vim"

to whatever name you want. Then recompile as normal.


For the curious, I found this in my clone of the vim source with git grep Session.vim '*[ch]'.

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.