From 964107c604a3dc559c30febfe2a08be31659170d Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 13 Aug 2014 00:55:50 +0200 Subject: Switch to official go package, closes #28 --- ftdetect/polyglot.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ftdetect') diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index edfca72e..59621bdd 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -38,6 +38,21 @@ autocmd BufNewFile,BufRead * \ if getline(1) =~ '^From \x\{40\} Mon Sep 17 00:00:00 2001$' | \ set filetype=gitsendemail | \ endif +let s:current_fileformats = '' +let s:current_fileencodings = '' +function! s:gofiletype_pre() + let s:current_fileformats = &g:fileformats + let s:current_fileencodings = &g:fileencodings + set fileencodings=utf-8 fileformats=unix + setlocal filetype=go +endfunction +function! s:gofiletype_post() + let &g:fileformats = s:current_fileformats + let &g:fileencodings = s:current_fileencodings +endfunction +au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix +au BufRead *.go call s:gofiletype_pre() +au BufReadPost *.go call s:gofiletype_post() autocmd BufNewFile,BufRead *.haml,*.hamlbars,*.hamlc setf haml autocmd BufNewFile,BufRead *.sass setf sass autocmd BufNewFile,BufRead *.scss setf scss -- cgit v1.2.3