2011-03-24 131 views
1

在Windows Vista上使用gVim 7.3訪問UNC路徑上的目錄/文件時,我遇到了一些非常痛苦的滯後。Vim緩慢UNC路徑

它是緩慢讀/寫文件,以及打開新緩衝區時目錄/文件名稱的選項卡完成。雖然使用寫字板時我沒有注意到這種滯後性。

事情我已經嘗試:

  • 霜(顯然他們對目錄命名方案修復)
  • 網絡驅動器映射到Z:要不
  • 各種設置
    • 東西set ffs = dos
    • set complete =。,w,b,u,t
    • set noshellslash

我試過cygwin,但同樣顯着的滯後也出現在那裏。我已經關閉了所有交換/備份文件。任何幫助,不勝感激......我甩了我的vimrc參考

if v:progname =~? "evim" 
    finish 
endif 

set nocompatible 

:runtime! ftplugin/man.vim 

set backspace=indent,eol,start 

colorscheme torte " murphy 
syn on 

set ffs=unix,dos 

" portable friendly 
set nobackup 
set nowritebackup 
set noswapfile 
set viminfo= 
" gui options (http://steveno.wordpress.com/2007/10/08/vim-for-windows/) 
set guioptions-=T " No toolbar 
set gfn=Consolas:h9:cANSI 

set history=50 
set ruler 
set showcmd 
set incsearch 
set number 
set tabstop=4 
set softtabstop=4 
set shiftwidth=4 
set wrap 
set wildmode=longest,list,full " Complete longest string, list alternatives 
           " then completed next full match, cycling back 

function! ToggleHLSearch() 
    if &hls 
     set nohls 
    else 
     set hls 
    endif 
endfunction 

function! InsertTabWrapper() 
    let col = col('.') - 1 
    if !col || getline('.')[col - 1] !~ '\k' 
     return "\<tab>" 
    else 
     return "\<c-p>" 
    endif 
endfunction 


inoremap <tab> <c-r>=InsertTabWrapper()<CR> 
nmap <silent> <C-n> <Esc>:call ToggleHLSearch()<CR> 
nmap ,s :source ~/.vimrc<Return> 
" change current directory to that of open buffer 
nmap ,c :cd %:p:h<Return> 
nmap <c-h> <c-w>h<c-w><bar> 
nmap <c-l> <c-w>l<c-w><bar> 
map <C-J> <C-W>j<C-W>_ 
map <C-K> <C-W>k<C-W>_ 
map Q gq 

" Commenting blocks of text 
" ,< <!-- --> html style comments 
map ,< :s/^\(.*\)$/<!-- \1 -->/<CR><Esc>:nohlsearch<CR> 
" ,/  // comments 
map ,/ :s/^/\/\//<CR> 
" ,# # comments 
map ,# :s/^/#/<CR> 
" uncommenting all of the above 
"map ,- :s/^\(\/\/|<!-- |#\)\(.*\)\(-->\)*/\1/<CR> 

if &t_Co > 2 || has("gui_running") 
    syntax on 
    set hlsearch 
endif 

if has("autocmd") 
    "&& !exists("autocommands_loaded") 
    let autocommands_loaded = 1 
    filetype plugin indent on 
    augroup vimrcEx 
    au! 
    " Remove ALL autocommands for the current group. 
    autocmd! 
    autocmd FileType text setlocal textwidth=78 
    autocmd BufReadPost * 
    \ if line("'\"") > 0 && line("'\"") <= line("$") | 
    \ exe "normal g`\"" | 
    \ endif 
    au BufRead *.html set filetype=html4 
    augroup END 

    " allow editing Word Docs sanely 
    autocmd BufReadPre *.doc set ro 
    autocmd BufReadPre *.doc set hlsearch! 
    autocmd BufReadPost *.doc %!antiword "%" 

    " uncomment the following to remember the view of the file edited between 
    " sessions 
    " au BufWinLeave * mkview 
    " au BufWinEnter * silent loadview 

    " run file with PHP CLI (CTRL-M) 
    autocmd FileType php noremap <C-M> :w!<CR>:!/usr/bin/php %<CR> 
    " parser check (CTRL-L) 
    autocmd FileType php noremap <C-L> :!/usr/bin/php -l %<CR> 

    " highlight current line only for current buffer 
    "autocmd BufLeave * setlocal nocursorline 
    "autocmd BufEnter * setlocal cursorline 

    au BufRead,BufNewFile *.tea set filetype=tea 
    "au! Syntax newlang source $VIM/newlanguage.vim 

else 
    set autoindent 

endif 

回答

1

同樣的事情,是推動我瘋了,但我只是找到了解決。 我真的不知道爲什麼,但是當你禁用plugin/matchparen.vim插件(改變vim擴展可以做到這一點)時問題就消失了。 我一定會研究它,因爲我使用了很多匹配的括號。

+0

玩過代碼之後,我不得不說我沒有辦法加速它......即使匹配函數是空的,它仍然很慢,並且只是禁用autocmd行來解決問題。所以它似乎是一個比插件代碼本身更深的問題...禁用並享受速度 – 2011-04-11 16:43:26

1

:he swap-file 

您可以:se noswapfile禁用交換文件(注意!),或使用`directory`設置,以保持交換文件在本地磁盤上。

-n選項啓動vim也會禁用swapfiles;您可能希望將其與-R結合爲只讀模式

0

我發現的另一個解決方法是將UNC路徑安裝爲本地驅動器盤符,並讓Vim僅使用基於驅動器號的路徑。
例如,\\some-server\path\to\workdir =>Z:\path\to\workdir

這消除完全,除非你有連接問題的滯後。