diff --git a/init.el b/init.el index 95b1715..36d7a44 100644 --- a/init.el +++ b/init.el @@ -471,6 +471,58 @@ "tf" '(slime-toggle-fancy-trace)) +(general-define-key + :states '(normal visual emacs) + :prefix "SPC m" + :keymaps 'go-mode-map + "hh" '(godoc-at-point + :which-key "godoc at point") + "ig" '(go-goto-imports + :which-key "goto imports") + "ia" '(go-import-add + :which-key "add imports") + "ir" '(go-remove-unused-imports + :which-key "remove unused imports") + "eb" '(go-play-buffer + :which-key "go-play buffer") + "er" '(go-play-region + :which-key "go-play region") + "ed" '(go-download-play + :which-key "download go-play snippet") + "xx" '(go-run-main + :which-key "run go run for current main package") + "ga" '(ff-find-other-file + :which-key "jump to matching test file or back") + "gc" '(go-coverage + :which-key "open a clone of buffer with coverage info") + "rn" '(go-rename + :which-key "go rename") + + "fd" '(go-guru-describe + :which-key "go-guru describe symbol at point") + "ff" '(go-guru-freevars + :which-key "go-guru show free variables") + "fi" '(go-guru-implements + :which-key "go-guru show implements relation") + "fc" '(go-guru-peers + :which-key "go-guru show channel sends/receives") + "fr" '(go-guru-referrers + :which-key "go-guru show referrers") + "fj" '(go-guru-definition + :which-key "go-guru jump to symbol definition") + "fp" '(go-guru-pointsto + :which-key "go-guru show what select expr points to") + "fs" '(go-guru-callstack + :which-key "go-guru show call stack") + "fe" '(go-guru-whicherrs + :which-key "go-guru show possible constants/types for error value") + "f<" '(go-guru-callers + :which-key "go-guru show possible callers") + "f>" '(go-guru-callees + :which-key "go-guru show call targets") + "fo" '(go-guru-set-scope + :which-key "go-guru set analysis scope")) + ;; custom functions (defun haskell-intero/insert-type () (interactive) @@ -499,6 +551,12 @@ (split-width-threshold 140)) (helm-gtags-dwim))) +(defun go-run-main () + (interactive) + (shell-command + (format "go run %s" + (shell-quote-argument (buffer-file-name))))) + ;; Fancy titlebar for MacOS (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) (add-to-list 'default-frame-alist '(ns-appearance . dark)) @@ -564,7 +622,9 @@ (spaceline-toggle-buffer-size-off) (spaceline-toggle-evil-state-on)) -;; Language Support +;;; Language Support + +;; Haskell support (use-package company-ghci :defer t :config @@ -598,6 +658,7 @@ :hook (prog-mode-hook . rainbow-delimiters-mode)) +;; Rust support (use-package rust-mode :defer t :ensure t @@ -612,9 +673,9 @@ (use-package cargo :defer t) +;; LISP support (use-package evil-cleverparens :ensure t) - (use-package parinfer :ensure t :init @@ -629,7 +690,6 @@ ((emacs-lisp-mode . parinfer-mode) (common-lisp-mode . parinfer-mode) (lisp-mode . parinfer-mode))) - (use-package slime :commands slime-mode :init @@ -649,4 +709,23 @@ :config (slime-setup)) +;; go support +(use-package company-go + :defer t + :init + (progn + (setq company-go-show-annotation t) + (push 'company-go company-backends))) +(use-package go-impl + :defer t) +(use-package go-guru + :defer t) +(use-package go-mode + :defer t + :init + (setq-local tab-width 8) + :hook + ((before-save . 'gofmt-before-save) + (go-mode . company-mode))) + ;;; init.el ends