Minimize dependence on map!
This is in preparation for general.el integration coming in 2.1.1. It is very likely that map! will change (and even more, be split into several macros). Not much, but change none-the-less. Specifically, the state keywords (e.g. :nvi, :n, :i) will be removed in favor of a :state property that takes a list, e.g. (normal visual insert). In any case, both map! and general are also relatively expensive compared to define-key and evil-define-key* (and the new define-key! macro), so use that when we can. This also means changes to either API won't affect Doom's modules in the long term.
This commit is contained in:
parent
83590d65ba
commit
1e81a35461
20 changed files with 276 additions and 239 deletions
|
@ -110,7 +110,7 @@ compilation database is present in the project.")
|
|||
;; 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.
|
||||
(map! :map c++-mode-map "<" nil ">" nil)
|
||||
(define-key! c++-mode-map "<" nil ">" nil)
|
||||
|
||||
;; ...and leave it to smartparens
|
||||
(sp-with-modes '(c++-mode objc-mode)
|
||||
|
@ -228,7 +228,7 @@ compilation database is present in the project.")
|
|||
(add-hook! kill-emacs (ignore-errors (rtags-cancel-process)))
|
||||
|
||||
;; Use rtags-imenu instead of imenu/counsel-imenu
|
||||
(map! :map (c-mode-map c++-mode-map) [remap imenu] #'rtags-imenu)
|
||||
(define-key! (c-mode-map c++-mode-map) [remap imenu] #'rtags-imenu)
|
||||
|
||||
(when (featurep 'evil) (add-hook 'rtags-jump-hook #'evil-set-jump))
|
||||
(add-hook 'rtags-after-find-file-hook #'recenter)
|
||||
|
|
|
@ -41,44 +41,45 @@
|
|||
(ess-toggle-underscore t)
|
||||
(set! :repl 'ess-mode #'+ess/r-repl)
|
||||
(set! :lookup 'ess-mode :documentation #'ess-display-help-on-object)
|
||||
(map! (:map ess-doc-map
|
||||
"h" #'ess-display-help-on-object
|
||||
"p" #'ess-R-dv-pprint
|
||||
"t" #'ess-R-dv-ctable)
|
||||
(:map ess-mode-map
|
||||
"<s-return>" #'ess-eval-line
|
||||
"<up>" #'comint-next-input
|
||||
"<down>" #'comint-previous-input
|
||||
(:localleader
|
||||
:nv "," #'ess-eval-region-or-function-or-paragraph-and-step
|
||||
:n "'" #'R
|
||||
:n "<tab>" #'ess-switch-to-inferior-or-script-buffer
|
||||
:n "<backtab>" #'ess-switch-process
|
||||
:n ;; REPL
|
||||
:n "B" #'ess-eval-buffer-and-go
|
||||
:n "b" #'ess-eval-buffer
|
||||
:nv "d" #'ess-eval-region-or-line-and-step
|
||||
:n "D" #'ess-eval-function-or-paragraph-and-step
|
||||
:n "L" #'ess-eval-line-and-go
|
||||
:n "l" #'ess-eval-line
|
||||
:nv "R" #'ess-eval-region-and-go
|
||||
:nv "r" #'ess-eval-region
|
||||
:n "F" #'ess-eval-function-and-go
|
||||
:n "f" #'ess-eval-function
|
||||
;; predefined keymaps
|
||||
:n "h" #'ess-doc-map
|
||||
:n "x" #'ess-extra-map
|
||||
:n "p" #'ess-r-package-dev-map
|
||||
:n "v" #'ess-dev-map
|
||||
;; noweb
|
||||
:n "cC" #'ess-eval-chunk-and-go
|
||||
:n "cc" #'ess-eval-chunk
|
||||
:n "cd" #'ess-eval-chunk-and-step
|
||||
:n "cm" #'ess-noweb-mark-chunk
|
||||
:n "cp" #'ess-noweb-previous-chunk
|
||||
:n "cn" #'ess-noweb-next-chunk))))
|
||||
(define-key! ess-doc-map
|
||||
"h" #'ess-display-help-on-object
|
||||
"p" #'ess-R-dv-pprint
|
||||
"t" #'ess-R-dv-ctable)
|
||||
(define-key! ess-doc-map
|
||||
[s-return] #'ess-eval-line
|
||||
[up] #'comint-next-input
|
||||
[down] #'comint-previous-input)
|
||||
(map! :map ess-mode-map
|
||||
:localleader
|
||||
:nv "," #'ess-eval-region-or-function-or-paragraph-and-step
|
||||
:n "'" #'R
|
||||
:n "<tab>" #'ess-switch-to-inferior-or-script-buffer
|
||||
:n "<backtab>" #'ess-switch-process
|
||||
:n ;; REPL
|
||||
:n "B" #'ess-eval-buffer-and-go
|
||||
:n "b" #'ess-eval-buffer
|
||||
:nv "d" #'ess-eval-region-or-line-and-step
|
||||
:n "D" #'ess-eval-function-or-paragraph-and-step
|
||||
:n "L" #'ess-eval-line-and-go
|
||||
:n "l" #'ess-eval-line
|
||||
:nv "R" #'ess-eval-region-and-go
|
||||
:nv "r" #'ess-eval-region
|
||||
:n "F" #'ess-eval-function-and-go
|
||||
:n "f" #'ess-eval-function
|
||||
;; predefined keymaps
|
||||
:n "h" #'ess-doc-map
|
||||
:n "x" #'ess-extra-map
|
||||
:n "p" #'ess-r-package-dev-map
|
||||
:n "v" #'ess-dev-map
|
||||
;; noweb
|
||||
:n "cC" #'ess-eval-chunk-and-go
|
||||
:n "cc" #'ess-eval-chunk
|
||||
:n "cd" #'ess-eval-chunk-and-step
|
||||
:n "cm" #'ess-noweb-mark-chunk
|
||||
:n "cp" #'ess-noweb-previous-chunk
|
||||
:n "cn" #'ess-noweb-next-chunk))
|
||||
|
||||
|
||||
;; `ess-smart-equals-mode'
|
||||
(add-hook! (ess-mode inferior-ess)
|
||||
(add-hook! '(ess-mode-hook inferior-ess-hook)
|
||||
#'ess-smart-equals-mode)
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
LaTeX-fill-break-at-separators nil
|
||||
LaTeX-item-indent 0) ; item indentation.
|
||||
|
||||
(map! :map LaTeX-mode-map "C-j" nil)
|
||||
(define-key LaTeX-mode-map "C-j" nil)
|
||||
|
||||
;; Do not prompt for Master files, this allows auto-insert to add templates
|
||||
;; to .tex files
|
||||
|
@ -120,10 +120,10 @@
|
|||
:config
|
||||
(map-put TeX-view-program-list "preview-pane" '(latex-preview-pane-mode))
|
||||
(map-put TeX-view-program-selection 'output-pdf '("preview-pane"))
|
||||
(map! :map doc-view-mode-map
|
||||
"ESC" #'delete-window
|
||||
"q" #'delete-window
|
||||
"k" (λ! (quit-window) (delete-window))))
|
||||
(define-key! doc-view-mode-map
|
||||
(kbd "ESC") #'delete-window
|
||||
"q" #'delete-window
|
||||
"k" (λ! (quit-window) (delete-window))))
|
||||
|
||||
|
||||
(def-package! reftex
|
||||
|
@ -170,7 +170,7 @@
|
|||
bibtex-completion-notes-path (expand-file-name "notes.org" +latex-bibtex-dir)
|
||||
bibtex-completion-pdf-open-function
|
||||
(lambda (fpath) (async-start-process "open-pdf" "/usr/bin/xdg-open" nil fpath))))
|
||||
(map! :map bibtex-mode-map "C-c \\" #'bibtex-fill-entry))
|
||||
(define-key bibtex-mode-map (kbd "C-c \\") #'bibtex-fill-entry))
|
||||
|
||||
|
||||
(def-package! auctex-latexmk
|
||||
|
|
|
@ -18,32 +18,35 @@
|
|||
(add-hook 'markdown-mode-hook #'+markdown|set-fill-column-and-line-spacing)
|
||||
(add-hook 'markdown-mode-hook #'auto-fill-mode)
|
||||
|
||||
(map! (:map markdown-mode-map
|
||||
[remap find-file-at-point] #'markdown-follow-thing-at-point
|
||||
"M-*" #'markdown-insert-list-item
|
||||
"M-b" #'markdown-insert-bold
|
||||
"M-i" #'markdown-insert-italic
|
||||
"M-`" #'+markdown/insert-del
|
||||
:m "gj" #'markdown-next-visible-heading
|
||||
:m "gk" #'markdown-previous-visible-heading
|
||||
;; Assumes you have a markdown renderer plugin in chrome
|
||||
:n "M-r" #'browse-url-of-file
|
||||
;; TODO: Make context sensitive
|
||||
:m "]h" #'markdown-next-visible-heading
|
||||
:m "[h" #'markdown-previous-visible-heading
|
||||
:m "[p" #'markdown-promote
|
||||
:m "]p" #'markdown-demote
|
||||
:m "[l" #'markdown-next-link
|
||||
:m "]l" #'markdown-previous-link
|
||||
:i "M--" #'markdown-insert-hr
|
||||
|
||||
(:localleader
|
||||
:nv "o" #'markdown-open
|
||||
:nv "b" #'markdown-preview
|
||||
(:prefix "i"
|
||||
:nv "t" #'markdown-toc-generate-toc
|
||||
:nv "i" #'markdown-insert-image
|
||||
:nv "l" #'markdown-insert-link)))))
|
||||
(define-key! markdown-mode-map
|
||||
[remap find-file-at-point] #'markdown-follow-thing-at-point
|
||||
(kbd "M-*") #'markdown-insert-list-item
|
||||
(kbd "M-b") #'markdown-insert-bold
|
||||
(kbd "M-i") #'markdown-insert-italic
|
||||
(kbd "M-`") #'+markdown/insert-del)
|
||||
(when (featurep! :feature evil +everywhere)
|
||||
(evil-define-key* 'motion markdown-mode-map
|
||||
"gj" #'markdown-next-visible-heading
|
||||
"gk" #'markdown-previous-visible-heading
|
||||
;; TODO: Make context sensitive
|
||||
"]h" #'markdown-next-visible-heading
|
||||
"[h" #'markdown-previous-visible-heading
|
||||
"[p" #'markdown-promote
|
||||
"]p" #'markdown-demote
|
||||
"[l" #'markdown-next-link
|
||||
"]l" #'markdown-previous-link)
|
||||
(evil-define-key* 'insert markdown-mode-map
|
||||
(kbd "M--") #'markdown-insert-hr)
|
||||
(evil-define-key* 'normal markdown-mode-map
|
||||
(kbd "M-r") #'browse-url-of-file))
|
||||
(map! :map markdown-mode-map
|
||||
:localleader
|
||||
:nv "o" #'markdown-open
|
||||
:nv "b" #'markdown-preview
|
||||
(:prefix "i"
|
||||
:nv "t" #'markdown-toc-generate-toc
|
||||
:nv "i" #'markdown-insert-image
|
||||
:nv "l" #'markdown-insert-link)))
|
||||
|
||||
|
||||
(def-package! markdown-toc
|
||||
|
|
|
@ -41,7 +41,7 @@ string). Stops at the first function to return non-nil.")
|
|||
(advice-add #'org-babel-confirm-evaluate :around #'+org*babel-lazy-load-library)
|
||||
|
||||
;; I prefer C-c C-c for confirming over the default C-c '
|
||||
(map! :map org-src-mode-map "C-c C-c" #'org-edit-src-exit)
|
||||
(define-key org-src-mode-map (kbd "C-c C-c") #'org-edit-src-exit)
|
||||
|
||||
;; In a recent update, `org-babel-get-header' was removed from org-mode, which
|
||||
;; is something a fair number of babel plugins use. So until those plugins
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue