Emacs: Add go-eval-buffer and bindings
parent
6ceae4c1b9
commit
7e8c34f129
|
@ -2,13 +2,22 @@
|
|||
;; Go
|
||||
;;==============================================================================
|
||||
|
||||
(defun go-eval-buffer ()
|
||||
"Eval buffer with `go run'."
|
||||
(interactive)
|
||||
(let ((compile-command-backup compile-command))
|
||||
(compile (concat "go run " (shell-quote-argument buffer-file-name)))
|
||||
(setq compile-command compile-command-backup)))
|
||||
|
||||
(add-hook-and-eval
|
||||
'go-mode-hook
|
||||
(lambda ()
|
||||
(add-hook 'before-save-hook #'gofmt-before-save nil t)
|
||||
(local-set-key (kbd "C-c m") 'go-main)
|
||||
(local-set-key (kbd "C-c C-d") 'godoc)
|
||||
(set (make-local-variable 'compile-command) (concat "go run " (shell-quote-argument buffer-file-name)))))
|
||||
(local-set-key (kbd "C-c d") 'godoc)
|
||||
(local-set-key (kbd "M-.") #'godef-jump)
|
||||
(local-set-key (kbd "C-<f10>") 'go-eval-buffer)
|
||||
(set (make-local-variable 'compile-command) "go build")))
|
||||
|
||||
(define-skeleton go-main
|
||||
"Insert main function with basic includes."
|
||||
|
|
Loading…
Reference in New Issue