0

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$

1
  • 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, 2013 at 7:12

1 Answer 1

0

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.

5
  • there is no .bash_profile in cygwin,how can i do?
    – showkey
    Dec 31, 2013 at 11:08
  • If you don't have one yet, create it. It goes in your home directory (which is what ~ means). Dec 31, 2013 at 11:16
  • I added a description of how to change your home directory - maybe better. Dec 31, 2013 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.
    – showkey
    Dec 31, 2013 at 11:38
  • If .bash_profile is in your home directory and bash is your shell, it will run it when it starts. Dec 31, 2013 at 13:49

You must log in to answer this question.

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