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.
Another 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:
:Qh
means “close left window and go back”:Qj
means “close lower window and go back”:Qk
means “close upper window and go back”:Ql
means “close right window and go back”And one universal command:
:Q <args>
, where <args>
are movement commands to needed window.
For example, :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: “:Q hk
”
There's one optional dependency: CmdAlias plugin. If it is installed, then lowercased aliases of commands will be available: :qh
, :qj
, :qk
, :ql
, :q <args>
. I found it much more useful than capitalized ones.
Please note the following:
:Q
without arguments is passed, then current window becomes closed. (to provide compatibility of lowercased command :q
)Currently, the plugin is hosted at vim.org only: quit-another-window.