Configuring gVim for windows

I am trying to get gVim to work on a Windows 7 machine and I am having the following problems:

  • Whenever I try to modify the _vimrc file, I get a message stating that I do not have permission to save to this place. This is on my home pc.

  • I cannot change the directory in which the files I edit are saved. At the moment, they are all saved on my desktop. I tried: set dir = path to where I want to save ... without success.

I wanted to go through vimtutor; however, whenever I type vimtutor in cmd, vim starts blinking and then closes.

How do I change the _vimrc file and how do I set the destination for the edited files?

+3
source share
2 answers

I cannot change the directory in which the files I edit are saved. At the moment, they are all saved on my desktop. I tried: set dir = path to where I want to save ... without success.

dir - , , Vim .

cd lcd, . :help cd Vim .

_vimrc ?

_vimrc Vim ($ VIM), , Vim Windows, .

+2

, -. .

  • , vim vim vim. %PROGRAMFILES% %PROGRAMFILES(x86)%.
  • my vim (OS X, Linux, Windows). .vim .vimrc.
  • cygwin, - . , cygwin, .vim _vimrc %USERPROFILE%. cygwin .vim _vimrc cygwin.
  • %HOME% OOTB, . , setx.exe ...
    • : setx HOME %USERPROFILE% setx HOME d:\cygwin\home\myname
    • .
  • . / .vim _vimrc %HOME%. git . mlink /d %HOME%\.vim location_of_vim_folder .vim. mlink /h %HOME%\_vimrc location_of_dot_vimrc_file, .vimrc _vimrc.
  • : %HOME%, ... . ( , %PROGRAMFILES% %PROGRAMFILES(x86)%
  • vimrc :

    "g:my_vim_dir is used elsewhere in my vim configurations
    let g:my_vim_dir=expand("$HOME/.vim")
    
    "$HOME/.vim and $HOME/.vim/after are in the &rtp on unix
    "But on windows, they need to be added.
    if has("win16") || has("win32") || has("win64")
      "add g:my_vim_dir to the front of the runtimepath
       execute "set rtp^=".g:my_vim_dir
      "add g:my_vim_dir\after to the end of the runtimepath
      execute "set rtp+=".g:my_vim_dir."\\after"
      "Note, pathogen#infect() looks for the 'bundle' folder in each path
      "of the &rtp, where the last dir in the '&rtp path' is not 'after'. The
      "<path>\bundle\*\after folders will be added if and only if
      "the corresponding <path>\after folder is in the &rtp before
      "pathogen#infect() is called.  So it is very important to add the above
      "'after' folder.
      "(This applies to vim plugins such as snipmate, tabularize, etc.. that
      " are loaded by pathogen (and perhaps vundle too.))
    
      " Not necessary, but I like to cleanup &rtp to use \ instead of /
      " when on windows machines
      let &rtp=substitute(&rtp,"[/]","\\","g")
    
      "On windows, if called from cygwin or msys, the shell needs to be changed 
      "to cmd.exe to work with certain plugins that expect cmd.exe on windows versions   
      "of vim.
      if &shell=~#'bash$'
        set shell=$COMSPEC " sets shell to correct path for cmd.exe
      endif
    endif
    
    "Then I load pathogen... (Or if you prefer, you could load vundle bundles here if you wish )
    
+11

All Articles