github.com/varialus/godfly@v0.0.0-20130904042352-1934f9f095ab/misc/vim/readme.txt (about) 1 Vim plugins for Go (http://golang.org) 2 ====================================== 3 4 To use all the Vim plugins, add these lines to your $HOME/.vimrc. 5 6 " Some Linux distributions set filetype in /etc/vimrc. 7 " Clear filetype flags before changing runtimepath to force Vim to reload them. 8 filetype off 9 filetype plugin indent off 10 set runtimepath+=$GOROOT/misc/vim 11 filetype plugin indent on 12 syntax on 13 14 If you want to select fewer plugins, use the instructions in the rest of 15 this file. 16 17 18 Vim syntax highlighting 19 ----------------------- 20 21 To install automatic syntax highlighting for GO programs: 22 23 1. Copy or link the filetype detection script to the ftdetect directory 24 underneath your vim runtime directory (normally $HOME/.vim/ftdetect) 25 2. Copy or link syntax/go.vim to the syntax directory underneath your vim 26 runtime directory (normally $HOME/.vim/syntax). Linking this file rather 27 than just copying it will ensure any changes are automatically reflected 28 in your syntax highlighting. 29 3. Add the following line to your .vimrc file (normally $HOME/.vimrc): 30 31 syntax on 32 33 In a typical unix environment you might accomplish this using the following 34 commands: 35 36 mkdir -p $HOME/.vim/ftdetect 37 mkdir -p $HOME/.vim/syntax 38 mkdir -p $HOME/.vim/autoload/go 39 ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/ 40 ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax 41 ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go 42 echo "syntax on" >> $HOME/.vimrc 43 44 45 Vim filetype plugins 46 -------------------- 47 48 To install one of the available filetype plugins: 49 50 1. Same as 1 above. 51 2. Copy or link ftplugin/go.vim to the ftplugin directory underneath your vim 52 runtime directory (normally $HOME/.vim/ftplugin). Copy or link one or more 53 additional plugins from ftplugin/go/*.vim to the Go-specific subdirectory 54 in the same place ($HOME/.vim/ftplugin/go/*.vim). 55 3. Add the following line to your .vimrc file (normally $HOME/.vimrc): 56 57 filetype plugin on 58 59 60 Vim indentation plugin 61 ---------------------- 62 63 To install automatic indentation: 64 65 1. Same as 1 above. 66 2. Copy or link indent/go.vim to the indent directory underneath your vim 67 runtime directory (normally $HOME/.vim/indent). 68 3. Add the following line to your .vimrc file (normally $HOME/.vimrc): 69 70 filetype indent on 71 72 73 Vim compiler plugin 74 ------------------- 75 76 To install the compiler plugin: 77 78 1. Same as 1 above. 79 2. Copy or link compiler/go.vim to the compiler directory underneath your vim 80 runtime directory (normally $HOME/.vim/compiler). 81 3. Activate the compiler plugin with ":compiler go". To always enable the 82 compiler plugin in Go source files add an autocommand to your .vimrc file 83 (normally $HOME/.vimrc): 84 85 autocmd FileType go compiler go 86 87 88 Godoc plugin 89 ------------ 90 91 To install godoc plugin: 92 93 1. Same as 1 above. 94 2. Copy or link plugin/godoc.vim to $HOME/.vim/plugin/godoc, 95 syntax/godoc.vim to $HOME/.vim/syntax/godoc.vim, 96 and autoload/go/complete.vim to $HOME/.vim/autoload/go/complete.vim.