Add go to go

This commit is contained in:
Maciej 2018-01-06 21:22:59 +02:00
parent e122cca29d
commit 979c0e8787
Signed by: maciej
GPG key ID: 41D62D42D3B0D765
6 changed files with 45 additions and 2 deletions

View file

@ -91,7 +91,9 @@
; Use Shells variables
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
(exec-path-from-shell-initialize)
(exec-path-from-shell-copy-env "GOPATH")
(exec-path-from-shell-copy-env "GOROOT"))
;;;;;;;;;;;;;;;;;;;;;; indentation functions ;;;;;;;;;;;;;;;;;;;;;;

View file

@ -16,6 +16,7 @@
(load "~/.emacs.d/languages/js.elc")
(load "~/.emacs.d/languages/sql.elc")
(load "~/.emacs.d/languages/haskell.elc")
(load "~/.emacs.d/languages/go.elc")
;;; Java
(defun java-mode-config ()

View file

@ -226,6 +226,16 @@
(unless (package-installed-p 'pyenv-mode)
(package-install 'pyenv-mode))
;; Go
(unless (package-installed-p 'go-mode)
(package-install 'go-mode))
(unless (package-installed-p 'company-go)
(package-install 'company-go))
(unless (package-installed-p 'flymake-go)
(package-install 'flymake-go))
;; SQL
(unless (package-installed-p 'sql-indent)
(package-install 'sql-indent))

View file

@ -17,6 +17,8 @@
'("test_.*\\.py\\(<.*>\\)?$" . test)) ;; Pytest
(add-to-list 'purpose-user-regexp-purposes
'("tests.rs\\(<.*>\\)?$" . test)) ;; Rust tests
(add-to-list 'purpose-user-regexp-purposes
'("_test.go\\(<.*>\\)?$" . test)) ;; Go tests
(add-to-list 'purpose-user-mode-purposes '(shell-mode . test))
(add-to-list 'purpose-user-mode-purposes '(magit-diff-mode . test))
@ -41,6 +43,7 @@
(add-to-list 'purpose-user-mode-purposes '(js-mode . code))
(add-to-list 'purpose-user-mode-purposes '(emacs-lisp-mode . code))
(add-to-list 'purpose-user-mode-purposes '(sql-mode . code))
(add-to-list 'purpose-user-mode-purposes '(go-mode . code))
;; Other files that fall into 'code'
(add-to-list 'purpose-user-mode-purposes '(xml-mode . code))

View file

@ -27,7 +27,7 @@
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(sql-indent json-mode terraform-mode flycheck-rust company-ghc company-ghci scion hlinum etags-select nvm tide yaml-mode window-purpose web-mode ujelly-theme toml-mode smart-mode-line scala-mode rvm ruby-end rspec-mode robe rainbow-mode rainbow-delimiters racer pyenv-mode noctilux-theme monokai-theme markdown-mode less-css-mode json-reformat jade-mode indent-guide helm-themes helm-projectile helm-ag haskell-mode haml-mode groovy-mode flymake-ruby flymake-cursor flycheck flatui-theme exec-path-from-shell evil-nerd-commenter evil-magit evil-leader elpy dumb-jump dockerfile-mode diff-hl dash-at-point company-tern company-racer company-jedi column-enforce-mode color-theme-approximate base16-theme atom-one-dark-theme alchemist aggressive-indent ag)))
(flymake-go go-flymake flycheck-go company-go go-mode expand-region sql-indent json-mode terraform-mode flycheck-rust company-ghc company-ghci scion hlinum etags-select nvm tide yaml-mode window-purpose web-mode ujelly-theme toml-mode smart-mode-line scala-mode rvm ruby-end rspec-mode robe rainbow-mode rainbow-delimiters racer pyenv-mode noctilux-theme monokai-theme markdown-mode less-css-mode json-reformat jade-mode indent-guide helm-themes helm-projectile helm-ag haskell-mode haml-mode groovy-mode flymake-ruby flymake-cursor flycheck flatui-theme exec-path-from-shell evil-nerd-commenter evil-magit evil-leader elpy dumb-jump dockerfile-mode diff-hl dash-at-point company-tern company-racer company-jedi column-enforce-mode color-theme-approximate base16-theme atom-one-dark-theme alchemist aggressive-indent ag)))
'(safe-local-variable-values (quote ((encoding . utf-8)))))
(custom-set-faces
;; custom-set-faces was added by Custom.

27
languages/go.el Normal file
View file

@ -0,0 +1,27 @@
;;; Go -- summary
;;; Commentary:
;; Code:
;;========== Editor config =========================
(defun editor-config-go ()
"Editor configuration for Go."
(set-indent 4)
(set-width-99))
;;========== Code completion =======================
(defun completion-config-go ()
"Code completion and inspection for Go."
(company-mode 1)
(flycheck-mode 1)
(flymake-mode 1)
(set (make-local-variable 'company-backends)
'((company-go company-capf company-dabbrev-code company-yasnippet
company-files))))
;;========== Hooks =================================
(add-hook 'go-mode-hook 'editor-config-go)
(add-hook 'go-mode-hook 'completion-config-go)
(provide 'go)
;;; go.el ends here