summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zárraga <ekaitz.zarraga@gmail.com>2016-04-01 16:29:06 +0200
committerEkaitz Zárraga <ekaitz.zarraga@gmail.com>2016-04-01 16:29:06 +0200
commitbb98bfb2d738ecdad448bf58c57f2ad2a680a8ce (patch)
tree650f371d87c2b6456a53fb44e7606e96949cc9cf
parent3e706e9e918c1ca8353a07acc1750d46c3f85d0b (diff)
Remove trailing spaces
-rw-r--r--vim/.vimrc14
1 files changed, 10 insertions, 4 deletions
diff --git a/vim/.vimrc b/vim/.vimrc
index e97b8c8..313a327 100644
--- a/vim/.vimrc
+++ b/vim/.vimrc
@@ -1,3 +1,7 @@
+" Different config for each filetype
+filetype plugin on
+
+" Show trailing spaces
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
@@ -5,15 +9,17 @@ autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
-
-filetype plugin on
+" Clear trailing spaces on <F2>
+function TrimWhiteSpace()
+ %s/\s*$//
+ ''
+:endfunction
+nnoremap <F2> :call TrimWhiteSpace()<CR>
" Fold
set foldmethod=syntax
set foldlevelstart=99
-
-
" HighLight search and map CarrierReturn to remove highlight
set hlsearch
nnoremap <CR> :noh<CR><CR>