]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - vimrc
Add apache after syntax for better spell checking.
[config/dotfiles.git] / vimrc
diff --git a/vimrc b/vimrc
index 8e64ca0204701c964fc05040a4532fcff0cead7c..a3163f81e1275616f5174ee3096aac05c37ffb8d 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -89,9 +89,6 @@ set listchars=trail:-
 
 " EDITOR SETTINGS
 
-" Don't use any modelines.
-set nomodeline
-
 " When completing paths first use the longest path then display a list of all
 " possible files.
 set wildmode=longest,list
@@ -102,17 +99,15 @@ if v:version >= 700
 endif
 
 
-" MAPPINGS
+" MAPPINGS (except for plugins, see PLUGIN SETTINGS below)
 
 " Use "," as my mapleader.
 let mapleader = ","
 let maplocalleader = ","
 
-" Settings for the NERD commenter.
-" Don't create any mappings I don't want to use.
-let NERDCreateDefaultMappings=0
-" Map toggle comment.
-map <Leader><Leader> <plug>NERDCommenterToggle
+" Use <space> to move down a page and - to move up one like in mutt.
+nnoremap <Space> <C-f>
+nnoremap - <C-b>
 
 " Maps to change spell language between English and German.
 map <Leader>se :set spelllang=en_us<CR>
@@ -138,6 +133,12 @@ else
         \ ((getcmdtype() == ':' && getcmdpos() <= 2) ? 'q' : 'Q')
 endif
 
+" Make sure xa0 (alt + space) is automatically changed to a normal whitespace
+" if pressed accidentally while in insert mode (happens on Mac sometimes).
+if has("mac")
+    imap <Char-0xa0> <Space>
+endif
+
 " Disable Apple style movements in MacVim.
 if has("gui_macvim")
     let macvim_skip_cmd_opt_movement = 1
@@ -147,9 +148,38 @@ endif
 " SYNTAX SETTINGS
 
 " Activate syntax coloring.
-syntax enable
+if has("syntax")
+    syntax enable
+
+" Highlight text longer then 78 characters. Thanks to Tony Mechelynck
+" <antoine.mechelynck@gmail.com> from the Vim mailing list.
+    if v:version >= 700
+        2match Todo /\%>78v./
+    else
+        match Todo /\%>78v./
+    endif
+endif
 
 
-" Automatically save and the load the file state (stored in ~/.vim/view).
-autocmd BufWrite * mkview
-autocmd BufRead  * loadview
+" PLUGIN SETTINGS
+
+" Settings for the NERD commenter.
+" Don't create any mappings I don't want to use.
+let NERDCreateDefaultMappings = 0
+" Map toggle comment.
+map <Leader><Leader> <plug>NERDCommenterToggle
+
+
+" AUTO COMMANDS
+
+" Use a custom auto group to prevent problems when the vimrc files is sourced
+" twice.
+if has("autocmd")
+    augroup vimrc
+    autocmd!
+
+" Use diff filetype for mercurial patches in patch queue.
+        autocmd BufReadPost */.hg/patches/* set filetype=diff
+
+    augroup END
+endif