]> git.lizzy.rs Git - micro.git/commitdiff
Always use custom syntax files over default
authorZachary Yedidia <zyedidia@gmail.com>
Mon, 24 Jul 2017 00:22:47 +0000 (20:22 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Mon, 24 Jul 2017 00:22:47 +0000 (20:22 -0400)
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

index 95593e97b108cfc17867b2f2761c20086d46ef0a..b8071839c909f913be227814b7155ecd6e89dbc9 100644 (file)
@@ -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