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 word样式右侧翻页键消失
  • ¥15 springboot+vue 集成keycloak sso到阿里云
  • ¥15 win7系统进入桌面过一秒后突然黑屏
  • ¥30 backtrader对于期货交易的现金和资产计算的问题
  • ¥15 求C# .net4.8小报表工具
  • ¥15 安装虚拟机时出现问题
  • ¥15 Selenium+docker Chrome不能运行
  • ¥15 mac电脑,安装charles后无法正常抓包
  • ¥18 visio打开文件一直显示文件未找到