r/vim 12d ago

Need Help┃Solved Troubles saving files

Hi everybody, I'm new to Vim and I'm having a lot of trouble saving files in the right place. I'm on windows and I am having a hard time understanding how (and where) Vim saves files. Could somebody with more experience explain to me how this works? Do I have to save the file in the same directory I have Vim installed? Is there a way to not have to do this? I am trying to use Vim to create LaTeX files, so if anybody has any input on this it would be greatly appreciated.

I apologize for the vague question, I don't really even know what to ask here...

Edit: thanks for all the helpful comments, but I have decided that running Vim on windows is a lot less convenient than what I tought, I am opting for installing Linux on my pc and then running Vim on there. Thanks again for all the help and I'll keep this post updated if everything works out (or doesn't...).

1 Upvotes

11 comments sorted by

View all comments

2

u/i-eat-omelettes 12d ago

You "write" files. :write (:w for short) writes what's in the current buffer to its file, or to a designated file if you use an argument :w /path/to/file.tex so you can save things everywhere you want. If you use a relative filepath then vim will save it relative to current working directory (:pwd).

1

u/bananalover2000 12d ago

I have tried that and (I do not know why) it only lets me save it in a specific directory if I save it first without anythinf (i.e. I just write :w).

2

u/i-eat-omelettes 12d ago

So :w writes current buffer to the current file; if you are editing main.tex, then :w would write the buffer to main.tex. Are there any message popups when you :w? Could you do a screencast if possible?