分页: 1 / 1
[已解决]我的vim在某些情况下异常频繁读写硬盘
发表于 : 2012-11-04 17:22
由 reallynotme
如果不用寄存器的重复动作功能倒没什么感觉,但是用的话即使动作里不包括读写操作,有时候vim却会异常频繁的读写硬盘.我另外在虚拟机里的ubuntu和windows下试了,读写硬盘的现象却没出现.不知道是设置的原因还是虚拟机缓存硬盘操作的原因.大家帮忙看看,硬盘灯狂闪太不爽了,而且也严重影响命令执行的速度
测试方法如下:
测试文件是一个包含100行以下文字的文件
结果是把100行都转为
这是转换用的代码:
代码: 全选
:exe "1,100normal ^cecase\<esc>A://\<esc>pj"
在我这里的现象是硬盘灯狂闪,而且能听到硬盘的声音,操作共费时14秒
而在虚拟机里,这个操作是瞬间完成的,而且硬盘灯也不闪
另外如果用正则表达式做的话也不会出现这种情况
Re: 我的vim在某些情况下异常频繁读写硬盘
发表于 : 2012-11-04 19:09
由 Fermat618
可能是在写交换文件吧。你升级下 vim 试试,说不定是某个 bug.
Re: 我的vim在某些情况下异常频繁读写硬盘
发表于 : 2012-11-04 19:40
由 reallynotme
自己解决了
我用root运行vim发现就没这问题,猜可能是.vimrc的事
然后把里面这一小段代码注释掉就没事了
代码: 全选
"if has("autocmd")
" au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
" au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
" "au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
"endif
这个代码是网上找的用来让bash中的vim也能改变光标样式的(事实上并不好使)
Re: 我的vim在某些情况下异常频繁读写硬盘
发表于 : 2012-11-04 23:45
由 Fermat618
reallynotme 写了:自己解决了
我用root运行vim发现就没这问题,猜可能是.vimrc的事
然后把里面这一小段代码注释掉就没事了
代码: 全选
"if has("autocmd")
" au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
" au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
" "au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
"endif
这个代码是网上找的用来让bash中的vim也能改变光标样式的(事实上并不好使)
原来是加了个自动命令来运行外部程序,难怪。
我是早习惯了平时在普通模式了,进入插入模式是短暂的,所以没有多少搞不清当前模式的机会。
Re: 我的vim在某些情况下异常频繁读写硬盘
发表于 : 2012-11-05 9:05
由 reallynotme
Fermat618 写了:reallynotme 写了:自己解决了
我用root运行vim发现就没这问题,猜可能是.vimrc的事
然后把里面这一小段代码注释掉就没事了
代码: 全选
"if has("autocmd")
" au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
" au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
" "au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
"endif
这个代码是网上找的用来让bash中的vim也能改变光标样式的(事实上并不好使)
原来是加了个自动命令来运行外部程序,难怪。
我是早习惯了平时在普通模式了,进入插入模式是短暂的,所以没有多少搞不清当前模式的机会。
用惯了gvim用vim实在是受不了那光标