Vim plugin that offers a way to close arbitrary window without bothering to leave current window.
During my daily vimming, I often need to close some another window and keep working in the current window. And I want to do it without bothering to leave my current window.
For example, when I read some help in the upper window, and edit code in the lower window. At some moment, I decide to close help window. To do it, I have to press “
Ctrl_W k :q”: Not very short. And this is not the worse case.
+-----------------+-----------------+ | help | | | window | | | | current | +-----------------+ window | | | | | | <cursor> | | | | +-----------------+-----------------+
Focus is in the “current window”, cursor is on the
<cursor> sign. I want to close “help window” and keep working in the current window.
Here's what I need to do:
Ctrl_W h Ctrl_W k :q Ctrl_W l
That is a way too long! So, I wrote this plugin to make me feel better.
The plugin provides 5 commands. Firstly, four commands for most-frequently actions:
:Qhmeans “close left window and go back”
:Qjmeans “close lower window and go back”
:Qkmeans “close upper window and go back”
:Qlmeans “close right window and go back”
And one universal command:
:Q <args>, where
<args>are movement commands to needed window.
:Q hk means “Go to the left window, then go to upper window, close it and go back to source window”
So, this long long command “
Ctrl_W h Ctrl_W k :q Ctrl_W l” is truncated to short expression: “
There's one optional dependency: CmdAlias plugin. If it is installed, then lowercased aliases of commands will be available:
:q <args>. I found it much more useful than capitalized ones.
Please note the following:
:Qwithout arguments is passed, then current window becomes closed. (to provide compatibility of lowercased command
Currently, the plugin is hosted at vim.org only: quit-another-window.