问题
I am having some trouble with VIM on windows, and I was wondering if anyone could be of assistance. As of right now, I am trying to make it so that when VIM starts, it changes it's working directory to one besides the default (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Vim 7.3)
. The way I am going about this is adding in cd $HOME\Desktop\VimFiles
, where $HOME
is C:\Users\Alphabet
(Alphabet is the name of my account).
The issue I am running into right now is that after opening up _vimrc
and adding in the line stated above, I cannot save the file, even when forcing it (with w!). I was wondering why this is and how I can go about fixing this. As an added note, I am running this in GVIM.
Note: I have attempted to do the same thing in VIM, and am able to edit the _vimrc file fine, but when I go to it's location and open it with GVIM or Notepad++, the "cd" line doesn't show up. Is there a reason for this?
Any help is appreciated. Thank you!
回答1:
It looks like you are trying to write a file in a protected directory without the proper privileges.
In Vim, :echo $HOME
tells you where you are supposed to put your _vimrc
. In your case, your _vimrc
should be C:\Users\Alphabet\_vimrc
and you should put your plugins and whatnot in C:\Users\Alphabet\vimfile\
.
Never touch system files!
来源:https://stackoverflow.com/questions/16495326/editing-vimrc-in-windows