Ⅰ. 插件描述
Identation conversion: tabs to spaces or spaces to tabs (mirror)Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'rhlobo/vim-super-retab'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'rhlobo/vim-super-retab'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'rhlobo/vim-super-retab'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/rhlobo/vim-super-retab
Ⅳ. 文档说明
vim-super-retab
Converts tabs to spaces, or spaces to tabs, and provides a "super retab"
command to convert only the whitespace used for indentation in programs.
This is a mirror of VimTip1592
Commands
| Command | Description |
|---|---|
| Space2Tab | Convert spaces to tabs, only in indents. |
| Tab2Space | Convert tabs to spaces, only in indents. |
| RetabIndent | Execute Space2Tab (if expandtab is set), or Tab2Space (otherwise). |
Features
- The commands allow an argument to specify the column width; if none is given, the
tabstopsetting is used. - Redundant spaces in an indent are removed (in the above mapping, converting tabs to spaces will not change lines where there is a space before a tab in the indent).
- The search history is not changed (pressing n will do the same search it would have done before the conversion was performed).
- The cursor position is restored, although the column will be slightly wrong owing to the different number of characters in the indent.