1 回答

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
最后我把它釘在了這個(gè)上面:
function! GoHtml()
GoFmt
if !empty(b:current_syntax)
unlet b:current_syntax
endif
syn include @html syntax/html.vim
syntax region htmlCode start=+<!DOCTYPE+ keepend end=+</html>+ contains=@html containedin=goRawString contained
endfunction
autocmd BufEnter *.go call GoHtml()
autocmd BufWrite *.go call GoHtml()
execute pathogen#infect()
" don't save automatically, let us handle this
let g:go_fmt_autosave = 0
" for golang: automatically run GoImports
let g:go_fmt_command = "GoImports"
這樣我就可以按照我想要的方式混合 go 和 html 代碼。
- 1 回答
- 0 關(guān)注
- 167 瀏覽
添加回答
舉報(bào)