Browse files

Add protection around the current_syntax storing

This was blowing up when opening markdown, seems to be an issue with the nested
syntax highlighting for markdown->HTML->LESS.  Behavior doesn't change with
LESS files.
  • Loading branch information...
1 parent 36901d6 commit c63e8079e1d278087194ce3ea0aa0524b2bfb8ea @jdost jdost committed Oct 14, 2014
Showing with 7 additions and 3 deletions.
  1. +7 −3 after/syntax/html.vim
@@ -7,8 +7,10 @@ if !g:less_html_style_tags
" Unset (but preserve) so that less will run.
-let s:pre_less_cur_syn = b:current_syntax
-unlet b:current_syntax
+if exists("b:current_syntax")
+ let s:pre_less_cur_syn = b:current_syntax
+ unlet b:current_syntax
" Inspired by code from
" and the html syntax file included with vim 7.4.
@@ -19,4 +21,6 @@ syn include @htmlLess syntax/less.vim
syn region lessStyle start=+<style [^>]*type *=[^>]*text/less[^>]*>+ keepend end=+</style>+ contains=@htmlLess,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc containedin=htmlHead
" Reset since 'less' isn't really the current_syntax.
-let b:current_syntax = s:pre_less_cur_syn
+if exists("s:pre_less_cur_syn")
+ let b:current_syntax = s:pre_less_cur_syn

0 comments on commit c63e807

Please sign in to comment.