Skip to content

Commit

Permalink
Always use custom syntax files over default
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zyedidia committed Jul 24, 2017
1 parent 5dcc486 commit 5c462f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/micro/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5c462f5

Please sign in to comment.