bqu*_*i56 4 permissions vim windows-7
我试图让gVim在Windows 7机器上工作,并且遇到以下问题:
每当我尝试更改_vimrc文件时,我都会收到一条消息,说我无权保存在此位置.这是我的家用电脑顺便说一句.
我似乎无法更改保存我编辑的文件的目录.目前他们都被保存到我的桌面.我尝试过:将dir = path设置为我要保存的位置......但没有成功.
我想通过vimtutor; 但是,每当我将vimtutor键入cmd时,vim会打开一秒钟然后关闭.
如何更改_vimrc文件以及如何为编辑的文件设置目标?
dar*_*ker 11
我发现许多人以不同的方式做到了.这是我在Windows上组织配置的方式.
%PROGRAMFILES%或%PROGRAMFILES(x86)%..vim文件夹和一个.vimrc文件中..vim文件夹和我的_vimrc文件放入%USERPROFILE%.在使用cygwin的那些,我把我的.vim文件夹和我的_vimrc文件放在我的cygwin用户的主目录中.%HOME%在Windows OOTB上没有定义,所以我定义它.我觉得setx.exe很容易......
setx HOME %USERPROFILE%或setx HOME d:\cygwin\home\myname.vim文件夹和_vimrc文件%HOME%.但是我喜欢把它们放在我机器上其他地方的git repo中并链接到它们.在Windows上,我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,我有一些用于windows的锅炉板材:
"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 )
Run Code Online (Sandbox Code Playgroud)我似乎无法更改保存我编辑的文件的目录。目前它们都被保存到我的桌面上。我尝试 :set dir=path 到我想要保存的位置...但没有成功。
dir是交换文件的位置,交换文件是 Vim 在运行时使用的特殊支持文件。
您想要的是cd或lcd更改当前目录。:help cd在 Vim 中输入以获取更多信息。
如何更改 _vimrc 文件以及如何设置编辑文件的目标位置?
我的 Vim 文件夹 ($VIM) 中有 _vimrc,所以当我想将 Vim 放在新的 Windows 机器上时,我只需复制整个文件夹即可。