Ⅰ. 插件描述
Swap two columnsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/swapcol-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/swapcol-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/swapcol-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/swapcol.vim
Ⅳ. 文档说明
Swap columns, the columns are separated by blank.
Column maybe is word, or maybe not:
col1 col2 col3 col4 col5
command! -nargs=* -range -complete=command
1. Move cursor on col1, and press ]c you will see:
col2 col1 col3 col4 col5
2. Move cursor on -range and press [c, you will see:
command! -range -nargs=* -complete=command
3. Move cousor on column, means you can put cursor on any character
of the column, not limit the first character.
4. If you don't like the default map, just modify the source.
The map code is on the bottom.
5. You can swap columns on multiple lines.
Swap column 1 and column 3 on five lines.
111 222 333 444 555 333 222 111 444 555
111 222 333 444 555 333 222 111 444 555
111 222 333 444 555 ---> 333 222 111 444 555
111 222 333 444 555 333 222 111 444 555
111 222 333 444 555 333 222 111 444 555
Step 1: select multiple lines in visual mode
press V (upper case)
and then use j or k to select lines
Step 2: call Swapcols like:
:'<,'>Swapcols 1 3
(When you press : '<,'> will come out automatically.)
Setp 3: press Enter to continue, and you will get the result.
Remember: the first column number is 1, not 0.