2011-03-24 142 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

这消除完全,除非你有连接问题的滞后。