summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/custom/fcuny-prog.el99
1 files changed, 66 insertions, 33 deletions
diff --git a/emacs/custom/fcuny-prog.el b/emacs/custom/fcuny-prog.el
index 3da3bf5..6246863 100644
--- a/emacs/custom/fcuny-prog.el
+++ b/emacs/custom/fcuny-prog.el
@@ -1,8 +1,45 @@
+;;; fcuny-prog.el --- Configures emacs for various programming languages
+;;; Commentary:
+
+;;; Code:
+
(require 'fcuny-vars)
+(require 'use-package)
(use-package man
- :init
- (setq Man-notify-method 'aggressive))
+ :custom
+ (Man-notify-method 'aggressive)
+ (Man-fontify-manpage-flag t))
+
+(use-package compile
+ :ensure nil
+ :custom
+ (compilation-scroll-output t)
+ ;; Skip over warnings and info messages in compilation
+ (compilation-skip-threshold 2)
+ ;; Don't freeze when process reads from stdin
+ (compilation-disable-input t)
+ ;; Show three lines of context around the current message
+ (compilation-context-lines 3))
+
+(use-package flymake
+ :ensure nil
+ :hook ((prog-mode . flymake-mode)
+ (conf-mode . flymake-mode))
+ :bind (:map flymake-mode-map (("C-c ! s" . flymake-start)
+ ("C-c ! d" . flymake-show-buffer-diagnostics)
+ ("C-c ! n" . flymake-goto-next-error)
+ ("C-c ! p" . flymake-goto-prev-error)))
+ :custom
+ (elisp-flymake-byte-compile-load-path load-path))
+
+;; yasnippet is required to support place holders with eglot
+(use-package yasnippet
+ :ensure t
+ :hook
+ ((prog-mode org-mode dap-ui-repl-mode conf-mode) . yas-minor-mode)
+ :config
+ (yas-reload-all))
(use-package auto-fill
:hook (prog-mode . auto-fill-mode)
@@ -14,6 +51,7 @@
(use-package company
:ensure t
:diminish company-mode
+ :hook (prog-mode . company-mode)
:custom
(company-minimum-prefix-length 2)
(company-tooltip-align-annotations t)
@@ -26,10 +64,30 @@
(dolist (hook '(emacs-lisp-mode-hook))
(add-hook hook #'lispy-mode)))
+(use-package eldoc
+ :ensure nil
+ :hook
+ ((prog-mode conf-mode) . eldoc-mode)
+ :bind ("C-c C-h" . eldoc))
+
(use-package eglot
+ :after (yasnippet company)
+ :commands (eglot eglot-ensure)
:ensure t
- :hook ((go-mode . eglot-ensure)
- (nix-mode . eglot-ensure)))
+ :bind (:map eglot-mode-map
+ ("C-c C-r" . eglot-rename)
+ ("C-c C-a" . eglot-code-actions))
+ :hook ((go-mode . eglot-ensure)
+ (nix-mode . eglot-ensure)
+ (eglot-managed-mode-hook . turn-on-eldoc-mode))
+ :init
+ (setq-default eglot-workspace-configuration
+ ;; List of settings for gopls:
+ ;; https://github.com/golang/tools/blob/master/gopls/doc/settings.md
+ '((:gopls .
+ ((staticcheck . t)
+ (matcher . "CaseSensitive")
+ (usePlaceholders . t))))))
(use-package sh-script
:mode ("bashrc" . sh-mode)
@@ -48,28 +106,14 @@
:config
(add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2))))
-
-(defun fcuny/setup-go-mode-compile ()
- (if (not (string-match "go" compile-command))
- (set (make-local-variable 'compile-command)
- "go build -v")))
-
-;; we need to install the following tools:
-;; go get golang.org/x/tools/gopls@latest
-;; go get golang.org/x/lint/golint@latest
-;; go get honnef.co/go/tools/cmd/staticcheck
(use-package go-mode
+ :after (eglot)
:ensure t
- :hook ((before-save . lsp-format-buffer)
- (before-save . lsp-organize-imports)
- (go-mode . fcuny/setup-go-mode-compile))
- :config
- (when (memq window-system '(mac ns))
- (exec-path-from-shell-copy-env "GOPATH"))
:custom
(tab-width 4))
(use-package gotest
+ :after (go-mode)
:ensure t)
(use-package lisp-mode
@@ -77,21 +121,10 @@
(("C-c C-e" . eval-buffer)
("C-c C-r" . eval-region)))
-(use-package compile
- :ensure nil
- :custom
- (compilation-scroll-output t)
- ;; Skip over warnings and info messages in compilation
- (compilation-skip-threshold 2)
- ;; Don't freeze when process reads from stdin
- (compilation-disable-input t)
- ;; Show three lines of context around the current message
- (compilation-context-lines 3))
-
(use-package nix-mode
:ensure t
:mode "\\.nix\\'"
- :hook ((before-save . nix-format-before-save))
- :config)
+ :hook ((before-save . nix-format-before-save)))
(provide 'fcuny-prog)
+;;; fcuny-prog.el ends here