wstrip.vim


Ⅰ. 插件描述

Strip trailing whitespace only on changed lines

Ⅱ. 基本信息

创建日期:  2016-06-03
使用用户:  7
Github星:  11
插件作者:  Tommy Allen

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# wstrip.vim

Strip trailing whitespace only on changed lines. Inspired by question on
StackExchange's Vi and Vim website.

Summary

This plugin uses git-diff to strip whitespace from lines that you changed
while editing. This allows you to keep newly added lines clean without
affecting the history of existing lines.

If the file is not in a git repository, diff is used to make a simple
comparison against the existing file on disk.

Usage

Whitespace can be automatically stripped when writing the buffer by setting
g:wstrip_auto or b:wstrip_auto to 1. This is disabled by default.

" Globally enabled for all filetypes
let g:wstrip_auto = 1  

" Just certain filetypes
autocmd FileType *.css,*.py let b:wstrip_auto = 1  

If you don't want automatic cleaning, the :WStrip command can be used to
manually clean whitespace.

Trailing whitespace will be highlighted using the WStripTrailing syntax

  1. If it appears that Vim is capable of underlining text, trailing
  2. will be highlighted as a red underline. Otherwise, it will

highlighted with a red background. To disable highlighting, set
b:wstrip_highlight or g:wstrip_highlight to 0.

If you want to allow a certain amount of trailing whitespace, you can set
b:wstrip_trailing_max to the maximum number of whitespace characters that are
allowed to be at the end of a line. By default, this is set to 2 for the
markdown filetype.

License

MIT

添加新评论