Disable VIm autocommands for specific buffer

时间:2016-10-20 18:58:16

标签: vim terminal conque

As a windows user I use conque term as my vim terminal. Is there a way to disable the CursorHoldI and CursorMovedI autocmds when the buffer is a conque term. My vim script skills are basic , I 'm sure there is a line I can add to my vimrc.Thanks

1 个答案:

答案 0 :(得分:0)

我不完全理解为什么你需要这样做,但禁用某些autocmds的方法是通过'eventignore'选项。 (或者,您可以删除相应的autocmds,但这只适用于缓冲区范围的autocmds,而不是全局的,因为您可能希望保持autocmds在非Conque缓冲区中运行。)

问题是,'eventignore'是一个全局设置,因此您需要另外一对autocmds来打开/关闭该选项,具体取决于进入/离开Conque缓冲区。

在每个Conque缓冲区内,运行:

:autocmd WinEnter <buffer> set eventignore+=CursorHoldI,CursorMovedI
:autocmd WinLeave <buffer> set eventignore-=CursorHoldI,CursorMovedI