]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
vimrc: fix syntax when reloading vimrc
authorSimon Ruderich <simon@ruderich.org>
Tue, 29 Apr 2014 13:35:20 +0000 (15:35 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 29 Apr 2014 13:35:20 +0000 (15:35 +0200)
vimrc

diff --git a/vimrc b/vimrc
index 26c4f5f691216431d555fab0cc5d321989e7b1c9..4860c7fac09feb6cd622aa76ba9e0f6dcb1a9552 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -763,7 +763,11 @@ inoreabbrev completly completely
 
 " Activate syntax coloring.
 if has('syntax')
-    syntax enable
+    " But only if it wasn't already active. Prevents breaking the syntax
+    " coloring when reloading the vimrc. Thanks to johnLate for the idea.
+    if !exists('g:syntax_on')
+        syntax enable
+    endif
 
 " Don't highlight more than 500 columns as I normally don't have that long
 " lines and they slow down syntax coloring. Thanks to Derek Wyatt