Ⅰ. 插件描述
Delete unwanted whitespace at the end of lines.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/deletetrailingwhitespace'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/deletetrailingwhitespace'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/deletetrailingwhitespace'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/DeleteTrailingWhitespace
Ⅳ. 文档说明
DESCRIPTION
This plugin deletes whitespace at the end of each line, on demand via the
:DeleteTrailingWhitespace command, or automatically when the buffer is
written.
SEE ALSO
This plugin leverages the superior detection and customization facilities of
the companion ShowTrailingWhitespace.vim plugin (vimscript #3966), though it
can also be used without it if you're not interested in highlighting and
customizing.
To quickly locate the occurrences of trailing whitespace, you can use the
companion JumpToTrailingWhitespace.vim plugin (vimscript #3968).
RELATED WORKS
The basic substitution commands as well as more elaborate scriptlets, as the
idea of automating this can be found in this VimTip:
http://vim.wikia.com/wiki/Remove_unwanted_spaces
There are already a number of plugins that define such a command; most bundle
this functionality together with the highlighting of trailing whitespace.
However, most of them cannot consider whitespace exceptions and are not as
flexible.
- trailing-whitespace (vimscript #3201) defines :FixWhitespace.
- bad-whitespace (vimscript #3735) defines :EraseBadWhitespace.
- Trailer Trash (vimscript #3938) defines :Trim.
- StripWhiteSpaces (vimscript #4016) defines :StripWhiteSpaces and strips
automatically, too, but is way more simple than this plugin. - WhiteWash (vimscript #3920) provides functions that also can strip visible
^M and sequential whitespacw between words.
USAGE
:[range]DeleteTrailingWhitespace
Delete all trailing whitespace in the current buffer
or [range].