2018-02-14 23:16:38 -05:00
|
|
|
;;; config/default/config.el -*- lexical-binding: t; -*-
|
2017-12-23 02:27:42 -05:00
|
|
|
|
2020-04-30 16:29:12 -04:00
|
|
|
(defvar +default-want-RET-continue-comments t
|
|
|
|
"If non-nil, RET will continue commented lines.")
|
|
|
|
|
2018-12-23 23:57:29 -05:00
|
|
|
(defvar +default-minibuffer-maps
|
2020-03-27 01:25:30 -04:00
|
|
|
(append '(minibuffer-local-map
|
|
|
|
minibuffer-local-ns-map
|
|
|
|
minibuffer-local-completion-map
|
|
|
|
minibuffer-local-must-match-map
|
|
|
|
minibuffer-local-isearch-map
|
|
|
|
read-expression-map)
|
|
|
|
(cond ((featurep! :completion ivy)
|
|
|
|
'(ivy-minibuffer-map
|
|
|
|
ivy-switch-buffer-map))
|
|
|
|
((featurep! :completion helm)
|
|
|
|
'(helm-map
|
|
|
|
helm-ag-map
|
|
|
|
helm-read-file-map))))
|
2018-12-23 23:57:29 -05:00
|
|
|
"A list of all the keymaps used for the minibuffer.")
|
|
|
|
|
|
|
|
|
2018-12-23 23:16:03 -05:00
|
|
|
;;
|
2019-03-09 03:41:26 -05:00
|
|
|
;;; Reasonable defaults
|
2018-06-01 17:10:30 +02:00
|
|
|
|
2019-05-01 01:47:27 -04:00
|
|
|
;;;###package avy
|
|
|
|
(setq avy-all-windows nil
|
2019-07-09 02:32:10 +02:00
|
|
|
avy-all-windows-alt t
|
2019-12-24 19:21:45 -05:00
|
|
|
avy-background t
|
2019-12-31 19:17:55 -05:00
|
|
|
;; the unpredictability of this (when enabled) makes it a poor default
|
2019-12-30 23:59:46 -05:00
|
|
|
avy-single-candidate-jump nil)
|
2019-05-01 01:47:27 -04:00
|
|
|
|
|
|
|
|
2017-12-27 22:48:05 -05:00
|
|
|
(after! epa
|
2020-01-18 20:34:18 -05:00
|
|
|
;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt
|
|
|
|
;; for the key passphrase.
|
2020-04-23 16:52:54 -04:00
|
|
|
(set (if EMACS27+
|
|
|
|
'epg-pinentry-mode
|
|
|
|
'epa-pinentry-mode) ; DEPRECATED `epa-pinentry-mode'
|
|
|
|
'loopback)
|
2020-03-27 01:25:30 -04:00
|
|
|
;; Default to the first secret key available in your keyring.
|
2020-01-18 20:34:18 -05:00
|
|
|
(setq-default
|
|
|
|
epa-file-encrypt-to
|
|
|
|
(or (default-value 'epa-file-encrypt-to)
|
|
|
|
(unless (string-empty-p user-full-name)
|
|
|
|
(cl-loop for key in (ignore-errors (epg-list-keys (epg-make-context) user-full-name))
|
|
|
|
collect (epg-sub-key-id (car (epg-key-sub-key-list key)))))
|
|
|
|
user-mail-address))
|
|
|
|
;; And suppress prompts if epa-file-encrypt-to has a default value (without
|
|
|
|
;; overwriting file-local values).
|
|
|
|
(defadvice! +default--dont-prompt-for-keys-a (&rest _)
|
|
|
|
:before #'epa-file-write-region
|
|
|
|
(unless (local-variable-p 'epa-file-encrypt-to)
|
|
|
|
(setq-local epa-file-encrypt-to (default-value 'epa-file-encrypt-to)))))
|
2017-12-27 22:48:05 -05:00
|
|
|
|
2019-10-07 21:36:27 -04:00
|
|
|
|
|
|
|
(use-package! drag-stuff
|
|
|
|
:defer t
|
|
|
|
:init
|
2019-10-08 02:47:58 -04:00
|
|
|
(map! "<M-up>" #'drag-stuff-up
|
|
|
|
"<M-down>" #'drag-stuff-down
|
|
|
|
"<M-left>" #'drag-stuff-left
|
|
|
|
"<M-right>" #'drag-stuff-right))
|
2019-10-07 21:36:27 -04:00
|
|
|
|
|
|
|
|
2019-09-20 17:16:36 -04:00
|
|
|
;;;###package tramp
|
|
|
|
(unless IS-WINDOWS
|
|
|
|
(setq tramp-default-method "ssh")) ; faster than the default scp
|
|
|
|
|
2017-12-27 22:48:05 -05:00
|
|
|
|
2019-04-03 19:15:02 -04:00
|
|
|
;;
|
|
|
|
;;; Smartparens config
|
|
|
|
|
|
|
|
(when (featurep! +smartparens)
|
|
|
|
;; You can disable :unless predicates with (sp-pair "'" nil :unless nil)
|
|
|
|
;; And disable :post-handlers with (sp-pair "{" nil :post-handlers nil)
|
|
|
|
;; or specific :post-handlers with:
|
|
|
|
;; (sp-pair "{" nil :post-handlers '(:rem ("| " "SPC")))
|
|
|
|
(after! smartparens
|
2019-04-22 02:53:55 -04:00
|
|
|
;; Smartparens' navigation feature is neat, but does not justify how
|
|
|
|
;; expensive it is. It's also less useful for evil users. This may need to
|
|
|
|
;; be reactivated for non-evil users though. Needs more testing!
|
2019-07-28 14:52:59 +02:00
|
|
|
(add-hook! 'after-change-major-mode-hook
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun doom-disable-smartparens-navigate-skip-match-h ()
|
|
|
|
(setq sp-navigate-skip-match nil
|
|
|
|
sp-navigate-consider-sgml-tags nil)))
|
2019-04-22 02:53:55 -04:00
|
|
|
|
2019-04-03 19:15:02 -04:00
|
|
|
;; Autopair quotes more conservatively; if I'm next to a word/before another
|
2019-12-31 19:17:55 -05:00
|
|
|
;; quote, I don't want to open a new pair or it would unbalance them.
|
2019-04-03 19:15:02 -04:00
|
|
|
(let ((unless-list '(sp-point-before-word-p
|
|
|
|
sp-point-after-word-p
|
|
|
|
sp-point-before-same-p)))
|
|
|
|
(sp-pair "'" nil :unless unless-list)
|
|
|
|
(sp-pair "\"" nil :unless unless-list))
|
|
|
|
|
|
|
|
;; Expand {|} => { | }
|
|
|
|
;; Expand {|} => {
|
|
|
|
;; |
|
|
|
|
;; }
|
|
|
|
(dolist (brace '("(" "{" "["))
|
|
|
|
(sp-pair brace nil
|
|
|
|
:post-handlers '(("||\n[i]" "RET") ("| " "SPC"))
|
|
|
|
;; I likely don't want a new pair if adjacent to a word or opening brace
|
|
|
|
:unless '(sp-point-before-word-p sp-point-before-same-p)))
|
|
|
|
|
2019-07-12 14:17:26 +02:00
|
|
|
;; In lisps ( should open a new form if before another parenthesis
|
2020-03-12 11:30:20 -04:00
|
|
|
(sp-local-pair sp-lisp-modes "(" ")" :unless '(:rem sp-point-before-same-p))
|
2019-07-12 14:17:26 +02:00
|
|
|
|
2019-04-03 19:15:02 -04:00
|
|
|
;; Major-mode specific fixes
|
2020-03-12 11:29:54 -04:00
|
|
|
(sp-local-pair 'ruby-mode "{" "}"
|
2019-04-03 19:15:02 -04:00
|
|
|
:pre-handlers '(:rem sp-ruby-pre-handler)
|
|
|
|
:post-handlers '(:rem sp-ruby-post-handler))
|
|
|
|
|
|
|
|
;; Don't do square-bracket space-expansion where it doesn't make sense to
|
|
|
|
(sp-local-pair '(emacs-lisp-mode org-mode markdown-mode gfm-mode)
|
|
|
|
"[" nil :post-handlers '(:rem ("| " "SPC")))
|
|
|
|
|
|
|
|
;; Reasonable default pairs for HTML-style comments
|
|
|
|
(sp-local-pair (append sp--html-modes '(markdown-mode gfm-mode))
|
|
|
|
"<!--" "-->"
|
|
|
|
:unless '(sp-point-before-word-p sp-point-before-same-p)
|
|
|
|
:actions '(insert) :post-handlers '(("| " "SPC")))
|
|
|
|
|
|
|
|
;; Disable electric keys in C modes because it interferes with smartparens
|
|
|
|
;; and custom bindings. We'll do it ourselves (mostly).
|
|
|
|
(after! cc-mode
|
2020-02-16 00:43:11 -05:00
|
|
|
(setq-default c-electric-flag nil)
|
2019-04-03 19:15:02 -04:00
|
|
|
(dolist (key '("#" "{" "}" "/" "*" ";" "," ":" "(" ")" "\177"))
|
2019-05-22 03:50:53 -04:00
|
|
|
(define-key c-mode-base-map key nil))
|
|
|
|
|
|
|
|
;; Smartparens and cc-mode both try to autoclose angle-brackets
|
|
|
|
;; intelligently. The result isn't very intelligent (causes redundant
|
|
|
|
;; characters), so just do it ourselves.
|
|
|
|
(define-key! c++-mode-map "<" nil ">" nil)
|
2019-07-22 23:51:39 +02:00
|
|
|
|
|
|
|
(defun +default-cc-sp-point-is-template-p (id action context)
|
|
|
|
"Return t if point is in the right place for C++ angle-brackets."
|
|
|
|
(and (sp-in-code-p id action context)
|
|
|
|
(cond ((eq action 'insert)
|
|
|
|
(sp-point-after-word-p id action context))
|
|
|
|
((eq action 'autoskip)
|
|
|
|
(/= (char-before) 32)))))
|
|
|
|
|
|
|
|
(defun +default-cc-sp-point-after-include-p (id action context)
|
|
|
|
"Return t if point is in an #include."
|
|
|
|
(and (sp-in-code-p id action context)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (line-beginning-position))
|
|
|
|
(looking-at-p "[ ]*#include[^<]+"))))
|
|
|
|
|
2019-05-22 03:50:53 -04:00
|
|
|
;; ...and leave it to smartparens
|
2019-07-09 00:27:23 +02:00
|
|
|
(sp-local-pair '(c++-mode objc-mode)
|
|
|
|
"<" ">"
|
2019-07-22 23:51:39 +02:00
|
|
|
:when '(+default-cc-sp-point-is-template-p
|
|
|
|
+default-cc-sp-point-after-include-p)
|
2019-07-09 00:27:23 +02:00
|
|
|
:post-handlers '(("| " "SPC")))
|
2019-05-22 03:50:53 -04:00
|
|
|
|
2019-07-09 00:27:23 +02:00
|
|
|
(sp-local-pair '(c-mode c++-mode objc-mode java-mode)
|
|
|
|
"/*!" "*/"
|
|
|
|
:post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
|
2019-04-03 19:15:02 -04:00
|
|
|
|
|
|
|
;; Expand C-style doc comment blocks. Must be done manually because some of
|
|
|
|
;; these languages use specialized (and deferred) parsers, whose state we
|
|
|
|
;; can't access while smartparens is doing its thing.
|
2019-07-09 00:27:23 +02:00
|
|
|
(defun +default-expand-asterix-doc-comment-block (&rest _ignored)
|
2019-04-03 19:15:02 -04:00
|
|
|
(let ((indent (current-indentation)))
|
|
|
|
(newline-and-indent)
|
|
|
|
(save-excursion
|
|
|
|
(newline)
|
|
|
|
(insert (make-string indent 32) " */")
|
|
|
|
(delete-char 2))))
|
|
|
|
(sp-local-pair
|
|
|
|
'(js2-mode typescript-mode rjsx-mode rust-mode c-mode c++-mode objc-mode
|
|
|
|
csharp-mode java-mode php-mode css-mode scss-mode less-css-mode
|
2019-06-27 23:56:17 +02:00
|
|
|
stylus-mode scala-mode)
|
2019-04-03 19:15:02 -04:00
|
|
|
"/*" "*/"
|
|
|
|
:actions '(insert)
|
2019-07-09 00:27:23 +02:00
|
|
|
:post-handlers '(("| " "SPC")
|
2019-07-09 02:19:02 +02:00
|
|
|
("|\n[i]*/[d-2]" "RET")
|
2019-07-09 00:27:23 +02:00
|
|
|
(+default-expand-asterix-doc-comment-block "*")))
|
|
|
|
|
|
|
|
(after! smartparens-ml
|
|
|
|
(sp-with-modes '(tuareg-mode fsharp-mode)
|
|
|
|
(sp-local-pair "(*" "*)" :actions nil)
|
|
|
|
(sp-local-pair "(*" "*"
|
|
|
|
:actions '(insert)
|
2020-02-25 22:25:39 -05:00
|
|
|
:post-handlers '(("| " "SPC") ("|[i]*)[d-2]" "RET")))))
|
2019-07-09 00:27:23 +02:00
|
|
|
|
2019-07-21 23:01:19 +02:00
|
|
|
(after! smartparens-markdown
|
|
|
|
(sp-with-modes '(markdown-mode gfm-mode)
|
|
|
|
(sp-local-pair "```" "```" :post-handlers '(:add ("||\n[i]" "RET")))
|
|
|
|
|
|
|
|
;; The original rules for smartparens had an odd quirk: inserting two
|
|
|
|
;; asterixex would replace nearby quotes with asterixes. These two rules
|
|
|
|
;; set out to fix this.
|
|
|
|
(sp-local-pair "**" nil :actions :rem)
|
|
|
|
(sp-local-pair "*" "*"
|
|
|
|
:actions '(insert skip)
|
|
|
|
:unless '(:rem sp-point-at-bol-p)
|
|
|
|
;; * then SPC will delete the second asterix and assume
|
|
|
|
;; you wanted a bullet point. * followed by another *
|
|
|
|
;; will produce an extra, assuming you wanted **|**.
|
|
|
|
:post-handlers '(("[d1]" "SPC") ("|*" "*"))))
|
|
|
|
|
|
|
|
;; This keybind allows * to skip over **.
|
|
|
|
(map! :map markdown-mode-map
|
2020-05-12 19:38:56 -04:00
|
|
|
:ig "*" (general-predicate-dispatch nil
|
|
|
|
(looking-at-p "\\*\\* *")
|
|
|
|
(λ! (forward-char 2)))))))
|
2019-04-03 19:15:02 -04:00
|
|
|
|
|
|
|
|
2018-12-23 23:57:29 -05:00
|
|
|
;;
|
2019-03-09 03:41:26 -05:00
|
|
|
;;; Keybinding fixes
|
2018-12-23 23:57:29 -05:00
|
|
|
|
2020-05-12 19:38:56 -04:00
|
|
|
;; Highjacks backspace to delete up to nearest column multiple of `tab-width' at
|
|
|
|
;; a time. If you have smartparens enabled, it will also:
|
|
|
|
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
|
|
|
|
;; b) close empty multiline brace blocks in one step:
|
|
|
|
;; {
|
|
|
|
;; |
|
|
|
|
;; }
|
|
|
|
;; becomes {|}
|
|
|
|
;; c) refresh smartparens' :post-handlers, so SPC and RET expansions work even
|
|
|
|
;; after a backspace.
|
|
|
|
;; d) properly delete smartparen pairs when they are encountered, without the
|
|
|
|
;; need for strict mode.
|
|
|
|
;; e) do none of this when inside a string
|
2020-05-12 22:40:07 -04:00
|
|
|
(advice-add #'delete-backward-char :override #'+default--delete-backward-char-a)
|
2020-05-12 19:38:56 -04:00
|
|
|
|
|
|
|
;; HACK Makes `newline-and-indent' continue comments (and more reliably).
|
|
|
|
;; Consults `doom-point-in-comment-functions' to detect a commented region
|
|
|
|
;; and uses that mode's `comment-line-break-function' to continue comments.
|
|
|
|
;; If neither exists, it will fall back to the normal behavior of
|
|
|
|
;; `newline-and-indent'.
|
|
|
|
;;
|
|
|
|
;; We use an advice here instead of a remapping because many modes define
|
|
|
|
;; and remap to their own newline-and-indent commands, and tackling all
|
|
|
|
;; those cases was judged to be more work than dealing with the edge cases
|
|
|
|
;; on a case by case basis.
|
|
|
|
(defadvice! +default--newline-indent-and-continue-comments-a (&rest _)
|
|
|
|
"A replacement for `newline-and-indent'.
|
|
|
|
|
|
|
|
Continues comments if executed from a commented line. Consults
|
|
|
|
`doom-point-in-comment-functions' to determine if in a comment."
|
|
|
|
:before-until #'newline-and-indent
|
|
|
|
(interactive "*")
|
|
|
|
(when (and +default-want-RET-continue-comments
|
|
|
|
(doom-point-in-comment-p)
|
|
|
|
(fboundp comment-line-break-function))
|
|
|
|
(funcall comment-line-break-function nil)
|
|
|
|
t))
|
|
|
|
|
2018-12-23 23:57:29 -05:00
|
|
|
;; This section is dedicated to "fixing" certain keys so that they behave
|
|
|
|
;; sensibly (and consistently with similar contexts).
|
|
|
|
|
|
|
|
;; Consistently use q to quit windows
|
|
|
|
(after! tabulated-list
|
|
|
|
(define-key tabulated-list-mode-map "q" #'quit-window))
|
|
|
|
|
|
|
|
;; OS specific fixes
|
|
|
|
(when IS-MAC
|
|
|
|
;; Fix MacOS shift+tab
|
2019-05-02 17:57:31 -04:00
|
|
|
(define-key key-translation-map [S-iso-lefttab] [backtab])
|
2019-01-21 22:09:02 -05:00
|
|
|
;; Fix conventional OS keys in Emacs
|
2019-01-22 18:03:22 -05:00
|
|
|
(map! "s-`" #'other-frame ; fix frame-switching
|
2019-01-21 22:09:02 -05:00
|
|
|
;; fix OS window/frame navigation/manipulation keys
|
2019-01-22 18:03:22 -05:00
|
|
|
"s-w" #'delete-window
|
|
|
|
"s-W" #'delete-frame
|
|
|
|
"s-n" #'+default/new-buffer
|
|
|
|
"s-N" #'make-frame
|
2019-01-28 20:17:37 -05:00
|
|
|
"s-q" (if (daemonp) #'delete-frame #'save-buffers-kill-terminal)
|
2019-01-28 14:23:12 -08:00
|
|
|
"C-s-f" #'toggle-frame-fullscreen
|
|
|
|
;; Restore somewhat common navigation
|
|
|
|
"s-l" #'goto-line
|
2019-01-21 22:09:02 -05:00
|
|
|
;; Restore OS undo, save, copy, & paste keys (without cua-mode, because
|
|
|
|
;; it imposes some other functionality and overhead we don't need)
|
2019-01-28 14:23:12 -08:00
|
|
|
"s-f" #'swiper
|
2019-01-22 18:03:22 -05:00
|
|
|
"s-z" #'undo
|
2019-01-28 14:23:12 -08:00
|
|
|
"s-Z" #'redo
|
2019-01-22 18:03:22 -05:00
|
|
|
"s-c" (if (featurep 'evil) #'evil-yank #'copy-region-as-kill)
|
|
|
|
"s-v" #'yank
|
|
|
|
"s-s" #'save-buffer
|
2020-03-27 01:25:30 -04:00
|
|
|
"s-x" #'execute-extended-command
|
2019-06-26 13:46:47 +02:00
|
|
|
:v "s-x" #'kill-region
|
2019-01-21 22:09:02 -05:00
|
|
|
;; Buffer-local font scaling
|
2019-05-12 21:54:16 -04:00
|
|
|
"s-+" #'doom/reset-font-size
|
|
|
|
"s-=" #'doom/increase-font-size
|
|
|
|
"s--" #'doom/decrease-font-size
|
2019-01-22 04:10:57 -05:00
|
|
|
;; Conventional text-editing keys & motions
|
2019-01-22 18:03:22 -05:00
|
|
|
"s-a" #'mark-whole-buffer
|
2019-10-24 19:02:16 -04:00
|
|
|
"s-/" (λ! (save-excursion (comment-line 1)))
|
|
|
|
:n "s-/" #'evilnc-comment-or-uncomment-lines
|
|
|
|
:v "s-/" #'evilnc-comment-operator
|
2019-12-23 17:20:59 -05:00
|
|
|
:gi [s-backspace] #'doom/backward-kill-to-bol-and-indent
|
2019-02-03 18:56:07 -05:00
|
|
|
:gi [s-left] #'doom/backward-to-bol-or-indent
|
|
|
|
:gi [s-right] #'doom/forward-to-last-non-comment-or-eol
|
|
|
|
:gi [M-backspace] #'backward-kill-word
|
|
|
|
:gi [M-left] #'backward-word
|
|
|
|
:gi [M-right] #'forward-word))
|
2019-01-21 22:09:02 -05:00
|
|
|
|
2018-02-14 05:10:48 -05:00
|
|
|
|
Introduce general.el & rewrite map!
+ Now uses an overriding keymap for leader keys, so that it is always
available, even outside of normal/visual states. In insert/emacs
states, or in sessions where evil is absent, an alternative prefix is
used for leader/localleader keys. See these variables:
+ doom-leader-prefix
+ doom-leader-alt-prefix
+ doom-localleader-prefix
+ doom-localleader-alt-prefix
+ Keybinds now support alternative prefixes through the new :alt-prefix
property. This is useful for non-evil users and non-normal evil
states. By default, this is M-SPC (leader) and M-SPC m (localleader).
+ Removed +evil-commands flag from config/default (moved to
feature/evil/+commands.el).
+ config/default/+bindings.el has been split into
config/default/+{evil,emacs}-bindings.el, which one is loaded depends
on whether evil is present or not. The latter is blank, but will soon
be populated with a keybinding scheme for non-evil users (perhaps
inspired by #641).
+ The define-key! macro has been replaced; it is now an alias for
general-def.
+ Added unmap! as an alias for general-unbind.
+ The following modifier key conventions are now enforced for
consistency, across all OSes:
alt/option = meta
windows/command = super
It used to be
alt/option = alt
windows/command = meta
Many of the default keybinds have been updated to reflect this switch,
but it is likely to affect personal meta/super keybinds!
The map! macro has also been rewritten to use general-define-key. Here
is what has been changed:
+ map! no longer works with characters, e.g. (map! ?x #'do-something) is
no longer supported. Keys must be kbd-able strings like "C-c x" or
vectors like [?C-c ?x].
+ The :map and :map* properties are now the same thing. If specified
keymaps aren't defined when binding keys, it is automatically
deferred.
+ The way you bind local keybinds has changed:
;; Don't do this
(map! :l "a" #'func-a
:l "b" #'func-b)
;; Do this
(map! :map 'local "a" #'func-a
"b" #'func-b)
+ map! now supports the following new blocks:
+ (:if COND THEN-FORM ELSE-FORM...)
+ (:alt-prefix PREFIX KEYS...) -- this prefix will be used for
non-normal evil states. Equivalent to :non-normal-prefix in general.
+ The way you declare a which-key label for a prefix key has changed:
;; before
(map! :desc "label" :prefix "a" ...)
;; now
(map! :prefix ("a" . "label") ...)
+ It used to be that map! supported binding a key to a key sequence,
like so:
(map! "a" [?x]) ; pressing a is like pressing x
This functionality was removed *temporarily* while I figure out the
implementation.
Addresses: #448, #814, #860
Mentioned in: #940
2018-12-22 03:30:04 -05:00
|
|
|
;;
|
2019-03-09 03:41:26 -05:00
|
|
|
;;; Keybind schemes
|
2017-12-30 00:56:54 -05:00
|
|
|
|
2019-03-09 01:50:24 -05:00
|
|
|
;; Custom help keys -- these aren't under `+bindings' because they ought to be
|
|
|
|
;; universal.
|
2019-04-04 22:38:46 -04:00
|
|
|
(define-key! help-map
|
|
|
|
;; new keybinds
|
|
|
|
"'" #'describe-char
|
2019-12-29 18:22:44 -05:00
|
|
|
"u" #'doom/help-autodefs
|
2019-04-23 20:58:19 -04:00
|
|
|
"E" #'doom/sandbox
|
2019-04-04 22:38:46 -04:00
|
|
|
"M" #'doom/describe-active-minor-mode
|
|
|
|
"O" #'+lookup/online
|
|
|
|
"T" #'doom/toggle-profiler
|
|
|
|
"V" #'set-variable
|
|
|
|
"W" #'+default/man-or-woman
|
|
|
|
"C-k" #'describe-key-briefly
|
|
|
|
"C-l" #'describe-language-environment
|
|
|
|
"C-m" #'info-emacs-manual
|
|
|
|
|
2019-04-12 16:07:32 -04:00
|
|
|
;; Unbind `help-for-help'. Conflicts with which-key's help command for the
|
|
|
|
;; <leader> h prefix. It's already on ? and F1 anyway.
|
2019-06-27 13:22:42 +02:00
|
|
|
"C-h" nil
|
2019-04-12 16:07:32 -04:00
|
|
|
|
2019-04-04 22:38:46 -04:00
|
|
|
;; replacement keybinds
|
|
|
|
;; replaces `info-emacs-manual' b/c it's on C-m now
|
|
|
|
"r" nil
|
|
|
|
"rr" #'doom/reload
|
|
|
|
"rt" #'doom/reload-theme
|
|
|
|
"rp" #'doom/reload-packages
|
|
|
|
"rf" #'doom/reload-font
|
|
|
|
"re" #'doom/reload-env
|
|
|
|
|
2019-11-09 21:40:52 +01:00
|
|
|
;; make `describe-bindings' available under the b prefix which it previously
|
|
|
|
;; occupied. Add more binding related commands under that prefix as well
|
|
|
|
"b" nil
|
|
|
|
"bb" #'describe-bindings
|
|
|
|
"bi" #'which-key-show-minor-mode-keymap
|
|
|
|
"bm" #'which-key-show-major-mode
|
|
|
|
"bt" #'which-key-show-top-level
|
|
|
|
"bf" #'which-key-show-full-keymap
|
|
|
|
"bk" #'which-key-show-keymap
|
|
|
|
|
2019-04-23 20:46:58 -04:00
|
|
|
;; replaces `apropos-documentation' b/c `apropos' covers this
|
2019-06-27 13:22:42 +02:00
|
|
|
"d" nil
|
2019-04-23 20:58:19 -04:00
|
|
|
"db" #'doom/report-bug
|
2019-12-29 18:22:44 -05:00
|
|
|
"dc" #'doom/goto-private-config-file
|
|
|
|
"dC" #'doom/goto-private-init-file
|
2019-04-23 20:46:58 -04:00
|
|
|
"dd" #'doom/toggle-debug-mode
|
|
|
|
"df" #'doom/help-faq
|
|
|
|
"dh" #'doom/help
|
2019-10-23 00:27:40 -04:00
|
|
|
"dl" #'doom/help-search-load-path
|
2019-12-29 18:22:44 -05:00
|
|
|
"dL" #'doom/help-search-loaded-files
|
2019-04-23 20:46:58 -04:00
|
|
|
"dm" #'doom/help-modules
|
|
|
|
"dn" #'doom/help-news
|
2019-05-19 19:02:17 -04:00
|
|
|
"dN" #'doom/help-news-search
|
2019-12-29 18:22:44 -05:00
|
|
|
"dpc" #'doom/help-package-config
|
|
|
|
"dpd" #'doom/goto-private-packages-file
|
|
|
|
"dph" #'doom/help-package-homepage
|
|
|
|
"dpp" #'doom/help-packages
|
2019-12-23 01:51:43 -05:00
|
|
|
"ds" #'doom/help-search-headings
|
|
|
|
"dS" #'doom/help-search
|
2019-04-23 20:46:58 -04:00
|
|
|
"dt" #'doom/toggle-profiler
|
2019-12-29 18:22:44 -05:00
|
|
|
"du" #'doom/help-autodefs
|
2019-04-23 20:46:58 -04:00
|
|
|
"dv" #'doom/version
|
2019-12-29 18:22:44 -05:00
|
|
|
"dx" #'doom/sandbox
|
2019-04-23 20:46:58 -04:00
|
|
|
|
2019-04-04 22:38:46 -04:00
|
|
|
;; replaces `apropos-command'
|
|
|
|
"a" #'apropos
|
2019-10-12 23:46:40 -04:00
|
|
|
"A" #'apropos-documentation
|
2019-04-04 22:38:46 -04:00
|
|
|
;; replaces `describe-copying' b/c not useful
|
|
|
|
"C-c" #'describe-coding-system
|
|
|
|
;; replaces `Info-got-emacs-command-node' b/c redundant w/ `Info-goto-node'
|
|
|
|
"F" #'describe-face
|
|
|
|
;; replaces `view-hello-file' b/c annoying
|
2019-10-05 12:17:14 -04:00
|
|
|
"h" nil
|
2019-04-04 22:38:46 -04:00
|
|
|
;; replaces `view-emacs-news' b/c it's on C-n too
|
2019-04-23 20:46:58 -04:00
|
|
|
"n" #'doom/help-news
|
2019-11-21 14:42:37 -05:00
|
|
|
;; replaces `help-with-tutorial', b/c it's less useful than `load-theme'
|
|
|
|
"t" #'load-theme
|
2019-12-01 22:31:19 -05:00
|
|
|
;; replaces `finder-by-keyword' b/c not useful
|
2019-05-30 14:01:48 -04:00
|
|
|
"p" #'doom/help-packages
|
2019-12-31 19:17:55 -05:00
|
|
|
;; replaces `describe-package' b/c redundant w/ `doom/help-packages'
|
2019-04-04 22:38:46 -04:00
|
|
|
"P" #'find-library)
|
2019-03-09 01:50:24 -05:00
|
|
|
|
|
|
|
(after! which-key
|
2019-10-26 21:49:15 -04:00
|
|
|
(let ((prefix-re (regexp-opt (list doom-leader-key doom-leader-alt-key))))
|
2019-11-01 12:21:07 +01:00
|
|
|
(cl-pushnew `((,(format "\\`\\(?:<\\(?:\\(?:f1\\|help\\)>\\)\\|C-h\\|%s h\\) d\\'" prefix-re))
|
2019-10-26 21:49:15 -04:00
|
|
|
nil . "doom")
|
|
|
|
which-key-replacement-alist)
|
2019-11-01 12:21:07 +01:00
|
|
|
(cl-pushnew `((,(format "\\`\\(?:<\\(?:\\(?:f1\\|help\\)>\\)\\|C-h\\|%s h\\) r\\'" prefix-re))
|
2019-10-26 21:49:15 -04:00
|
|
|
nil . "reload")
|
2019-11-09 21:40:52 +01:00
|
|
|
which-key-replacement-alist)
|
|
|
|
(cl-pushnew `((,(format "\\`\\(?:<\\(?:\\(?:f1\\|help\\)>\\)\\|C-h\\|%s h\\) b\\'" prefix-re))
|
|
|
|
nil . "bindings")
|
2019-10-26 21:49:15 -04:00
|
|
|
which-key-replacement-alist)))
|
2019-03-09 01:50:24 -05:00
|
|
|
|
|
|
|
|
Introduce general.el & rewrite map!
+ Now uses an overriding keymap for leader keys, so that it is always
available, even outside of normal/visual states. In insert/emacs
states, or in sessions where evil is absent, an alternative prefix is
used for leader/localleader keys. See these variables:
+ doom-leader-prefix
+ doom-leader-alt-prefix
+ doom-localleader-prefix
+ doom-localleader-alt-prefix
+ Keybinds now support alternative prefixes through the new :alt-prefix
property. This is useful for non-evil users and non-normal evil
states. By default, this is M-SPC (leader) and M-SPC m (localleader).
+ Removed +evil-commands flag from config/default (moved to
feature/evil/+commands.el).
+ config/default/+bindings.el has been split into
config/default/+{evil,emacs}-bindings.el, which one is loaded depends
on whether evil is present or not. The latter is blank, but will soon
be populated with a keybinding scheme for non-evil users (perhaps
inspired by #641).
+ The define-key! macro has been replaced; it is now an alias for
general-def.
+ Added unmap! as an alias for general-unbind.
+ The following modifier key conventions are now enforced for
consistency, across all OSes:
alt/option = meta
windows/command = super
It used to be
alt/option = alt
windows/command = meta
Many of the default keybinds have been updated to reflect this switch,
but it is likely to affect personal meta/super keybinds!
The map! macro has also been rewritten to use general-define-key. Here
is what has been changed:
+ map! no longer works with characters, e.g. (map! ?x #'do-something) is
no longer supported. Keys must be kbd-able strings like "C-c x" or
vectors like [?C-c ?x].
+ The :map and :map* properties are now the same thing. If specified
keymaps aren't defined when binding keys, it is automatically
deferred.
+ The way you bind local keybinds has changed:
;; Don't do this
(map! :l "a" #'func-a
:l "b" #'func-b)
;; Do this
(map! :map 'local "a" #'func-a
"b" #'func-b)
+ map! now supports the following new blocks:
+ (:if COND THEN-FORM ELSE-FORM...)
+ (:alt-prefix PREFIX KEYS...) -- this prefix will be used for
non-normal evil states. Equivalent to :non-normal-prefix in general.
+ The way you declare a which-key label for a prefix key has changed:
;; before
(map! :desc "label" :prefix "a" ...)
;; now
(map! :prefix ("a" . "label") ...)
+ It used to be that map! supported binding a key to a key sequence,
like so:
(map! "a" [?x]) ; pressing a is like pressing x
This functionality was removed *temporarily* while I figure out the
implementation.
Addresses: #448, #814, #860
Mentioned in: #940
2018-12-22 03:30:04 -05:00
|
|
|
(when (featurep! +bindings)
|
2019-01-21 22:07:53 -05:00
|
|
|
;; Make M-x harder to miss
|
2018-12-31 15:00:05 -05:00
|
|
|
(define-key! 'override
|
2019-01-21 22:07:53 -05:00
|
|
|
"M-x" #'execute-extended-command
|
2019-01-28 21:00:41 -05:00
|
|
|
"A-x" #'execute-extended-command)
|
2018-12-31 15:00:05 -05:00
|
|
|
|
2019-03-09 03:41:26 -05:00
|
|
|
;; A Doom convention where C-s on popups and interactive searches will invoke
|
|
|
|
;; ivy/helm for their superior filtering.
|
2020-03-28 00:41:04 -04:00
|
|
|
(when-let (command (cond ((featurep! :completion ivy)
|
|
|
|
#'counsel-minibuffer-history)
|
|
|
|
((featurep! :completion helm)
|
|
|
|
#'helm-minibuffer-history)))
|
2020-03-28 20:08:53 -04:00
|
|
|
(define-key!
|
|
|
|
:keymaps (append +default-minibuffer-maps
|
|
|
|
(when (featurep! :editor evil +everywhere)
|
|
|
|
'(evil-ex-completion-map)))
|
2020-03-28 00:41:04 -04:00
|
|
|
"C-s" command))
|
2019-03-09 03:41:26 -05:00
|
|
|
|
2019-01-21 11:15:39 +01:00
|
|
|
;; Smarter C-a/C-e for both Emacs and Evil. C-a will jump to indentation.
|
|
|
|
;; Pressing it again will send you to the true bol. Same goes for C-e, except
|
|
|
|
;; it will ignore comments+trailing whitespace before jumping to eol.
|
|
|
|
(map! :gi "C-a" #'doom/backward-to-bol-or-indent
|
2019-01-21 22:07:31 -05:00
|
|
|
:gi "C-e" #'doom/forward-to-last-non-comment-or-eol
|
2019-06-27 13:22:42 +02:00
|
|
|
;; Standardizes the behavior of modified RET to match the behavior of
|
|
|
|
;; other editors, particularly Atom, textedit, textmate, and vscode, in
|
|
|
|
;; which ctrl+RET will add a new "item" below the current one and
|
|
|
|
;; cmd+RET (Mac) / meta+RET (elsewhere) will add a new, blank line below
|
|
|
|
;; the current one.
|
2020-01-01 14:54:41 -05:00
|
|
|
:gn [C-return] #'+default/newline-below
|
|
|
|
:gn [C-S-return] #'+default/newline-above
|
2019-06-27 13:22:42 +02:00
|
|
|
(:when IS-MAC
|
2020-01-01 14:54:41 -05:00
|
|
|
:gn [s-return] #'+default/newline-below
|
|
|
|
:gn [S-s-return] #'+default/newline-above)))
|
2019-03-09 03:41:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Bootstrap configs
|
2019-01-21 11:15:39 +01:00
|
|
|
|
2019-03-09 03:41:26 -05:00
|
|
|
(if (featurep 'evil)
|
|
|
|
(load! "+evil")
|
|
|
|
(load! "+emacs"))
|