diff --git a/init.example.el b/init.example.el index f632e2b9d..644880ff3 100644 --- a/init.example.el +++ b/init.example.el @@ -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)) diff --git a/modules/private/default/+bindings.el b/modules/config/default/+bindings.el similarity index 98% rename from modules/private/default/+bindings.el rename to modules/config/default/+bindings.el index 4b6e8fcd4..674ca3585 100644 --- a/modules/private/default/+bindings.el +++ b/modules/config/default/+bindings.el @@ -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" diff --git a/modules/private/default/+evil-commands.el b/modules/config/default/+evil-commands.el similarity index 98% rename from modules/private/default/+evil-commands.el rename to modules/config/default/+evil-commands.el index f4143d803..79e3c0e9d 100644 --- a/modules/private/default/+evil-commands.el +++ b/modules/config/default/+evil-commands.el @@ -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) diff --git a/modules/config/default/README.org b/modules/config/default/README.org new file mode 100644 index 000000000..aa282ffb0 --- /dev/null +++ b/modules/config/default/README.org @@ -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+!* diff --git a/modules/private/default/autoload/default.el b/modules/config/default/autoload/default.el similarity index 69% rename from modules/private/default/autoload/default.el rename to modules/config/default/autoload/default.el index d1656dfec..0f73b74c3 100644 --- a/modules/private/default/autoload/default.el +++ b/modules/config/default/autoload/default.el @@ -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' diff --git a/modules/private/default/autoload/evil.el b/modules/config/default/autoload/evil.el similarity index 68% rename from modules/private/default/autoload/evil.el rename to modules/config/default/autoload/evil.el index 01a37f28c..d16d70480 100644 --- a/modules/private/default/autoload/evil.el +++ b/modules/config/default/autoload/evil.el @@ -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 "") (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." diff --git a/modules/private/default/config.el b/modules/config/default/config.el similarity index 98% rename from modules/private/default/config.el rename to modules/config/default/config.el index ce7b25609..eed115c15 100644 --- a/modules/private/default/config.el +++ b/modules/config/default/config.el @@ -1,4 +1,4 @@ -;;; private/default/config.el -*- lexical-binding: t; -*- +;;; config/default/config.el -*- lexical-binding: t; -*- (if (featurep! +bindings) (load! +bindings)) diff --git a/modules/config/default/doom-emacs b/modules/config/default/doom-emacs new file mode 100644 index 000000000..409e73652 --- /dev/null +++ b/modules/config/default/doom-emacs @@ -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))) \ No newline at end of file diff --git a/modules/private/default/packages.el b/modules/config/default/packages.el similarity index 82% rename from modules/private/default/packages.el rename to modules/config/default/packages.el index 08571bf1e..9f7eb6793 100644 --- a/modules/private/default/packages.el +++ b/modules/config/default/packages.el @@ -1,5 +1,5 @@ ;; -*- no-byte-compile: t; -*- -;;; private/default/packages.el +;;; config/default/packages.el (package! emacs-snippets :recipe (:fetcher github diff --git a/modules/private/README.org b/modules/private/README.org deleted file mode 100644 index b9723dbc7..000000000 --- a/modules/private/README.org +++ /dev/null @@ -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]].