Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
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

2 Answers 2

up vote 2 down vote accepted

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

#!/bin/sh
cd $HOME
gvim "$@"

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

cd $HOME/Desktop

to your .vimrc file.

share|improve this answer
    
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? –  Santosh Kumar 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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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