vim - vim ctrl_w 触发的事件是什么

标签 vim window

当我使用ctrl_w ctrl_w或类似的东西来切换窗口时,我无法停用光标线:

au BufLeave * setlocal nocursorline

手册上说:

BufLeave        Before leaving to another buffer.  Also when
                leaving or closing the current window and the
                new current window is not for the same buffer.
                Not used for ":qa" or ":q" when exiting Vim.

那么,使用 ctrl_w ctrl_w 时,BufLeave 事件不是会触发吗?

提前非常感谢您!

最佳答案

您的autocmd对我来说工作得很好,但请注意,它仅在离开缓冲区时触发。如果两个窗口都指向同一个缓冲区,则您没有离开缓冲区,而只是切换到缓冲区上的不同 View 。

我们可以使用以下方法验证这一点:

au BufLeave * echoerr 'BufLeave triggered!'

然后检查:messages以确定。

在这种情况下,您可能想要使用 WinLeave自动命令:

au WinLeave * setlocal nocursorline

关于vim - vim ctrl_w 触发的事件是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36195201/

相关文章:

linux - 每当我打开 gvim 时检查进程

regex - vim:搜索并替换以特定字符串开头的行中的单词

c++ - 如何调整 Windows 10 窗口大小并忽略透明边框?

javascript - 如何根据其内容调整ExtJS窗口宽度?

python - 为什么 tkinter 会根据窗口大小不成比例地扩展框架?

python - 窗内窗

ruby - 命令行Matlab中的vi输入模式?

visual-studio - Visual Studio 的 Vi 编辑

ruby - 在 Vim 中使用 Ctags 跳转到 Ruby bang 方法

python - 无法从 tkinter widget.after 函数传递参数