summary refs log tree commit diff
path: root/emacs.d/custom
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2020-03-19 17:33:25 -0700
committerFranck Cuny <franck.cuny@gmail.com>2020-03-19 17:33:25 -0700
commitfdf9eec068e49397faf718517ff79428ffda09fa (patch)
tree81cdfcfaf1c47e27d5fc821efda51bbb75affb31 /emacs.d/custom
parentemacs: move/delete some functions (diff)
downloademacs.d-fdf9eec068e49397faf718517ff79428ffda09fa.tar.gz
emacs: merge configuration related to prog-mode
For the various prog-mode, merge the configuration into a single file so
that it's easier to maintain (I guess ?)
Diffstat (limited to '')
-rw-r--r--emacs.d/custom/fcuny-go.el26
-rw-r--r--emacs.d/custom/fcuny-lisp.el7
-rw-r--r--emacs.d/custom/fcuny-make.el6
-rw-r--r--emacs.d/custom/fcuny-prog.el94
-rw-r--r--emacs.d/custom/fcuny-python.el9
-rw-r--r--emacs.d/custom/fcuny-shell.el9
6 files changed, 84 insertions, 67 deletions
diff --git a/emacs.d/custom/fcuny-go.el b/emacs.d/custom/fcuny-go.el
deleted file mode 100644
index d925cf6..0000000
--- a/emacs.d/custom/fcuny-go.el
+++ /dev/null
@@ -1,26 +0,0 @@
-(defun fcuny/go-mode-setup ()
-  (setq tab-width 4)
-  (setq comment-auto-fill-only-comments t)
-  (setq fill-column 80)
-  (auto-fill-mode 1))
-
-(use-package go-mode
-  :ensure t
-  :after (exec-path-from-shell flycheck flyspell company hydra)
-  :hook ((go-mode . fcuny/go-mode-setup)
-         (go-mode . lsp-deferred)
-         (before-save . lsp-format-buffer)
-         (before-save . lsp-organize-imports))
-  :config
-  (when (memq window-system '(mac ns))
-    (exec-path-from-shell-copy-env "GOPATH")))
-
-(use-package gotest
-  :ensure t
-  :after go-mode
-  :bind (:map go-mode-map
-              ("C-c ." . go-test-current-test)
-              ("C-c f" . go-test-current-file)
-              ("C-c a" . go-test-current-project)))
-
-(provide 'fcuny-go)
diff --git a/emacs.d/custom/fcuny-lisp.el b/emacs.d/custom/fcuny-lisp.el
deleted file mode 100644
index 70a0b6c..0000000
--- a/emacs.d/custom/fcuny-lisp.el
+++ /dev/null
@@ -1,7 +0,0 @@
-(use-package lisp-mode
-  :after (flycheck flyspell)
-  :bind
-  (("C-c C-e" . eval-buffer)
-   ("C-c C-r" . eval-region)))
-
-(provide 'fcuny-lisp)
diff --git a/emacs.d/custom/fcuny-make.el b/emacs.d/custom/fcuny-make.el
deleted file mode 100644
index 2479f62..0000000
--- a/emacs.d/custom/fcuny-make.el
+++ /dev/null
@@ -1,6 +0,0 @@
-(use-package make-mode
-  :after (flycheck flyspell)
-  :config
-  (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2))))
-
-(provide 'fcuny-make)
diff --git a/emacs.d/custom/fcuny-prog.el b/emacs.d/custom/fcuny-prog.el
index 60abc21..481995b 100644
--- a/emacs.d/custom/fcuny-prog.el
+++ b/emacs.d/custom/fcuny-prog.el
@@ -12,19 +12,38 @@
 (use-package company-posframe
   :ensure t
   :diminish company-posframe-mode
-  :hook (company-mode . company-posframe-mode)
-  :after company)
+  :hook (company-mode . company-posframe-mode))
 
 (use-package lsp-mode
   :ensure t
+  :hook ((go-mode . lsp-deferred))
   :commands (lsp lsp-deferred)
-  :bind (:map lsp-mode-map
-              ("C-c e b" . lsp-format-buffer)
-              ("C-c e m" . lsp-ui-imenu)
-              ("C-c e r" . lsp-rename)
-              ("C-c e p" . lsp-ui-peek-find-references)
-              ("C-c e d" . lsp-ui-peek-find-definitions)
-              ("C-c e t" . lsp-find-type-definition))
+  :pretty-hydra
+  ((:title "lsp" :color teal :quit-key "q")
+   ("Connection"
+    (("cc" lsp "start")
+     ("cr" lsp-restart-workspace "restart")
+     ("cd" lsp-describe-session "describe session")
+     ("cq" lsp-disconnect "disconnect"))
+    "Find & Goto"
+    (("fd" lsp-describe-thing-at-point "describe symbol")
+     ("fm" lsp-ui-imenu "imenu")
+     ("ft" lsp-find-type-definition "type definition"))
+    "Refactor"
+    (("rr" lsp-rename "rename")
+     ("ra" lsp-execute-code-action "code action")
+     ("rf" lsp-format-buffer "format"))
+    "Toggles"
+    (("tl" lsp-lens-mode "toggle lens" :toggle t :exit nil))))
+  :mode-hydra
+  ((go-mode)
+   (:color teal :quit-key "q" :title "Language Server Commands")
+   ("LSP"
+    (("d" lsp-describe-thing-at-point "describe")
+     ("R" lsp-rename "rename")
+     ("A" lsp-execute-code-action "code action")
+     ("F" lsp-format-buffer "format")
+     ("l" lsp-mode-hydra/body "more..."))))
   :custom
   (lsp-session-file (expand-file-name "lsp-session-v1" fcuny/path-emacs-var))
   (lsp-enable-snippet nil)
@@ -32,7 +51,16 @@
 
 (use-package lsp-ui
   :ensure t
+  :hook (lsp-mode . lsp-ui-mode)
   :commands lsp-ui-mode
+  :pretty-hydra
+  (lsp-mode-hydra
+   ("Toggles"
+    (("td" lsp-ui-doc-mode "toggle hover doc" :toggle t :exit nil)
+     ("ts" lsp-ui-sideline-mode "toggle sideline" :toggle t :exit nil))
+    "Find & Goto"
+    (("gr" lsp-ui-peek-find-references "references")
+     ("gd" lsp-ui-peek-find-definitions "definitions"))))
   :custom
   (lsp-ui-doc-enable nil)
   (lsp-ui-doc-include-signature t)
@@ -43,7 +71,6 @@
 
 (use-package company-lsp
   :ensure t
-  :after company
   :commands company-lsp
   :config
   (push 'company-lsp company-backends)
@@ -51,4 +78,51 @@
   (company-lsp-enable-snippet t)
   (company-lsp-cache-candidates t))
 
+(use-package sh-script
+  :mode ("bashrc" . sh-mode)
+  :hook (after-save . executable-make-buffer-file-executable-if-script-p)
+  :config
+  (setq-default sh-indentation 2
+                sh-basic-offset 2))
+
+(use-package python
+  :mode (("\\.py$"     . python-mode)
+         ("\\.aurora$" . python-mode))
+  :commands python-mode
+  :hook ((python-mode . eldoc-mode))
+  :custom (python-indent-offset 2))
+
+(use-package make-mode
+  :config
+  (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2))))
+
+(defun fcuny/go-mode-setup ()
+  (setq tab-width 4)
+  (setq comment-auto-fill-only-comments t)
+  (setq fill-column 80)
+  (auto-fill-mode 1))
+
+(use-package go-mode
+  :ensure t
+  :hook ((go-mode . fcuny/go-mode-setup)
+         (before-save . lsp-format-buffer)
+         (before-save . lsp-organize-imports))
+  :config
+  (when (memq window-system '(mac ns))
+    (exec-path-from-shell-copy-env "GOPATH")))
+
+(use-package gotest
+  :ensure t
+  :mode-hydra
+  (go-mode nil
+           ("Tests"
+            (("tt" go-test-current-test "current test")
+             ("tf" go-test-current-file "current file")
+             ("tp" go-test-current-project "current project")))))
+
+(use-package lisp-mode
+  :bind
+  (("C-c C-e" . eval-buffer)
+   ("C-c C-r" . eval-region)))
+
 (provide 'fcuny-prog)
diff --git a/emacs.d/custom/fcuny-python.el b/emacs.d/custom/fcuny-python.el
deleted file mode 100644
index b0eff5f..0000000
--- a/emacs.d/custom/fcuny-python.el
+++ /dev/null
@@ -1,9 +0,0 @@
-(use-package python
-  :after (flycheck flyspell)
-  :mode (("\\.py$"     . python-mode)
-         ("\\.aurora$" . python-mode))
-  :commands python-mode
-  :hook ((python-mode . eldoc-mode))
-  :custom (python-indent-offset 2))
-
-(provide 'fcuny-python)
diff --git a/emacs.d/custom/fcuny-shell.el b/emacs.d/custom/fcuny-shell.el
deleted file mode 100644
index b5de9c0..0000000
--- a/emacs.d/custom/fcuny-shell.el
+++ /dev/null
@@ -1,9 +0,0 @@
-(use-package sh-script
-  :after (flyspell flycheck)
-  :mode ("bashrc" . sh-mode)
-  :hook (after-save . executable-make-buffer-file-executable-if-script-p)
-  :config
-  (setq-default sh-indentation 2
-                sh-basic-offset 2))
-
-(provide 'fcuny-shell)