StripWhiteSpaces


Ⅰ. 插件描述

vim plugin for striping white spaces when save a file

Ⅱ. 基本信息

创建日期:  2012-04-14
使用用户:  25
Github星:  11
插件作者:  German Frigerio

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

Strip White Spaces
=

This plugin strip all the white spaces in your file before save it automatically

Why this is important?

http://programmers.stackexchange.com/questions/121555/why-is-trailing-whitespace-a-big-deal

Simple to use too: just put this files under plugin in to your vim configuration,
if you are using janus, put it under ~/.janus like this:

git clone git@github.com:gagoar/StripWhiteSpaces.git

then all you need to do is restart your vim/mvim

if you need call this function before save, you can call it manually doing:

:StripWhiteSpaces

all the credit goes for this post

I'm only put it in a way of vim plugin

Trailling blank lines
-

You could remove the trailing blank lines at the end of the file too; just place the following in your .vimrc:

let g:strip_trailing_lines = 1

Disabling
-

To disable it globally place the following in your .vimrc:

let g:loaded_StripWhiteSpaces = 1

To disable it for just the current buffer set the following anywhere it makes sense (e.g. within a ftplugin file if you don't want to touch trailing whitespace for a certain file type):

let b:disable_StripWhiteSpaces = 1

If you just wanted to do that temporarily you can either set b:disable_StripWhiteSpaces = 0 or unlet b:disable_StripWhiteSpaces and it will strip white spaces once again.

Bitdeli Badge

添加新评论