Add emacs prelude config
This commit is contained in:
parent
ccfeb564b6
commit
b5e8c2052c
|
@ -0,0 +1,5 @@
|
|||
;; This will make sure that nothing in your personal directory will be
|
||||
;; forced through the emacs-lisp-checkdoc flychecker. That's a great
|
||||
;; checker for real modules, but these are just config files, and you
|
||||
;; deserve not to get warnings all the time
|
||||
((emacs-lisp-mode . ((flycheck-disabled-checkers . (emacs-lisp-checkdoc)))))
|
|
@ -0,0 +1,14 @@
|
|||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(org-agenda-files '("~/foo.org"))
|
||||
'(package-selected-packages
|
||||
'(hydra helm-projectile counsel-projectile ivy-hydra easy-kill-extras paredit-functions eval-expr lsp clj-refactor flycheck-clj-kondo yasnippet paredit dashboard doom-modeline minions all-the-icons helm emacs-dashboard company-quickhelp company-box company-prescient ivy-prescient yaml-mode web-mode lsp-ui lsp-mode json-mode js2-mode rainbow-mode elisp-slime-nav cider clojure-mode rainbow-delimiters company counsel swiper ivy exec-path-from-shell zop-to-char zenburn-theme which-key volatile-highlights undo-tree super-save smartrep smartparens operate-on-number nlinum move-text magit projectile imenu-anywhere hl-todo guru-mode gitignore-mode gitconfig-mode git-timemachine gist flycheck expand-region epl editorconfig easy-kill diminish diff-hl discover-my-major crux browse-kill-ring anzu ag ace-window)))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(aw-leading-char-face ((t (:foreground "white" :background "red" :weight bold :height 2.5 :box (:line-width 10 :color "red"))))))
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
(prelude-require-package 'hydra)
|
||||
(use-package hydra)
|
||||
|
||||
;(prelude-require-package 'ivy-hydra)
|
||||
;(use-package ivy-hydra)
|
||||
|
||||
(provide 'init-hydra)
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
(prelude-require-package 'use-package)
|
||||
(require 'use-package)
|
||||
|
||||
(setq use-package-always-ensure t)
|
||||
|
||||
(provide 'init-use-package)
|
||||
|
|
@ -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)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
(add-to-list 'load-path (expand-file-name "personal/lisp" user-emacs-directory))
|
||||
|
||||
;; TODO persp/perspective/projectile-persp, dired/counsel-dired/..?, lsp-ivy
|
||||
(require 'init-use-package)
|
||||
(require 'init-prelude)
|
||||
(require 'init-ui)
|
||||
(require 'init-hydra)
|
||||
(require 'init-modeline)
|
||||
;(require 'init-dashboard)
|
||||
(require 'init-completion)
|
||||
(require 'init-lisp)
|
||||
(require 'init-clojure)
|
||||
(require 'init-lsp)
|
||||
|
||||
(global-unset-key (kbd "<left>"))
|
||||
(global-unset-key (kbd "<right>"))
|
||||
(global-unset-key (kbd "<up>"))
|
||||
(global-unset-key (kbd "<down>"))
|
||||
(global-unset-key (kbd "<C-left>"))
|
||||
(global-unset-key (kbd "<C-right>"))
|
||||
(global-unset-key (kbd "<C-up>"))
|
||||
(global-unset-key (kbd "<C-down>"))
|
||||
(global-unset-key (kbd "<M-left>"))
|
||||
(global-unset-key (kbd "<M-right>"))
|
||||
(global-unset-key (kbd "<M-up>"))
|
||||
(global-unset-key (kbd "<M-down>"))
|
||||
(global-unset-key (kbd "<delete>"))
|
||||
(global-unset-key (kbd "<deletechar>"))
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
;;; prelude-modules.el --- A listing of modules to load on startup
|
||||
;;
|
||||
;; Copyright © 2011-2021 Bozhidar Batsov
|
||||
;;
|
||||
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
||||
;; URL: https://github.com/bbatsov/prelude
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file is just a list of Prelude modules to load on startup.
|
||||
;; For convenience the modules are grouped in several categories.
|
||||
;; The prelude-modules.el in the samples folder should be copied
|
||||
;; to your personal folder and edited there.
|
||||
|
||||
;; Note that some modules can't be used together - e.g. you shouldn't
|
||||
;; enable both prelude-ido and prelude-ivy, as they serve the same
|
||||
;; purpose.
|
||||
|
||||
;;; License:
|
||||
|
||||
;; This program is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU General Public License
|
||||
;; as published by the Free Software Foundation; either version 3
|
||||
;; of the License, or (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Uncomment the modules you'd like to use and restart Prelude afterwards
|
||||
|
||||
;;; General productivity tools
|
||||
|
||||
;; (require 'prelude-ido) ;; Supercharges Emacs completion for C-x C-f and more
|
||||
(require 'prelude-ivy) ;; A mighty modern alternative to ido
|
||||
;; (require 'prelude-selectrum) ;; A powerful, yet simple, alternative to ivy
|
||||
;; (require 'prelude-helm) ;; Interface for narrowing and search
|
||||
;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
|
||||
(require 'prelude-company)
|
||||
(require 'prelude-key-chord) ;; Binds useful features to key combinations
|
||||
|
||||
;;; Vim emulation
|
||||
;;
|
||||
;; Enable this module if you're fond of vim's keybindings.
|
||||
;; (require 'prelude-evil)
|
||||
|
||||
;;; Org-mode (a legendary productivity tool that deserves its own category)
|
||||
;;
|
||||
;; Org-mode helps you keep TODO lists, notes and more.
|
||||
(require 'prelude-org)
|
||||
|
||||
;;; Programming languages support
|
||||
;;
|
||||
;; Modules for a few very common programming languages
|
||||
;; are enabled by default.
|
||||
|
||||
(require 'prelude-c)
|
||||
(require 'prelude-clojure)
|
||||
;; (require 'prelude-coffee)
|
||||
;; (require 'prelude-common-lisp)
|
||||
(require 'prelude-css)
|
||||
;; (require 'prelude-dart)
|
||||
(require 'prelude-emacs-lisp)
|
||||
;; (require 'prelude-erlang)
|
||||
;; (require 'prelude-elixir)
|
||||
;; (require 'prelude-go)
|
||||
;; (require 'prelude-haskell)
|
||||
(require 'prelude-js)
|
||||
;; (require 'prelude-latex)
|
||||
(require 'prelude-lisp) ;; Common setup for Lisp-like languages
|
||||
(require 'prelude-lsp) ;; Base setup for the Language Server Protocol
|
||||
;; (require 'prelude-lua)
|
||||
;; (require 'prelude-ocaml)
|
||||
;; (require 'prelude-perl)
|
||||
;; (require 'prelude-python)
|
||||
;; (require 'prelude-racket)
|
||||
;; (require 'prelude-ruby)
|
||||
;; (require 'prelude-rust)
|
||||
;; (require 'prelude-scala)
|
||||
;; (require 'prelude-scheme)
|
||||
(require 'prelude-shell)
|
||||
;; (require 'prelude-scss)
|
||||
;; (require 'prelude-ts)
|
||||
(require 'prelude-web) ;; Emacs mode for web templates
|
||||
(require 'prelude-xml)
|
||||
(require 'prelude-yaml)
|
||||
|
||||
;;; Misc
|
||||
;; (require 'prelude-erc) ;; A popular Emacs IRC client (useful if you're still into Freenode)
|
||||
|
||||
(provide 'prelude-modules)
|
||||
;;; prelude-modules.el ends here
|
Loading…
Reference in New Issue