From 41f4ba3ae53153d3de104d5f1af38109a83bc942 Mon Sep 17 00:00:00 2001 From: Paul Sbarra Date: Mon, 19 Dec 2011 10:42:32 +1100 Subject: [PATCH] vim: fix go filetype detection The filetype needs to be set during BufRead in order for the did_filetype() check to prevent the file being detected as a conf file. One example where this can occur is if a cgo file has a #include at the top of the file. The # is detected in vim's generic configuration (conf file) toward the bottom of filetype.vim R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/5496066 --- misc/vim/ftdetect/gofiletype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/vim/ftdetect/gofiletype.vim b/misc/vim/ftdetect/gofiletype.vim index f03a1d8dc31..096d0524438 100644 --- a/misc/vim/ftdetect/gofiletype.vim +++ b/misc/vim/ftdetect/gofiletype.vim @@ -1 +1 @@ -au BufReadPre,BufNewFile *.go set filetype=go fileencoding=utf-8 fileencodings=utf-8 +au BufRead,BufNewFile *.go set filetype=go fileencoding=utf-8 fileencodings=utf-8