Friday, December 16, 2011

Re: GVim Win32 on Win7 suddenly very slow to load

FYI.

Other people also seeing the same problem:
http://code.google.com/p/vim-win3264/issues/detail?id=7

The problem of takes long time to write to disk, it seems that it's
Vim's fault. Using Vim 7.3.372 (without Cream version).

Details:
I have an autocmd to strip white spaces from end of line when writing
to disk, which was taken from Vim wiki:

autocmd FileType c,cpp,java,php,txt autocmd BufWritePre <buffer> :call
setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))

When saving, Vim takes ~50% of the CPU cycles for ~5s before it
settles down and display write complete message.

I have changed the above autocmd to:
function TrimSpaces()
%s/\s*$//
''
:endfunction
autocmd FileType c,cpp,java,php,txt autocmd BufWritePre
<buffer> :silent! call TrimSpaces()

This time CPU cycle consumption is normal, no spikes; and it responds
almost instantly (>8000 lines of code).

Anybody can check and verify this behaviour?

KF

KF

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment