mirror of
https://github.com/amix/vimrc
synced 2025-07-05 23:44:59 +08:00
Adding as not submodule.
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
if exists('loaded_trailing_whitespace_plugin') | finish | endif
|
||||
let loaded_trailing_whitespace_plugin = 1
|
||||
|
||||
" 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\+\%#\@<!$/
|
||||
|
||||
function! s:FixWhitespace(line1,line2)
|
||||
let l:save_cursor = getpos(".")
|
||||
silent! execute ':' . a:line1 . ',' . a:line2 . 's/\s\+$//'
|
||||
call setpos('.', l:save_cursor)
|
||||
endfunction
|
||||
|
||||
" Run :FixWhitespace to remove end of line white space
|
||||
command! -range=% FixWhitespace call <SID>FixWhitespace(<line1>,<line2>)
|
Reference in New Issue
Block a user