summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>