第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

GoImports 殺死 html 語(yǔ)法高亮

GoImports 殺死 html 語(yǔ)法高亮

Go
料青山看我應(yīng)如是 2021-12-20 16:48:20
在下面的代碼中:var rootTemplate = template.Must(template.New("root").Parse(`<!DOCTYPE html><html><head> /SNIP/</html>`))我可以使用此功能將 html 部分突出顯示為 html:function! GoHtml()    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 containedendfunctionautocmd BufEnter *.go call GoHtml()但是,在我保存文檔后,調(diào)用 GoImports 時(shí) html 語(yǔ)法突出顯示消失了: let g:go_fmt_command = "GoImports"有沒有辦法保持嵌入的 html 突出顯示?
查看完整描述

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 代碼。


查看完整回答
反對(duì) 回復(fù) 2021-12-20
  • 1 回答
  • 0 關(guān)注
  • 167 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)