> 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\\+$","","")'))
Commenting on the tip, not the problem:
That command seems particularly silly, and it is has been in the
tip for quite a long time.
http://vim.wikia.com/wiki/Remove_unwanted_spaces
Just prior to that in the tip, it offers the following which is
obviously the correct method:
autocmd BufWritePre * :%s/\s\+$//e
Assuming no one can identify a brilliancy in the setline, the
tip should be edited to use the :%s approach.
Commenting on the problem: The setline method uses every
possible trick to force Vim to do the the maximum amount of
work, and for a file of significant size, I imagine a very large
amount of RAM is used. I wonder if Vim would make temp files for
some processing in this case. If so, anti virus scanning could
be compounding the problem.
John
--
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