mirror of
https://github.com/bronson/vim-trailing-whitespace.git
synced 2025-11-08 11:33:54 -05:00
initial checkin
This commit is contained in:
9
README
Normal file
9
README
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
This plugin causes all trailing whitespace to be highlighted in red.
|
||||||
|
|
||||||
|
To fix the whitespace errors, just call :FixWhitespace. By default it
|
||||||
|
operates on the entire file. Pass a range (or use V to select some lines)
|
||||||
|
to restrict the portion of the file that gets fixed.
|
||||||
|
|
||||||
|
Based on http://vim.wikia.com/wiki/Highlight_unwanted_spaces , and
|
||||||
|
Thanks to http://github.com/graywh/dotfiles/blob/master/.vimrc#L452
|
||||||
|
for improving the fix command.
|
||||||
16
doc/trailing-whitespace.txt
Normal file
16
doc/trailing-whitespace.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
*trailing-whitespace.txt* trailing-whitespace
|
||||||
|
|
||||||
|
|
||||||
|
This plugin causes all trailing whitespace to be highlighted in red.
|
||||||
|
|
||||||
|
|
||||||
|
*FixWhitespace*
|
||||||
|
|
||||||
|
To fix the whitespace errors, just call :FixWhitespace. By default it
|
||||||
|
operates on the entire file. Pass a range (or use V to select some lines)
|
||||||
|
to restrict the portion of the file that gets fixed.
|
||||||
|
|
||||||
|
Based on http://vim.wikia.com/wiki/Highlight_unwanted_spaces , and
|
||||||
|
Thanks to http://github.com/graywh/dotfiles/blob/master/.vimrc#L452
|
||||||
|
for improving the fix command.
|
||||||
|
|
||||||
11
plugin/trailing-whitespace.vim
Normal file
11
plugin/trailing-whitespace.vim
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
" Highlight EOL whitespace, http://vim.wikia.com/wiki/Highlight_unwanted_spaces
|
||||||
|
highlight ExtraWhitespace ctermbg=darkred guibg=#382424
|
||||||
|
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
|
||||||
|
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
|
||||||
|
" the above flashes annoyingly while typing, be calmer in insert mode
|
||||||
|
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
||||||
|
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
|
||||||
|
|
||||||
|
" Run :FixWhitespace to remove end of line white space.
|
||||||
|
command! -range=% FixWhitespace silent! keepjumps <line1>,<line2>substitute/\s\+$//
|
||||||
|
|
||||||
Reference in New Issue
Block a user