昨天看到同事再用emacs,好强大的样子,让我这种伪emacser羡慕不已,回来之后就寻思着再折腾折腾emacs.
首先下载golang官方的emacs mode:
http://golang.org/misc/emacs/go-mode.el
下载auto-complete
http://cx4a.org/software/auto-complete/#Downloads
然后解压文件到任意目录:auto-complete
cd auto-complete
make
make install
选择要安装到得目录
(add-to-list 'load-path "INSTALLPATH/auto-complete") (require 'auto-complete) (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "INSTALLPATH/auto-complete/ac-dict") (ac-config-default)从 https://code.google.com/p/go上下载misc/emacs下面的两个文件:
go-mode.el
go-mode-load.el
下载gocode:
go get -u github.com/nsf/gocode
gocode set propose-builtins true
gocode set lib-path "/usr/lib/go/pkg/linux_amd64/:YOUR_OWN_GOPATH/pkg/linux_amd64" // 这个是自己的路径
然后修改~/.profile来设置PATH:
export GOPATH=YOUR_OWN_GOPATH export PATH=$PATH:$GOPATH/bin gocode -s
(require 'go-autocomplete) (require 'auto-complete-config) (require 'go-mode-load)这样系统只要启动就能够自动的设置好环境变量,并且运行gocode了 原文链接:https://www.f2er.com/go/191299.html