0

Right now, all my vim files that I create are stored in C:\Users\dinosauce33 (My user). How do I change it so that all of my files that I create are stored in documents?

2
1

Vim saves unnamed files in the current directory. If you did not change it, the current directory is the one whence Vim was started, C:\Users\dinosauce33 in your case.

Thus, you just need is to add cd C:\Users\dinosauce33\documents to your .vimrc file to change the directory to the documents directory whenever Vim is started.

4
  • 1
    But, maybe only :cd if pwd() is# expand('~')?
    – D. Ben Knoble
    Nov 29 '20 at 23:09
  • Hi @D.BenKnoble, Wouldn't only :cd result in the home directory, C:\Users\dinosauce33?
    – Quasímodo
    Nov 30 '20 at 12:35
  • I omitted the documents argument for brevity; otherwise you are correct. My point was this might bite OP in the long run when they dont want to be in documents all the time. The conditional would make it so it only happens when started from home, but even then I think that’s going to cause problems if OP ever wants to actually edit files there.
    – D. Ben Knoble
    Nov 30 '20 at 14:29
  • 1
    @D.BenKnoble Oh, sorry, I failed to notice what you had meant. That's a valid concern, but I think that shortcoming is intrinsic to the question.
    – Quasímodo
    Nov 30 '20 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.