Add modules/tools/{electric-indent,rotate-text}
This commit is contained in:
parent
cb92f96739
commit
d18a39924d
6 changed files with 68 additions and 6 deletions
|
@ -77,6 +77,9 @@
|
||||||
nil))
|
nil))
|
||||||
(add-hook 'kill-buffer-query-functions 'doom|dont-kill-scratch-buffer)
|
(add-hook 'kill-buffer-query-functions 'doom|dont-kill-scratch-buffer)
|
||||||
|
|
||||||
|
;; enabled by default in Emacs 25+. No thanks.
|
||||||
|
(electric-indent-mode -1)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Core Plugins
|
;; Core Plugins
|
||||||
|
@ -167,11 +170,6 @@
|
||||||
|
|
||||||
(@def-package pcre2el :commands rxt-quote-pcre)
|
(@def-package pcre2el :commands rxt-quote-pcre)
|
||||||
|
|
||||||
(@def-package rotate-text
|
|
||||||
:commands (rotate-text rotate-text-backward)
|
|
||||||
:config
|
|
||||||
(push '("true" "false") rotate-text-words))
|
|
||||||
|
|
||||||
(@def-package smart-forward
|
(@def-package smart-forward
|
||||||
:commands (smart-up smart-down smart-backward smart-forward))
|
:commands (smart-up smart-down smart-backward smart-forward))
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
(@package imenu-anywhere)
|
(@package imenu-anywhere)
|
||||||
(@package imenu-list)
|
(@package imenu-list)
|
||||||
(@package pcre2el)
|
(@package pcre2el)
|
||||||
(@package rotate-text :recipe (:fetcher github :repo "debug-ito/rotate-text.el"))
|
|
||||||
(@package smart-forward)
|
(@package smart-forward)
|
||||||
(@package swiper)
|
(@package swiper)
|
||||||
(@package wgrep)
|
(@package wgrep)
|
||||||
|
|
|
@ -57,10 +57,12 @@
|
||||||
hl-todo ; highlight TODO/FIXME/NOTE tags
|
hl-todo ; highlight TODO/FIXME/NOTE tags
|
||||||
|
|
||||||
:tools
|
:tools
|
||||||
|
electric-indent ; smarter, keyword-based electric-indent
|
||||||
eshell ; a consistent, cross-platform shell (WIP)
|
eshell ; a consistent, cross-platform shell (WIP)
|
||||||
;; TODO dash ; interacting with dash.app
|
;; TODO dash ; interacting with dash.app
|
||||||
dired ; making dired pretty [functional]
|
dired ; making dired pretty [functional]
|
||||||
restclient ; A REST REPL
|
restclient ; A REST REPL
|
||||||
|
rotate-text ; cycle region at point between text candidates
|
||||||
tmux ; an API for interacting with tmux
|
tmux ; an API for interacting with tmux
|
||||||
upload ; map local to remote projects via ssh/ftp
|
upload ; map local to remote projects via ssh/ftp
|
||||||
|
|
||||||
|
|
36
modules/tools/electric-indent/config.el
Normal file
36
modules/tools/electric-indent/config.el
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
;;; tools/electric-indent/config.el
|
||||||
|
|
||||||
|
;; Smarter, keyword-based electric-indent
|
||||||
|
|
||||||
|
(defvar doom-electric-indent-p nil
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
(defvar-local doom-electric-indent-words '()
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
(setq electric-indent-chars '(?\n ?\^?))
|
||||||
|
|
||||||
|
(push (lambda (c)
|
||||||
|
(when (and (eolp) doom-electric-indent-words)
|
||||||
|
(save-excursion
|
||||||
|
(backward-word)
|
||||||
|
(looking-at-p
|
||||||
|
(concat "\\<" (regexp-opt doom-electric-indent-words))))))
|
||||||
|
electric-indent-functions)
|
||||||
|
|
||||||
|
(@def-setting :electric (modes &rest plist)
|
||||||
|
"Declare :words (list of strings) or :chars (lists of chars) in MODES that
|
||||||
|
trigger electric indentation."
|
||||||
|
(declare (indent 1))
|
||||||
|
(let ((modes (if (listp modes) modes (list modes)))
|
||||||
|
(chars (doom-mplist-get rest :chars))
|
||||||
|
(words (doom-mplist-get rest :words)))
|
||||||
|
(when (or chars words)
|
||||||
|
(let ((fn-name (intern (format "doom--electric-%s" (s-join "-" (mapcar 'symbol-name modes))))))
|
||||||
|
`(progn
|
||||||
|
(defun ,fn-name ()
|
||||||
|
(electric-indent-local-mode +1)
|
||||||
|
,(if chars `(setq electric-indent-chars ',chars))
|
||||||
|
,(if words `(setq doom-electric-indent-words ',words)))
|
||||||
|
(@add-hook ,modes ',fn-name))))))
|
||||||
|
|
23
modules/tools/rotate-text/config.el
Normal file
23
modules/tools/rotate-text/config.el
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
;;; tools/rotate-text/config.el
|
||||||
|
|
||||||
|
(@def-package rotate-text
|
||||||
|
:commands (rotate-text rotate-text-backward)
|
||||||
|
:config
|
||||||
|
(push '("true" "false") rotate-text-words))
|
||||||
|
|
||||||
|
(@def-setting :rotate (mode &rest plist)
|
||||||
|
"Declare :symbols, :words or :patterns that `rotate-text' will cycle through."
|
||||||
|
(declare (indent 1))
|
||||||
|
(let ((modes (if (listp modes) modes (list modes)))
|
||||||
|
(symbols (plist-get plist :symbols))
|
||||||
|
(words (plist-get plist :words))
|
||||||
|
(patterns (plist-get plist :patterns)))
|
||||||
|
(when (or symbols words patterns)
|
||||||
|
(let ((fn-name (intern (format "doom--rotate-%s" (s-join "-" (mapcar 'symbol-name modes))))))
|
||||||
|
`(@after rotate-text
|
||||||
|
(defun ,fn-name ()
|
||||||
|
,(if symbols `(setq-local rotate-text-local-symbols ',symbols))
|
||||||
|
,(if words `(setq-local rotate-text-local-words ',words))
|
||||||
|
,(if patterns `(setq-local rotate-text-local-patterns ',patterns)))
|
||||||
|
(@add-hook ,modes ',fn-name))))))
|
||||||
|
|
4
modules/tools/rotate-text/packages.el
Normal file
4
modules/tools/rotate-text/packages.el
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
;; -*- no-byte-compile: t; -*-
|
||||||
|
;;; tools/rotate-text/packages.el
|
||||||
|
|
||||||
|
(@package rotate-text :recipe (:fetcher github :repo "debug-ito/rotate-text.el"))
|
Loading…
Add table
Add a link
Reference in a new issue