Text file misc/vim/readme.txt
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 Vim syntax highlighting
18 -----------------------
19
20 To install automatic syntax highlighting for GO programs:
21
22 1. Copy or link the filetype detection script to the ftdetect directory
23 underneath your vim runtime directory (normally $HOME/.vim/ftdetect)
24 2. Copy or link syntax/go.vim to the syntax directory underneath your vim
25 runtime directory (normally $HOME/.vim/syntax). Linking this file rather
26 than just copying it will ensure any changes are automatically reflected
27 in your syntax highlighting.
28 3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
29
30 syntax on
31
32 In a typical unix environment you might accomplish this using the following
33 commands:
34
35 mkdir -p $HOME/.vim/ftdetect
36 mkdir -p $HOME/.vim/syntax
37 mkdir -p $HOME/.vim/autoload/go
38 ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/
39 ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax
40 ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go
41 echo "syntax on" >> $HOME/.vimrc
42
43
44 Vim filetype plugins
45 --------------------
46
47 To install one of the available filetype plugins:
48
49 1. Same as 1 above.
50 2. Copy or link one or more plugins from ftplugin/go/*.vim to the
51 Go-specific ftplugin directory underneath your vim runtime directory
52 (normally $HOME/.vim/ftplugin/go/*.vim).
53 3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
54
55 filetype plugin on
56
57
58 Vim indentation plugin
59 ----------------------
60
61 To install automatic indentation:
62
63 1. Same as 1 above.
64 2. Copy or link indent/go.vim to the indent directory underneath your vim
65 runtime directory (normally $HOME/.vim/indent).
66 3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
67
68 filetype indent on
69
70
71 Godoc plugin
72 ------------
73
74 To install godoc plugin:
75
76 1. Same as 1 above.
77 2. Copy or link plugin/godoc.vim to $HOME/.vim/plugin/godoc,
78 syntax/godoc.vim to $HOME/.vim/syntax/godoc.vim,
79 and autoload/go/complete.vim to $HOME/.vim/autoload/go/complete.vim.
View as plain text