2013-05-08 54 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

相關問題