Vim在UNC路径上放慢速度

时间:2011-03-24 18:58:15

标签: vim unc

在使用Windows Vista上的gVim 7.3访问UNC路径上的目录/文件时,我遇到了一些非常痛苦的延迟。

打开新缓冲区时,读取/写入文件的速度很慢,以及目录/文件名的制表符完成。我使用写字板时并没有注意到这种延迟。

我尝试过的事情:

  • Cream(显然他们已经修复了目录命名方案)
  • 将网络驱动器映射到z:或其他
  • 各种设置
    • 设置ffs = dos
    • 设置完成=。,w,b,u,t
    • 设置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

3 个答案:

答案 0 :(得分:1)

同样的事情让我疯了,但是我发现了一个修复。 我真的不知道为什么,但是当你禁用plugin / matchparen.vim插件时,问题就会消失(改变vim扩展就可以了)。 我肯定会调查它,因为我使用了很多匹配的括号。

答案 1 :(得分:1)

:he swap-file

您可以使用:se noswapfile禁用交换文件(注意!)或使用`directory`设置将交换文件保留在本地磁盘上。

使用-n选项启动vim也会禁用交换文件;您可能希望将其与-R组合用于只读模式

答案 2 :(得分:1)

我找到的另一个解决方案是将UNC路径作为本地驱动器号安装,让Vim仅使用基于驱动器号的路径。
例如,\\some-server\path\to\workdir =&gt; Z:\path\to\workdir

除非您遇到连接问题,否则这样可以完全消除延迟。

相关问题