Centos build Golang Environment, vim highlighting go keyword settings
1: Download https://golang.org/dl/download go1.4.1.linux-amd64.tar.gz archivelinux64-bit
2: Switch sudo permissions to unzip the/usr/local/directory under tar xzvf go1.3.linux-amd64.tar.gz-c/usr/local/
3: Return normal user permissions
4: Set Path VI ~/.bash_profile
Export Goroot=/usr/local/go
Export gobin= $GOROOT/bin
Export Gopath= $HOME/golang_git This is the download path when the git go Library is set
Path= $PATH: $GOBIN
Export PATH
5: ~/.bash_profile Complete
6: Test
VI Hello.go
Package Main
Import "FMT"
Func Main () {
Fmt. Printf ("What's a fucking day\n")
}
Compiling: Go build hello.go
Execution./hello
7: Found vim in the GO keyword is not highlighted, Google fix it
The go language comes with a syntax highlighting file with Vim.
1: Turn on VIM syntax highlighting
Vim ~/.VIMRC
Syntax on
Set FENCS=UTF-8,GBK
2: Copy the files in the/usr/local/go/misc/vim/directory to the ~/.vim/directory (if no new directory is available)
mkdir ~/.vim
Cp-r/usr/local/go/misc/vim/* ~/.vim/
3: New ~/.vim/ftdetect/go.vim, add the following content: Au bufread,bufnewfile *.go set Filetype=go
echo "Au bufread,bufnewfile *.go set filetype=go" > ~/.vim/ftdetect/go.vim
3 Steps to open the vim go keyword highlight rhythm
Centos build Golang Environment, vim highlighting go keyword settings