I mean, whenever I start and save files using gVim, have it know to save the files into my home directory.

This is annoying because each time I save any file using any program then I save it on Desktop first, and then categorize and move it to their specific folders.

While looking in my home directory, I can't see any hidden files named .vimrc or .gvimrc, instead I am seeing a .viminfo file. Which doesn't seem to have any preference information.

  • This is awfully VIM specific and has nothing to do with any operating system or Ubuntu specifically. You would be better served by examining the vim documentation, or, by switching to an editor that is a little easier to configure. BTW if .vimrc doesn't exist you just create it, again, if you just consulted the documentation, you wouldn't be crowd sourcing such an elementary question.
    – ppetraki
    May 24 '12 at 13:14

When you launch gvim, it uses your current directory as its current directory. You could change how you launch it by using a longer command or a small script like

cd $HOME
gvim "$@"

Or you set vim to always change its current directory by adding

cd $HOME/Desktop

to your .vimrc file.

  • When you launch gvim, it uses your current directory as its current directory. You are right, but I not always launch it from the terminal, sometime I launch it from launcher. And I have no .vimrc file, should I create it? May 24 '12 at 12:02
  • Creating a .vimrc file is fine; nothing bad will happen. You could also set the current directory on the launcher by changing the Command to 'gvim -c "cd $HOME/Desktop"', but I think you'll probably be happier with the .vimrc change.
    – khamer
    May 25 '12 at 12:52

Add following to your ~/.gvimrc (if empty create it):

cd ~/Desktop

It will change your default save location to your desktop. It will not affect the command line version (vim).

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.