9

I want to know when I should call RestoreSession() function and when not. Because when I open single file, I don't want to see my project's files, which i save to vim session before.

For example if I call vim like this: vim -n test.rb. How me to detect n key in vimrc? (I want use n key as something like custom indicator for my purpose)

It's all, small question :-)

2 Answers 2

10

In private conversation, @Nicklasos suggest me another way how to do what I need - using argv() function. It is just:

if argc() == 0
  autocmd VimEnter * call RestoreSess()
end
Sign up to request clarification or add additional context in comments.

1 Comment

@Nicklasos upvoted answer that indirectly credits to you.
2

You can run vim with -c key (Execute command upon startup)

vim -c RestoreSession foo.txt

Also, you can write bash alias.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.