doude5860 2012-03-20 01:16
浏览 88
已采纳

Vim - 在启用语法突出显示的大型PHP文件上更改为正常模式的速度很慢

When I'm using Vim 7.3 to edit a large PHP file (2000 lines), if I switch from insert mode to normal mode there is a delay of about 1-2 seconds.

It is quite frustrating when I need to make some quick edits.

On smaller files (300 lines) there is no delay. The reverse (normal mode to insert mode) there is also no delay.

The issue is related to syntax highlighting, because if I turn syntax highlighting off, the problem goes away.

:syntax off

Some things I have tried to no avail:

  • turning folding off
  • turning matchparen plugin off
  • turning all custom plugins off
  • using "largefile" plugin

Note, other than this insert-to-normal mode switching issue, nothing else about the syntax highlighting appears slow for me when editing large files. I.e. typing text in insert mode performs fine, completion works fine, etc.

This makes me think that it is something that can be fixed.

I have tested this in gVim and console vim (under cygwin) on Windows XP.

Does anyone know what could be the issue?

Or is anyone else able to reproduce this problem? I have googled, but can't see anyone else with this same issue which is weird.

UPDATE: I think it may be related only to PHP syntax highlighting. I just tried coffeescript and javascript files with 2000+ lines and did not have any issues with them.

  • 写回答

3条回答 默认 最新

  • dongpang1898 2012-03-20 02:56
    关注

    I haven't seen the issue you're describing, but the InsertLeave event would be one place to start looking. Check your color scheme (and any other plugins) to see if there's an InsertLeave autocommand. On my own system the 'lettuce.vim' colorscheme file has a handful of those; it's conceivable they're expensive, or possibly even triggering some kind of recursive processing (just thinking out loud).

    Edit You can check to see what autocommands are associated with a given event by doing :au {EventName}, e.g. :au InsertLeave.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题