quit-another-window


Ⅰ. 插件描述

Quickly close another window and keep working in current window

Ⅱ. 基本信息

创建日期:  2011-05-02
使用用户:  1
Github星:  2
插件作者:  Dmitry Frank

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/quit-another-window'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/quit-another-window'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/quit-another-window'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/quit_another_window

Ⅳ. 文档说明

Often I need to close some another window and keep working in the current window.
For example, when I read some help in the upper window, and edit code in the lower

  1. At one time, I decide to close help window. To do it,
  2. have to press "Ctrl_W k :q".

Not very short. And this is not the worse variant.
Another variant:

      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 current window.

That's what i need to do:

Ctrl_W h Ctrl_W k :q Ctrl_W l

This is pretty long!
So, I wrote this plugin to make it easy.

It 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> is 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 (vimscript #746).

If CmdAlias is installed, then lowercased aliases of commands will be available:   :qh, :qj, :qk, :ql, :q <args>.
I found it useful.

Please NOTE:

1) if :Q without arguments is passed, then current window becomes closed.
   (to provide compatibility of lowercased command :q)

2) If argument is passed, but target window is the same as current window, then
   no window will be closed.

添加新评论