summaryrefslogtreecommitdiff
path: root/modules/prog-go.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-10-12 11:47:26 -0500
committerCraig Jennings <c@cjennings.net>2025-10-12 11:47:26 -0500
commit092304d9e0ccc37cc0ddaa9b136457e56a1cac20 (patch)
treeea81999b8442246c978b364dd90e8c752af50db5 /modules/prog-go.el
changing repositories
Diffstat (limited to 'modules/prog-go.el')
-rw-r--r--modules/prog-go.el41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/prog-go.el b/modules/prog-go.el
new file mode 100644
index 00000000..cf12cb6f
--- /dev/null
+++ b/modules/prog-go.el
@@ -0,0 +1,41 @@
+;;; prog-go --- Golang Specific Settings and Functionality -*- lexical-binding: t; coding: utf-8; -*-
+;; author Craig Jennings <c@cjennings.net>
+
+;;; Commentary:
+
+;;; Code:
+
+;; ---------------------------------- Go Setup ---------------------------------
+;; golang preferences
+
+(defun cj/go-setup ()
+ "My default code preferences for Golang."
+ (require 'tree-sitter)
+ (require 'tree-sitter-langs)
+ (require 'tree-sitter-hl)
+ (tree-sitter-hl-mode)
+ (hs-minor-mode)
+ (company-mode)
+ (setq-default tab-width 4) ;; set the tab width to 4 spaces
+ (setq-default standard-indent 4) ;; indent 4 spaces
+ (setq-default indent-tabs-mode nil) ;; disable tab characters
+ (electric-pair-mode t)) ;; match delimiters automatically
+(add-hook 'go-mode-hook 'cj/go-setup)
+
+;; ---------------------------------- Go Mode ----------------------------------
+;; go mode configuration
+
+(use-package go-mode
+ :bind (:map go-mode-map
+ ("<f6>" . gofmt)
+ ("C-c 6" . gofmt)
+ ("<f4>" . golint)
+ ("C-c 4" . golint))
+ :config
+ (add-to-list 'exec-path "~/go/bin")
+ ;; allow adding/removing fmt lines; install with:
+ ;; go install golang.org/x/tools/cmd/goimports@latest
+ (setq gofmt-command "goimports"))
+
+(provide 'prog-go)
+;;; prog-go.el ends here