vim-quit-another-window

Vim plugin that offers a way to close arbitrary window without bothering to leave current window.

Rationale

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.

Plugin details

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:

  • If :Q without arguments is passed, then current window becomes closed. (to provide compatibility of lowercased command :q)
  • If argument is passed, but target window is the same as current window, then no window will be closed.

Download

Currently, the plugin is hosted at vim.org only: quit-another-window.

Discussion

Enter your comment (please, English only). Wiki syntax is allowed:
   __ __ __  __   __ __   _  __   __ __
  / //_/ \ \/ /  / // /  | |/_/  / // /
 / ,<     \  /  / _  /  _>  <   / _  / 
/_/|_|    /_/  /_//_/  /_/|_|  /_//_/
 
projects/vim-quit-another-window.txt · Last modified: 2015/09/09 08:46 by dfrank
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0