From 5c462f56004aa6b65673ca6cf0bb63c6be982f5b Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sun, 23 Jul 2017 20:22:47 -0400 Subject: [PATCH] Always use custom syntax files over default The custom syntax files were first in the array but micro should stop loading files into the filetype if it already found a match. Fixes #750 --- cmd/micro/buffer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/micro/buffer.go b/cmd/micro/buffer.go index 95593e97..b8071839 100644 --- a/cmd/micro/buffer.go +++ b/cmd/micro/buffer.go @@ -208,7 +208,7 @@ func (b *Buffer) UpdateRules() { } ft := b.Settings["filetype"].(string) - if ft == "Unknown" || ft == "" { + if (ft == "Unknown" || ft == "") && !rehighlight { if highlight.MatchFiletype(ftdetect, b.Path, b.lines[0].data) { header := new(highlight.Header) header.FileType = file.FileType @@ -221,7 +221,7 @@ func (b *Buffer) UpdateRules() { rehighlight = true } } else { - if file.FileType == ft { + if file.FileType == ft && !rehighlight { header := new(highlight.Header) header.FileType = file.FileType header.FtDetect = ftdetect