vim-windowswap


Ⅰ. 插件描述

Swap your windows without ruining your layout

Ⅱ. 基本信息

创建日期:  2013-09-24
使用用户:  605
Github星:  386
插件作者:  Wes Malone

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

WindowSwap.vim

Swap windows without ruining your layout!

img

Vim's window movement commands work fine when you only have a few splits open or want to push a window over to an edge. But what happens when you have a complicated layout and you just want to swap a couple arbitrary windows?

When I was just getting started with Vim, I asked about this problem on StackOverflow and I've received a handful of responses over the years. Almost a year after after I asked, sgriffin came through with a solution. Now that I'm a little less of a newbie, I've put his idea in a handy plugin.

HowTo

  1. Navigate to the window you'd like to move
  2. Press <leader>ww
  3. Navigate to the window you'd like to swap with
  4. Press <leader>ww again

Key Bindings

Defaults:

  • Yank and paste a window with <leader>ww (for me that's ,ww)

Deprecated defaults:

  • [y]ank a [w]indow with <leader>yw
  • [p]aste that [w]indow with <leader>pw.

These mappings are deprecated. See below for instructions on how to keep them working once they are removed from the default list.

Customize the commands to your liking by dropping this in your .vimrc and changing the mappings:

let g:windowswap_map_keys = 0 "prevent default bindings
nnoremap <silent> <leader>yw :call WindowSwap#MarkWindowSwap()<CR>
nnoremap <silent> <leader>pw :call WindowSwap#DoWindowSwap()<CR>
nnoremap <silent> <leader>ww :call WindowSwap#EasyWindowSwap()<CR>

Installation

This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:

  • Vundle - Plugin 'wesQ3/vim-windowswap'
  • Pathogen - git clone https://github.com/wesQ3/vim-windowswap ~/.vim/bundle/vim-windowswap
  • NeoBundle - NeoBundle 'wesQ3/vim-windowswap'
  • VAM - call vam#ActivateAddons([ 'wesQ3/vim-windowswap' ])
  • manual - copy all of the files into your ~/.vim directory

添加新评论