FG42/lib/extensions/go/init.el

29 lines
817 B
EmacsLisp
Raw Normal View History

;;; go-init --- The entry point for golang extension
;;; Commentary:
;;; Code:
(defun fg42-go-hook ()
2020-02-23 18:09:37 +00:00
"Setup emacs hooks and turn necessary modes on. "
(lsp)
2020-02-23 17:56:58 +00:00
(with-ability yas
(yas-minor-mode-on))
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t)
(add-hook 'go-mode-hook 'go-eldoc-setup)
(local-set-key (kbd "M-.") #'godef-jump)
(local-set-key (kbd "M-*") 'pop-tag-mark))
2020-02-23 14:11:32 +00:00
2020-02-23 18:09:37 +00:00
(defun go-path () (exec-path-from-shell-copy-env "GOPATH"))
2020-02-23 14:11:32 +00:00
(defun go-path-binary () (concat (go-path) "/bin"))
2020-02-23 16:27:37 +00:00
(defun extensions/go-initialize ()
2020-02-23 14:11:32 +00:00
"""Initialize Golang extension ."""
2020-02-23 18:09:37 +00:00
(exec-path-from-shell-initialize)
2020-02-23 14:11:32 +00:00
(add-to-list 'exec-path (go-path-binary))
(add-hook 'go-mode-hook 'fg42-go-hook))
(provide 'extensions/go/init)
;;; init ends here.