💥 Move :private modules to :config

This commit is contained in:
Henrik Lissner 2018-02-14 23:16:38 -05:00
parent dfefbd0176
commit 6d7db48dc1
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
10 changed files with 101 additions and 38 deletions

View file

@ -138,11 +138,10 @@
; +wordnut ; wordnet (wn) search
; +langtool) ; a proofreader (grammar/style check) for Emacs
;; Private modules are where you place your personal configuration files.
;; By default, they are not tracked. There is one module included here,
;; the defaults module. It contains a Spacemacs-inspired keybinding
;; scheme and additional ex commands for evil-mode. Use it as a reference
;; for your own.
:private
:config
;; The default module contains a set of reasonable defaults for Emacs, a
;; Spacemacs-inspired keybinding scheme, a custom yasnippet library, and
;; additional ex commands for evil-mode. Use it as a reference for your
;; own modules.
(default +bindings +snippets +evil-commands))

View file

@ -1,12 +1,12 @@
;;; private/default/+bindings.el -*- lexical-binding: t; -*-
;;; config/default/+bindings.el -*- lexical-binding: t; -*-
;; This file defines a Spacemacs-esque keybinding scheme
;; expand-region's prompt can't tell what key contract-region is bound to, so we
;; tell it explicitly.
(setq expand-region-contract-fast-key "V")
;; This files defines a Spacemacs-esque keybinding scheme
;;
(map! [remap evil-jump-to-tag] #'projectile-find-tag
[remap find-tag] #'projectile-find-tag
[remap newline] #'newline-and-indent
@ -181,7 +181,10 @@
:desc "Browse emacs.d" :n "E" #'+default/browse-emacsd
:desc "Recent files" :n "r" #'recentf-open-files
:desc "Recent project files" :n "R" #'projectile-recentf
:desc "Yank filename" :n "y" #'+default/yank-buffer-filename)
:desc "Yank filename" :n "y" #'+default/yank-buffer-filename
(:when (featurep! :config private)
:desc "Find file in private config" :n "p" #'+private/find-in-config
:desc "Browse private config" :n "P" #'+private/browse-config))
(:desc "git" :prefix "g"
:desc "Git status" :n "S" #'magit-status
@ -209,6 +212,7 @@
:desc "Describe face" :n "F" #'describe-face
:desc "Describe DOOM setting" :n "s" #'doom/describe-setting
:desc "Describe DOOM module" :n "d" #'doom/describe-module
:desc "Open Doom manual" :n "D" #'doom/help
:desc "Find definition" :n "." #'+lookup/definition
:desc "Find references" :n "/" #'+lookup/references
:desc "Find documentation" :n "h" #'+lookup/documentation
@ -266,7 +270,7 @@
:desc "Invalidate cache" :n "x" #'projectile-invalidate-cache)
(:desc "quit" :prefix "q"
:desc "Quit" :n "q" #'evil-save-and-quit
:desc "Save and quit" :n "q" #'evil-save-and-quit
:desc "Quit (forget session)" :n "Q" #'+workspace/kill-session-and-quit)
(:desc "remote" :prefix "r"

View file

@ -1,4 +1,4 @@
;;; private/default/+evil-commands.el -*- lexical-binding: t; -*-
;;; config/default/+evil-commands.el -*- lexical-binding: t; -*-
(defalias 'ex! 'evil-ex-define-cmd)

View file

@ -0,0 +1,60 @@
#+TITLE: :config default
This module provides a set of reasonable defaults, including:
+ A Spacemacs-esque keybinding scheme
+ Extra Ex commands for evil-mode users
+ A yasnippet snippets library tailored to Doom emacs
+ A configuration for (almost) universally repeating searches with =;= and =,=
#+begin_quote
The defaults module is intended as a "reasonable-defaults" module, but also as a
reference for your own private modules. You'll find [[https://github.com/hlissner/doom-emacs-private][my private module in a
separate repo]].
Refer to the [[https://github.com/hlissner/doom-emacs/wiki/Customization][Customization page]] on the wiki for details on starting your own
private module.
#+end_quote
* Table of Contents :TOC:
- [[#install][Install]]
- [[#configuration][Configuration]]
- [[#using-another-snippets-library][Using another snippets library]]
- [[#im-not-an-evil-user][I'm not an evil user...]]
- [[#appendix][Appendix]]
- [[#commands][Commands]]
- [[#hacks][Hacks]]
* Install
This module has no external dependencies.
* Configuration
** Using another snippets library
Don't want to use provided one? Then add this to your private module,
#+BEGIN_SRC emacs-lisp
;; in config/$USER/packages.el
(package! emacs-snippets :ignore t)
;; in config/$USER/config.el
(def-package-hook! emacs-snippets :disabled t)
(after! yasnippet
(push "~/path/to/my/private/snippets" yas-snippet-dirs))
#+END_SRC
** I'm not an evil user...
That's fine. All evil configuration is ignored if =:feature evil= is disabled.
* Appendix
** Commands
+ ~+default/browse-project~
+ ~+default/browse-templates~
+ ~+default/find-in-templates~
+ ~+default/browse-emacsd~
+ ~+default/find-in-emacsd~
+ ~+default/browse-notes~
+ ~+default/find-in-notes~
+ ~+default/find-in-snippets~
** Hacks
+ ~epa-pinentry-mode~ is set to ~'loopback~, forcing gpg-agent to use the Emacs
minibuffer when prompting for your passphrase. *Only works with GPG 2.1+!*

View file

@ -1,4 +1,4 @@
;; private/default/autoload/default.el -*- lexical-binding: t; -*-
;; config/default/autoload/default.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +default/yank-buffer-filename ()
@ -23,26 +23,26 @@
(doom-project-find-file ,dir))))
;;;###autoload (autoload '+default/browse-project "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/browse-project "config/default/autoload/default" nil t)
(+default--def-browse-in! project (doom-project-root))
;; NOTE No need for find-in-project, use `projectile-find-file'
;;;###autoload (autoload '+default/find-in-templates "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/find-in-templates "config/default/autoload/default" nil t)
(+default--def-find-in! templates +file-templates-dir)
;;;###autoload (autoload '+default/browse-templates "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/browse-templates "config/default/autoload/default" nil t)
(+default--def-browse-in! templates +file-templates-dir)
;;;###autoload (autoload '+default/find-in-emacsd "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/find-in-emacsd "config/default/autoload/default" nil t)
(+default--def-find-in! emacsd doom-emacs-dir)
;;;###autoload (autoload '+default/browse-emacsd "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/browse-emacsd "config/default/autoload/default" nil t)
(+default--def-browse-in! emacsd doom-emacs-dir)
;;;###autoload (autoload '+default/find-in-notes "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/find-in-notes "config/default/autoload/default" nil t)
(+default--def-find-in! notes +org-dir)
;;;###autoload (autoload '+default/browse-notes "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/browse-notes "config/default/autoload/default" nil t)
(+default--def-browse-in! notes +org-dir)
;;;###autoload (autoload '+default/find-in-snippets "private/default/autoload/default" nil t)
;;;###autoload (autoload '+default/find-in-snippets "config/default/autoload/default" nil t)
(+default--def-find-in! snippets +default-snippets-dir)
;; NOTE No need for a browse-snippets variant, use `yas-visit-snippet-file'

View file

@ -1,27 +1,27 @@
;; private/default/autoload/evil.el -*- lexical-binding: t; -*-
;; config/default/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil)
;;;###autoload (autoload '+default:multi-next-line "private/default/autoload/evil" nil t)
;;;###autoload (autoload '+default:multi-next-line "config/default/autoload/evil" nil t)
(evil-define-motion +default:multi-next-line (count)
"Move down 6 lines."
:type line
(let ((line-move-visual (or visual-line-mode (derived-mode-p 'text-mode))))
(evil-line-move (* 6 (or count 1)))))
;;;###autoload (autoload '+default:multi-previous-line "private/default/autoload/evil" nil t)
;;;###autoload (autoload '+default:multi-previous-line "config/default/autoload/evil" nil t)
(evil-define-motion +default:multi-previous-line (count)
"Move up 6 lines."
:type line
(let ((line-move-visual (or visual-line-mode (derived-mode-p 'text-mode))))
(evil-line-move (- (* 6 (or count 1))))))
;;;###autoload (autoload '+default:cd "private/default/autoload/evil" nil t)
;;;###autoload (autoload '+default:cd "config/default/autoload/evil" nil t)
(evil-define-command +default:cd ()
"Change `default-directory' with `cd'."
(interactive "<f>")
(cd input))
;;;###autoload (autoload '+default:kill-all-buffers "private/default/autoload/evil" nil t)
;;;###autoload (autoload '+default:kill-all-buffers "config/default/autoload/evil" nil t)
(evil-define-command +default:kill-all-buffers (&optional bang)
"Kill all buffers. If BANG, kill current session too."
(interactive "<!>")
@ -29,7 +29,7 @@
(+workspace/kill-session)
(doom/kill-all-buffers)))
;;;###autoload (autoload '+default:kill-matching-buffers "private/default/autoload/evil" nil t)
;;;###autoload (autoload '+default:kill-matching-buffers "config/default/autoload/evil" nil t)
(evil-define-command +default:kill-matching-buffers (&optional bang pattern)
"Kill all buffers matching PATTERN regexp. If BANG, only match project
buffers."

View file

@ -1,4 +1,4 @@
;;; private/default/config.el -*- lexical-binding: t; -*-
;;; config/default/config.el -*- lexical-binding: t; -*-
(if (featurep! +bindings) (load! +bindings))

View file

@ -0,0 +1,8 @@
(defun projectile-find-tag ()
"Find tag in project."
(interactive)
(projectile-visit-project-tags-table)
;; Auto-discover the user's preference for tags
(let ((xref-backend-functions '(t))) )
(let ((find-tag-fn (projectile-determine-find-tag-fn)))
(call-interactively find-tag-fn)))

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*-
;;; private/default/packages.el
;;; config/default/packages.el
(package! emacs-snippets
:recipe (:fetcher github

View file

@ -1,8 +0,0 @@
#+TITLE: :private modules
Use this directory to store your private configuration modules.
Mine is included as a reference. I recommend you neither delete nor rename it, to avoid merge conflicts upstream.
-----
You'll find [[https://github.com/hlissner/doom-emacs/wiki/Customization][more information about customizing Doom]] on the [[https://github.com/hlissner/doom-emacs/wiki][wiki]].