diff options
author | David Morgan <djm_uk@protonmail.com> | 2021-05-26 10:06:56 +0000 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2021-05-26 10:06:56 +0000 |
commit | b5e8c2052c43e9865aad35380ff0b36cabae19d2 (patch) | |
tree | 64df1a2604066e1f5d3c0c2fc6a01ce85090d17b /emacs-prelude/personal/lisp | |
parent | ccfeb564b6507fdf9b202527f90e6d11d50350eb (diff) | |
download | dotfiles-b5e8c2052c43e9865aad35380ff0b36cabae19d2.tar.gz |
Add emacs prelude config
Diffstat (limited to 'emacs-prelude/personal/lisp')
-rw-r--r-- | emacs-prelude/personal/lisp/init-clojure.el | 35 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-completion.el | 69 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-dashboard.el | 15 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-hydra.el | 7 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-lisp.el | 13 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-lsp.el | 23 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-modeline.el | 14 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-paredit.el | 27 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-prelude.el | 22 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-ui.el | 16 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-use-package.el | 7 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/paredit-functions.el | 102 |
12 files changed, 350 insertions, 0 deletions
diff --git a/emacs-prelude/personal/lisp/init-clojure.el b/emacs-prelude/personal/lisp/init-clojure.el new file mode 100644 index 0000000..174dffd --- /dev/null +++ b/emacs-prelude/personal/lisp/init-clojure.el @@ -0,0 +1,35 @@ +(require 'init-lisp) + +(prelude-require-package 'yasnippet) +(use-package yasnippet + :diminish yas) + +(prelude-require-package 'flycheck-clj-kondo) +(use-package clojure-mode + :config + (require 'flycheck-clj-kondo)) + +(prelude-require-package 'clj-refactor) +(use-package clj-refactor + :diminish + :bind ("C-c '" . hydra-cljr-help-menu/body) + :config + (cljr-add-keybindings-with-prefix "C-c C-m") + (setq cljr-suppress-no-project-warning t) + :hook + (clojure-mode . + (lambda () + (clj-refactor-mode 1) + (yas-minor-mode 1)))) + +(use-package cider + :config + (setq cider-repl-pop-to-buffer-on-connect 'display-only + cider-repl-display-help-banner nil + cider-repl-history-highlight-current-entry t + cider-repl-history-highlight-inserted-item t + cider-repl-use-clojure-font-lock t + cider-repl-use-pretty-printing t)) + +(provide 'init-clojure) + diff --git a/emacs-prelude/personal/lisp/init-completion.el b/emacs-prelude/personal/lisp/init-completion.el new file mode 100644 index 0000000..c34ea45 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-completion.el @@ -0,0 +1,69 @@ +(setq tab-always-indent 'complete) + +(use-package company + :bind (("M-/" . company-complete)) + :hook (after-init . company-tng-mode) + :config + (global-company-mode) + (setq company-idle-delay 0.3 + company-selection-wrap-around t + company-show-numbers t + company-tooltip-align-annotations t + company-require-match nil)) + +(prelude-require-package 'company-quickhelp) +(use-package company-quickhelp + :diminish + :hook (global-company-mode . company-quickhelp-mode)) + +(prelude-require-package 'company-box) +(use-package company-box + :diminish + :hook (company-mode . company-box-mode) + :config + (setq company-box-backends-colors nil ;; TODO why? + company-box-doc-delay 0.3)) + +(prelude-require-package 'ivy-prescient) +(use-package ivy-prescient + :diminish + :config + (ivy-prescient-mode 1)) + +(prelude-require-package 'company-prescient) +(use-package company-prescient + :diminish + :config + (company-prescient-mode 1)) + +(use-package counsel + :diminish ivy-mode counsel-mode + :config + (setq counsel-grep-base-command "rg -i -M 120 --no-heading --line-number --color never '%s' %s" + counsel-rg-base-command "rg -i -M 120 --no-heading --line-number --color never '%s' %s") + :bind (("C-c h" . counsel-command-history) + ;("C-c i" . counsel-git) + ;("C-c j" . counsel-git-grep) + ("C-c c g" . counsel-grep) + ("C-c c r" . counsel-rg) + ("C-c c o" . counsel-outline) + ("C-c z" . counsel-fzf) + ("C-c c z" . counsel-fzf) + ("C-c c a" . counsel-apropos) + ("C-c c f" . counsel-recentf) + ("C-c C-f" . counsel-recentf) + :map counsel-mode-map + ([remap swiper] . counsel-grep-or-swiper) + ([remap swiper-backward] . counsel-grep-or-swiper-backward) + ;([remap recentf-open-files] . counsel-recentf) + ([remap dired] . counsel-dired)) + :hook ((after-init . ivy-mode) + (ivy-mode . counsel-mode))) + +(prelude-require-package 'counsel-projectile) +(use-package counsel-projectile + :config + (counsel-projectile-mode)) + +(provide 'init-completion) + diff --git a/emacs-prelude/personal/lisp/init-dashboard.el b/emacs-prelude/personal/lisp/init-dashboard.el new file mode 100644 index 0000000..7256c37 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-dashboard.el @@ -0,0 +1,15 @@ +(prelude-require-package 'dashboard) +(use-package dashboard + :init + (setq dashboard-center-content t + dashboard-set-footer nil + dashboard-items '((recents . 5) + (bookmarks . 5) + (projects . 5) + (agenda . 5) + (registers . 5))) + :config + (dashboard-setup-startup-hook)) + +(provide 'init-dashboard) + diff --git a/emacs-prelude/personal/lisp/init-hydra.el b/emacs-prelude/personal/lisp/init-hydra.el new file mode 100644 index 0000000..706df45 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-hydra.el @@ -0,0 +1,7 @@ +(prelude-require-package 'hydra) +(use-package hydra) + +;(prelude-require-package 'ivy-hydra) +;(use-package ivy-hydra) + +(provide 'init-hydra) diff --git a/emacs-prelude/personal/lisp/init-lisp.el b/emacs-prelude/personal/lisp/init-lisp.el new file mode 100644 index 0000000..e09c882 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-lisp.el @@ -0,0 +1,13 @@ +(require 'init-paredit) + +(prelude-require-package 'eval-expr) +(use-package eval-expr + :bind ("M-:" . eval-expr) + :config + (defun eval-expr-minibuffer-setup () + (local-set-key (kbd "<tab>") #'completion-at-point) + (set-syntax-table emacs-lisp-mode-syntax-table) + (paredit-mode))) + +(provide 'init-lisp) + diff --git a/emacs-prelude/personal/lisp/init-lsp.el b/emacs-prelude/personal/lisp/init-lsp.el new file mode 100644 index 0000000..c92ade7 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-lsp.el @@ -0,0 +1,23 @@ +(use-package lsp-mode + :hook (clojure-mode . lsp) + :config + (setq gc-cons-threshold (* 100 1024 1024) + read-process-output-max (* 1024 1024) + treemacs-space-between-root-nodes nil + lsp-ui-doc-delay 1 + lsp-lens-enable nil + lsp-ui-doc-enable t + lsp-ui-doc-show-with-cursor t + lsp-ui-doc-show-with-mouse t + lsp-headerline-breadcrumb-enable nil + lsp-enable-symbol-highlighting t + lsp-ui-sideline-show-diagnostics t + lsp-ui-sideline-show-code-actions nil + lsp-modeline-code-actions-enable nil ;; TODO this causes errors in *Messages* if t + lsp-modeline-diagnostics-enable nil + ;; user cider for indendation and completion instead + lsp-enable-indentation nil + lsp-completion-enable nil)) + +(provide 'init-lsp) + diff --git a/emacs-prelude/personal/lisp/init-modeline.el b/emacs-prelude/personal/lisp/init-modeline.el new file mode 100644 index 0000000..5ae8281 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-modeline.el @@ -0,0 +1,14 @@ +(prelude-require-package 'doom-modeline) +(use-package doom-modeline + :hook (after-init . doom-modeline-mode) + :config ;(add-hook 'after-init-hook #'doom-modeline-mode) + (setq doom-modeline-minor-modes t + doom-modeline-major-mode-icon t)) + +(prelude-require-package 'minions) +(use-package minions + :hook (doom-modeline-mode . minions-mode)) + + +(provide 'init-modeline) + diff --git a/emacs-prelude/personal/lisp/init-paredit.el b/emacs-prelude/personal/lisp/init-paredit.el new file mode 100644 index 0000000..6eb20d8 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-paredit.el @@ -0,0 +1,27 @@ +(defun add-hooks (modes func) + (dolist (mode modes) + (add-hook (intern (concat (symbol-name mode) "-hook")) func))) + +(setq lisp-modes + '(scheme-mode emacs-lisp-mode lisp-mode clojure-mode cider-repl-mode + eval-expression-minibuffer-setup ielm-mode lisp-interaction-mode)) + +(defun add-lisp-hook (func) + (add-hooks lisp-modes func)) + +(prelude-require-package 'paredit) +(use-package paredit + :diminish + :bind (([remap mark-sexp] . sp-mark-sexp) ;; sp does this better! + ("M-[" . paredit-wrap-square)) + :config + (add-lisp-hook #'turn-off-smartparens-mode) + (add-lisp-hook #'enable-paredit-mode)) + +(use-package paredit-functions + :after paredit + :ensure nil + :load-path "~/.emacs.d/personal/lisp/paredit-functions.el") + +(provide 'init-paredit) + diff --git a/emacs-prelude/personal/lisp/init-prelude.el b/emacs-prelude/personal/lisp/init-prelude.el new file mode 100644 index 0000000..a8cb3af --- /dev/null +++ b/emacs-prelude/personal/lisp/init-prelude.el @@ -0,0 +1,22 @@ +;; config for misc packages included with prelude + +(use-package flycheck + :diminish + :config + (global-flycheck-mode)) + +(use-package which-key + :diminish) + +(use-package whitespace + :diminish) + +(use-package ace-window + :diminish + :custom-face + (aw-leading-char-face + ((t (:foreground "white" :background "red" + :weight bold :height 2.5 :box (:line-width 10 :color "red")))))) + +(provide 'init-prelude) + diff --git a/emacs-prelude/personal/lisp/init-ui.el b/emacs-prelude/personal/lisp/init-ui.el new file mode 100644 index 0000000..b40e207 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-ui.el @@ -0,0 +1,16 @@ +;(prelude-require-package 'all-the-icons) + +(toggle-frame-maximized) + +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) + +(setq whitespace-line-column 120) + +(use-package paren + :config + (show-paren-mode +1)) + +(provide 'init-ui) + diff --git a/emacs-prelude/personal/lisp/init-use-package.el b/emacs-prelude/personal/lisp/init-use-package.el new file mode 100644 index 0000000..35280f5 --- /dev/null +++ b/emacs-prelude/personal/lisp/init-use-package.el @@ -0,0 +1,7 @@ +(prelude-require-package 'use-package) +(require 'use-package) + +(setq use-package-always-ensure t) + +(provide 'init-use-package) + diff --git a/emacs-prelude/personal/lisp/paredit-functions.el b/emacs-prelude/personal/lisp/paredit-functions.el new file mode 100644 index 0000000..12fd4e0 --- /dev/null +++ b/emacs-prelude/personal/lisp/paredit-functions.el @@ -0,0 +1,102 @@ +(with-eval-after-load 'paredit +;; From emacswiki +(defun paredit-barf-all-the-way-backward () + (interactive) + (paredit-split-sexp) + (paredit-backward-down) + (paredit-splice-sexp)) + +(defun paredit-barf-all-the-way-forward () + (interactive) + (paredit-split-sexp) + (paredit-forward-down) + (paredit-splice-sexp) + (if (eolp) (delete-horizontal-space))) + +(defun paredit-slurp-all-the-way-backward () + (interactive) + (catch 'done + (while (not (bobp)) + (save-excursion + (paredit-backward-up) + (if (eq (char-before) ?\() + (throw 'done t))) + (paredit-backward-slurp-sexp)))) + +(defun paredit-slurp-all-the-way-forward () + (interactive) + (catch 'done + (while (not (eobp)) + (save-excursion + (paredit-forward-up) + (if (eq (char-after) ?\)) + (throw 'done t))) + (paredit-forward-slurp-sexp)))) + +(nconc paredit-commands + '("Extreme Barfage & Slurpage" + (("C-M-)") + paredit-slurp-all-the-way-forward + ("(foo (bar |baz) quux zot)" + "(foo (bar |baz quux zot))") + ("(a b ((c| d)) e f)" + "(a b ((c| d)) e f)")) + (("C-M-}" "M-F") + paredit-barf-all-the-way-forward + ("(foo (bar |baz quux) zot)" + "(foo (bar|) baz quux zot)")) + (("C-M-(") + paredit-slurp-all-the-way-backward + ("(foo bar (baz| quux) zot)" + "((foo bar baz| quux) zot)") + ("(a b ((c| d)) e f)" + "(a b ((c| d)) e f)")) + (("C-M-{" "M-B") + paredit-barf-all-the-way-backward + ("(foo (bar baz |quux) zot)" + "(foo bar baz (|quux) zot)")))) + +(paredit-define-keys) +(paredit-annotate-mode-with-examples) +(paredit-annotate-functions-with-examples) + +;; From bodil +;; Inverse M-( +(defun paredit-wrap-round-from-behind () + (interactive) + (forward-sexp -1) + (paredit-wrap-round) + (insert " ") + (forward-char -1)) +(eval-after-load "paredit" + '(define-key paredit-mode-map (kbd "M-)") + 'paredit-wrap-round-from-behind)) + +;; From bodil +;; Duplicate sexp +(defun paredit-duplicate-after-point + () + "Duplicates the content of the line that is after the point." + (interactive) + ;; skips to the next sexp + (while (looking-at " ") + (forward-char)) + (set-mark-command nil) + ;; while we find sexps we move forward on the line + (while (and (<= (point) (car (bounds-of-thing-at-point 'sexp))) + (not (= (point) (line-end-position)))) + (forward-sexp) + (while (looking-at " ") + (forward-char))) + (kill-ring-save (mark) (point)) + ;; go to the next line and copy the sexprs we encountered + (paredit-newline) + (set-mark-command nil) + (yank) + (exchange-point-and-mark))) +(eval-after-load "paredit" + '(define-key paredit-mode-map (kbd "C-c C-d") + 'paredit-duplicate-after-point)) + +(provide 'paredit-functions) + |