]> Cypherpunks repositories - gostls13.git/commitdiff
vim: fix go filetype detection
authorPaul Sbarra <Sbarra.Paul@gmail.com>
Sun, 18 Dec 2011 23:42:32 +0000 (10:42 +1100)
committerDavid Symonds <dsymonds@golang.org>
Sun, 18 Dec 2011 23:42:32 +0000 (10:42 +1100)
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

index f03a1d8dc319f3c99f7902050223f839341be83c..096d052443889b595673970f68b6bddea0df8aee 100644 (file)
@@ -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