2013-05-08 53 views
0

对我来说,我认为下面的话:

$VIMRUNTIME='C:/Program Files (x86)/Vim/vim73' 

但是,如果我看在PC的环境变量(通过电脑>属性等),我看不到这条路径 - 我应该手动添加它吗?

_vimrc目前看起来如下:

set nocompatible 
source $VIMRUNTIME/vimrc_example.vim 
source $VIMRUNTIME/mswin.vim 
behave mswin 

set diffexpr=MyDiff() 

" Use CTRL-S for saving, also in Insert mode 
:nnoremap <C-S>  :<C-U>update<CR> 
:vnoremap <C-S>  :<C-U>update<CR>gv 
:cnoremap <C-S>  <C-C>:update<CR> 
:inoremap <C-S>  <C-O>:update<CR> 

function MyDiff() 
    let opt = '-a --binary ' 
    if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif 
    if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif 
    let arg1 = v:fname_in 
    if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif 
    let arg2 = v:fname_new 
    if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif 
    let arg3 = v:fname_out 
    if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif 
    let eq = '' 
    if $VIMRUNTIME =~ ' ' 
    if &sh =~ '\<cmd' 
     let cmd = '""' . $VIMRUNTIME . '\diff"' 
     let eq = '"' 
    else 
     let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' 
    endif 
    else 
    let cmd = $VIMRUNTIME . '\diff' 
    endif 
    silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq 
endfunction 

回答

3

$VIMRUNTIME是自动获取的Vim设置一个特殊的环境变量。

:help $VIMRUNTIME早就告诉过你:

你通常不会设置$ VIMRUNTIME自己,而应该让Vim出来。

了解优秀和全面的:help是如何构建的;所有的信息都在那里(你只需要知道如何找到它)!

+0

您可以通过执行':echo $ vimruntime' – 2013-05-08 19:13:04

+0

+1再次感谢它的价值Ingo - 我试图使用帮助,但使用帮助的学习曲线非常丰富! – whytheq 2013-05-09 06:31:44

相关问题