python代码窗口在VIM中关闭后自动关闭pylint窗口

时间:2021-09-14 14:02:08

How can I set automatically close pylint window after python code window is close in VIM?

在VIM中python代码窗口关闭后,如何设置自动关闭pylint窗口?

Every time I quit from vim, but pylint window still displayed.

每次我退出vim,但是pylint窗口仍然显示。

I want to automatically close pylint warning window when I quit from python code.

我想在退出python代码时自动关闭pylint警告窗口。

I know the way to doing this by manually is :qa!

我知道手动操作的方法是:qa!

1 个解决方案

#1


3  

Assuming the pylint window shows a scratch buffer, you can close this automatically via an :autocmd:

假设pylint窗口显示了一个擦伤缓冲区,您可以通过:autocmd:

:autocmd WinEnter * if winnr('$') == 1 && ! empty(&buftype) && ! &modified | quit | endif

When you :quit, you either exit Vim or enter another open window. Above checks that this is a single window containing a scratch buffer with unpersisted changes, and then quits that, too. This should give you the general idea; you can tweak the conditions to better suit your needs.

当你:退出时,你要么退出Vim,要么进入另一个打开的窗口。上面检查这是一个窗口,其中包含一个具有非持久性更改的scratch缓冲区,然后退出该窗口。这应该能给你一个大概的概念;您可以调整条件以更好地满足您的需要。

#1


3  

Assuming the pylint window shows a scratch buffer, you can close this automatically via an :autocmd:

假设pylint窗口显示了一个擦伤缓冲区,您可以通过:autocmd:

:autocmd WinEnter * if winnr('$') == 1 && ! empty(&buftype) && ! &modified | quit | endif

When you :quit, you either exit Vim or enter another open window. Above checks that this is a single window containing a scratch buffer with unpersisted changes, and then quits that, too. This should give you the general idea; you can tweak the conditions to better suit your needs.

当你:退出时,你要么退出Vim,要么进入另一个打开的窗口。上面检查这是一个窗口,其中包含一个具有非持久性更改的scratch缓冲区,然后退出该窗口。这应该能给你一个大概的概念;您可以调整条件以更好地满足您的需要。