風で飛んでいくチラ裏

気ままに雑記メモ書き殴り。古い記事は別blogからの引っ越しなのでレイアウトがアレです。

Vimでgolangのシンタックスハイライト

VimでGoのコードを書くときにやっておきたいこと - Quiita http://qiita.com/methane/items/d82b9f28b97b5c3bd08a Ubuntuの場合、$GOROOT/misc/vim/readme.txt の最初に書いてあるとおり、 一旦filetypeを切らないとうまく動かない。

To use all the Vim plugins, add these lines to your $HOME/.vimrc. " Some Linux distributions set filetype in /etc/vimrc. " Clear filetype flags before changing runtimepath to force Vim to reload them.

ということで、.vimrcには以下のように設定する。
  filetype off
  filetype plugin indent off
  set runtimepath+=$GOROOT/misc/vim
  filetype plugin indent on
  syntax on