Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My system is gvim 7.4+xp+cygwin.

Everytime i open vim or cygwin,input pwd

pwd in cygwin to get :
/cygdrive/c/Documents and Settings/sy

I want to set the default directory /cygdrive/c/workspace
pwd in gvim to get :
c:/Documents and Settings/sy

I want to set the default directory c:/workspace
How can i make the setup in vim and cygwin?

1.i created a file named .bash_profile ,add two lines cd /cygdrive/c/workspace
echo "hallo world "

no effect at all.

2.i add cd /cygdrive/c/workspace in the file profile,the wrong output is : -bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
': not a valid identifier
-bash: $'\r': command not found
-bash: /etc/profile: line 104: syntax error near unexpected token $'\r''
'bash: /etc/profile: line 104:
profile_d ()
-bash-4.1$

share|improve this question
    
I do not understand what you are trying to do. Do you want the Cygwin terminal to start in the /cygdrive/c/workspace directory? You refer to both vim and gvim. Are you using the Cygwin or the Windows versions of vim and gvim? – garyjohn Dec 31 '13 at 7:12

For Cygwin, put

cd /cygdrive/c/workspace

in ~/.bash_profile.

Or, maybe what you want to do is to make /cygdrive/c/workspace your home directory; by default that's where a Cygwin shell will start. To do that, edit the entry for your user in /etc/passwd. Then restart the Cygwin shell.

For gvim, create a shortcut to start gvim, right-click on it, go to Properties..., then enter C:/workspace in the "Start in" field.

share|improve this answer
    
there is no .bash_profile in cygwin,how can i do? – it_is_a_literature Dec 31 '13 at 11:08
    
If you don't have one yet, create it. It goes in your home directory (which is what ~ means). – Andrew Schulman Dec 31 '13 at 11:16
    
I added a description of how to change your home directory - maybe better. – Andrew Schulman Dec 31 '13 at 11:18
    
i created a file named .bash_profile and add two lines cd /cygdrive/c/workspace and echo "hallo world " , no effect at all. – it_is_a_literature Dec 31 '13 at 11:38
    
If .bash_profile is in your home directory and bash is your shell, it will run it when it starts. – Andrew Schulman Dec 31 '13 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .