Remove def-menu!; use :localleader keys instead

def-menu was clumsy. We could use a better UI for refactoring commands,
but they should be available via localleader keybinds in any case.
This commit is contained in:
Henrik Lissner 2018-09-04 03:04:00 +02:00
parent d2f9d28577
commit 84abac6b69
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
7 changed files with 77 additions and 280 deletions

View file

@ -21,51 +21,35 @@
(add-hook 'go-mode-hook #'go-eldoc-setup)
(def-menu! +go/refactor-menu
"Refactoring commands for `go-mode' buffers."
'(("Add import" :exec go-import-add :region nil)
("Remove unused imports" :exec go-remove-unused-imports :region nil)
("Format buffer (gofmt)" :exec go-gofmt))
:prompt "Refactor: ")
(def-menu! +go/build-menu
"Build/compilation commands for `go-mode' buffers."
'(("Build project" :exec "go build")
("Build & run project" :exec "go run")
("Clean files" :exec "go clean"))
:prompt "Run test: ")
(def-menu! +go/test-menu
"Test commands for `go-mode' buffers."
'(("Last test" :exec +go/test-rerun)
("All tests" :exec +go/test-all)
("Single test" :exec +go/test-single)
("Nested test" :exec +go/test-nested))
:prompt "Run test: ")
(def-menu! +go/help-menu
"Help and information commands for `go-mode' buffers."
'(("Go to imports" :exec go-goto-imports)
("Lookup in godoc" :exec godoc-at-point)
("Describe this" :exec go-guru-describe)
("List free variables" :exec go-guru-freevars)
("What does this point to" :exec go-guru-pointsto)
("Implements relations for package types" :exec go-guru-implements :region nil)
("List peers for channel" :exec go-guru-peers)
("List references to object" :exec go-guru-referrers)
("Which errors" :exec go-guru-whicerrs)
("What query" :exec go-guru-what)
("Show callers of this function" :exec go-guru-callers :region nil)
("Show callees of this function" :exec go-guru-callees :region nil)))
(map! :map go-mode-map
:localleader
:nr "r" #'+go/refactor-menu
:n "b" #'+go/build-menu
:n "h" #'+go/help-menu
:n "t" #'+go/test-menu
:n "r" #'go-play-buffer
:v "r" #'go-play-region))
:n "r" #'go-play-buffer
:v "r" #'go-play-region
:n "i" #'go-goto-imports ; Go to imports
(:prefix "h"
:n "." #'godoc-at-point ; Lookup in godoc
:n "d" #'go-guru-describe ; Describe this
:n "v" #'go-guru-freevars ; List free variables
:n "i" #'go-guru-implements ; Implements relations for package types
:n "p" #'go-guru-peers ; List peers for channel
:n "P" #'go-guru-pointsto ; What does this point to
:n "r" #'go-guru-referrers ; List references to object
:n "e" #'go-guru-whicherrs ; Which errors
:n "w" #'go-guru-what ; What query
:n "c" #'go-guru-callers ; Show callers of this function
:n "C" #'go-guru-callees) ; Show callees of this function
(:prefix "r"
:n "ia" #'go-import-add
:n "ir" #'go-remove-unused-imports)
(:prefix "b"
:n "r" (λ! (compile "go run"))
:n "b" (λ! (compile "go build"))
:n "c" (λ! (compile "go clean")))
(:prefix "t"
:n "t" #'+go/test-rerun
:n "a" #'+go/test-all
:n "s" #'+go/test-single
:n "n" #'+go/test-nested)))
(def-package! gorepl-mode