Merge pull request #1820 from darth10/module-god-mode
Add editor/god module
This commit is contained in:
commit
fac6eabd72
6 changed files with 89 additions and 0 deletions
|
@ -46,6 +46,7 @@
|
||||||
:editor
|
:editor
|
||||||
(evil +everywhere); come to the dark side, we have cookies
|
(evil +everywhere); come to the dark side, we have cookies
|
||||||
file-templates ; auto-snippets for empty files
|
file-templates ; auto-snippets for empty files
|
||||||
|
;;god ; run Emacs commands without modifier keys
|
||||||
fold ; (nigh) universal code folding
|
fold ; (nigh) universal code folding
|
||||||
;;(format +onsave) ; automated prettiness
|
;;(format +onsave) ; automated prettiness
|
||||||
;;lispy ; vim for lisp, for people who dont like vim
|
;;lispy ; vim for lisp, for people who dont like vim
|
||||||
|
|
|
@ -52,6 +52,7 @@ Modules that affect and augment your ability to manipulate or insert text.
|
||||||
+ [[file:editor/file-templates/README.org][file-templates]]: Auto-inserted templates in blank new files
|
+ [[file:editor/file-templates/README.org][file-templates]]: Auto-inserted templates in blank new files
|
||||||
+ [[file:editor/fold/README.org][fold]]: universal code folding
|
+ [[file:editor/fold/README.org][fold]]: universal code folding
|
||||||
+ [[file:editor/format/README.org][format]] =+onsave=:
|
+ [[file:editor/format/README.org][format]] =+onsave=:
|
||||||
|
+ god: run Emacs commands without modifier keys
|
||||||
+ [[file:editor/lispy/README.org][lispy]]:
|
+ [[file:editor/lispy/README.org][lispy]]:
|
||||||
+ multiple-cursors:
|
+ multiple-cursors:
|
||||||
+ [[file:editor/parinfer/README.org][parinfer]]:
|
+ [[file:editor/parinfer/README.org][parinfer]]:
|
||||||
|
|
46
modules/editor/god/autoload/god.el
Normal file
46
modules/editor/god/autoload/god.el
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
;; editor/god/autoload/god.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defvar +god-default-color (face-background 'cursor)
|
||||||
|
"Default cursor and bar color.")
|
||||||
|
|
||||||
|
(defvar +god-read-only-mode-color "Gray"
|
||||||
|
"Cursor and bar color when `read-only-mode' is enabled.")
|
||||||
|
|
||||||
|
(defvar +god-overwrite-mode-color "Yellow"
|
||||||
|
"Cursor and bar color when `overwrite-mode' is enabled.")
|
||||||
|
|
||||||
|
(defvar +god-fill-overflow-color "IndianRed"
|
||||||
|
"Cursor and bar color when fill column width has been exceeded.")
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +god--configure-cursor-and-modeline-h ()
|
||||||
|
"Configure cursor type, cursor color and doom-modeline bar color depending on mode."
|
||||||
|
(let* ((is-fill-overflow (> (current-column) fill-column))
|
||||||
|
(previous-cursor-color (face-background 'cursor))
|
||||||
|
(previous-modeline-color (and (facep 'doom-modeline-bar)
|
||||||
|
(face-background 'doom-modeline-bar)))
|
||||||
|
(is-god-mode (bound-and-true-p god-local-mode))
|
||||||
|
(next-cursor-type
|
||||||
|
(cond (buffer-read-only 'box)
|
||||||
|
((and overwrite-mode is-god-mode) 'hollow)
|
||||||
|
((or is-god-mode overwrite-mode) 'box)
|
||||||
|
(t 'bar)))
|
||||||
|
(next-cursor-and-modeline-color
|
||||||
|
(cond (buffer-read-only +god-read-only-mode-color)
|
||||||
|
(is-fill-overflow +god-fill-overflow-color)
|
||||||
|
(overwrite-mode +god-overwrite-mode-color)
|
||||||
|
(t +god-default-color))))
|
||||||
|
(setq cursor-type next-cursor-type)
|
||||||
|
(unless (eq previous-cursor-color next-cursor-and-modeline-color)
|
||||||
|
(set-cursor-color next-cursor-and-modeline-color))
|
||||||
|
(when (and (facep 'doom-modeline-bar)
|
||||||
|
(fboundp 'doom-modeline-refresh-bars)
|
||||||
|
(not (eq previous-modeline-color next-cursor-and-modeline-color)))
|
||||||
|
(set-face-attribute 'doom-modeline-bar nil :background next-cursor-and-modeline-color)
|
||||||
|
(doom-modeline-refresh-bars))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +god--toggle-on-overwrite-h ()
|
||||||
|
(if (bound-and-true-p overwrite-mode)
|
||||||
|
(god-local-mode-pause)
|
||||||
|
(god-local-mode-resume)))
|
29
modules/editor/god/config.el
Normal file
29
modules/editor/god/config.el
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
;;; editor/god/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(use-package! god-mode
|
||||||
|
:commands god-local-mode
|
||||||
|
:hook (doom-after-init-modules . god-mode-all)
|
||||||
|
:config
|
||||||
|
(pushnew! god-exempt-major-modes
|
||||||
|
'Custom-mode
|
||||||
|
'Info-mode
|
||||||
|
'ag-mode
|
||||||
|
'calculator-mode
|
||||||
|
'calendar-mode
|
||||||
|
'cider-test-report-mode
|
||||||
|
'compilation-mode
|
||||||
|
'debugger-mode
|
||||||
|
'edebug-mode
|
||||||
|
'ediff-mode
|
||||||
|
'eww-mode
|
||||||
|
'geben-breakpoint-list-mode
|
||||||
|
'ibuffer-mode
|
||||||
|
'org-agenda-mode
|
||||||
|
'pdf-outline-buffer-mode
|
||||||
|
'recentf-dialog-mode
|
||||||
|
'sldb-mode
|
||||||
|
'sly-db-mode
|
||||||
|
'wdired-mode)
|
||||||
|
|
||||||
|
(add-hook! 'post-command-hook #'+god--configure-cursor-and-modeline-h)
|
||||||
|
(add-hook! 'overwrite-mode-hook #'+god--toggle-on-overwrite-h))
|
8
modules/editor/god/doctor.el
Normal file
8
modules/editor/god/doctor.el
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||||
|
;;; editor/god/doctor.el
|
||||||
|
|
||||||
|
(when (featurep! :editor evil)
|
||||||
|
(warn! "god-mode is not really compatible with evil"))
|
||||||
|
|
||||||
|
(when (featurep! :editor objed)
|
||||||
|
(warn! "god-mode is not really compatible with objed"))
|
4
modules/editor/god/packages.el
Normal file
4
modules/editor/god/packages.el
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
;; -*- no-byte-compile: t; -*-
|
||||||
|
;;; editor/god/packages.el
|
||||||
|
|
||||||
|
(package! god-mode)
|
Loading…
Add table
Add a link
Reference in a new issue