Emacs mode for Go? [closed]

2019-03-08 17:08发布

Is there a suitable Emacs mode for Go? C mode doesn't work without semicolons. The best I have found is the JavaScript mode by Karl Landstrom, since JavaScript also doesn't require semicolons.

标签: emacs elisp go
5条回答
Viruses.
2楼-- · 2019-03-08 17:42

Try misc/emacs/go-mode.el (web link) in the Go distribution.

If you are using Emacs 24 and marmalade repo, use M-x package-install <RET> go-mode to install it directly.

查看更多
狗以群分
3楼-- · 2019-03-08 17:44

If your Go installs to /usr/local/go then add the following to your .emacs file.

;; go mode                                                                                           
(setq load-path (cons "/usr/local/go/misc/emacs" load-path))                                         
(require 'go-mode-load)
查看更多
啃猪蹄的小仙女
4楼-- · 2019-03-08 17:51

Read Writing Go in Emacs and its follow-up, written by Dominik Honnef, the author of the official go-mode.

There he explains the story of go-mode and ways to install it, how to read Go documentation from inside Emacs, how to manage import statements of Go files in Emacs, how to setup autocomplete, on-the-fly syntax checking, snippets, and a lot of other super useful features for developing Go in Emacs.

查看更多
Animai°情兽
5楼-- · 2019-03-08 17:56

Update from 2014 for Linux users

You can now download the golang-mode for Emacs from your package manager:

  • Fedora: yum install emacs-golang
  • Debian: apt-get install golang-mode
  • Ubuntu: apt-get install golang-mode

I only checked on Fedora, but the package is automatically installed and you have nothing to do except enjoying your new golang mode! And it is also updated as any other package of your system.

There are probably packages on other Linux distributions too.

查看更多
迷人小祖宗
6楼-- · 2019-03-08 18:05

Yes, there is. It is in the source code, inside the misc/emacs dir.

查看更多
登录 后发表回答