From 112b43fe9a6653601b6006ffaeede2f1c33c1c11 Mon Sep 17 00:00:00 2001 From: Steven vanZyl Date: Sat, 16 May 2020 17:25:12 -0400 Subject: [PATCH 1/4] Initial Minimap Module Created a new Minimap module based on minimap.el from ELPA the module sets some DOOM-specific config, and better defaults. Also added keybindings for it. --- init.example.el | 1 + modules/config/default/+emacs-bindings.el | 4 +- modules/config/default/+evil-bindings.el | 3 +- modules/ui/minimap/README.org | 48 +++++++++++++++++++++++ modules/ui/minimap/config.el | 14 +++++++ modules/ui/minimap/packages.el | 4 ++ 6 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 modules/ui/minimap/README.org create mode 100644 modules/ui/minimap/config.el create mode 100644 modules/ui/minimap/packages.el diff --git a/init.example.el b/init.example.el index 370dd77d4..d35a725c7 100644 --- a/init.example.el +++ b/init.example.el @@ -47,6 +47,7 @@ ;;window-select ; visually switch windows workspaces ; tab emulation, persistence & separate workspaces ;;zen ; distraction-free coding or writing + ;;minimap ; show a map of the code on the side :editor (evil +everywhere); come to the dark side, we have cookies diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index f85c6850b..7472ab5bf 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -267,7 +267,9 @@ (:when (featurep! :lang org +pomodoro) :desc "Pomodoro timer" "t" #'org-pomodoro) (:when (featurep! :ui zen) - :desc "Zen mode" "z" #'writeroom-mode)) + :desc "Zen mode" "z" #'writeroom-mode) + (:when (featurep! :ui minimap) + :desc "Minimap mode" "m" #'minimap-mode)) ;;; v --- versioning (:prefix-map ("v" . "versioning") diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index b7d2f20c3..5bfbb339f 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -655,7 +655,8 @@ :desc "Soft line wrapping" "w" #'visual-line-mode (:when (featurep! :editor word-wrap) :desc "Soft line wrapping" "w" #'+word-wrap-mode) - :desc "Zen mode" "z" #'writeroom-mode)) + :desc "Zen mode" "z" #'writeroom-mode + :desc "Minimap" "m" #'minimap-mode)) (after! which-key (let ((prefix-re (regexp-opt (list doom-leader-key doom-leader-alt-key)))) diff --git a/modules/ui/minimap/README.org b/modules/ui/minimap/README.org new file mode 100644 index 000000000..c4c3770a6 --- /dev/null +++ b/modules/ui/minimap/README.org @@ -0,0 +1,48 @@ +#+TITLE: Minimap +#+DATE: May 8, 2020 +#+SINCE: v2.0 +#+STARTUP: inlineimages nofold + +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#maintainers][Maintainers]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] + - [[#hacks][Hacks]] +- [[#features][Features]] +- [[#configuration][Configuration]] +- [[#troubleshooting][Troubleshooting]] + - [[#scrolling-is-slowlaggy][Scrolling is slow/laggy]] + - [[#minimap-doesnt-close-when-disabled][Minimap doesn't close when disabled]] + +* Description +This module adds a minimap to the right side of Emacs, similar to the feature +found in many other editors. + +** Maintainers ++ [[https://github.com/rushsteve1][@rushsteve1]] (Author) + +** Module Flags +This module provides no flags. + +** Plugins ++ [[https://elpa.gnu.org/packages/minimap.html][minimap.el]] + +** Hacks ++ The colors used by the minimap are terrible so are overridden with + =custom-set-faces!= using colors out of the current DOOM theme. + +* Features +A minimap which provides an overview of the current buffer to the side, +displaying the currently visible region and the current line. You can left-click +and drag to scroll along the buffer, or right-click anywhere to jump to there. + +* Configuration +There are a number of options provided by the =minimap.el= package this module +is based on. The easiest way to see all of them is =SPC h v minimap=. + +* Troubleshooting +** Scrolling is slow/laggy +Disable the minimap using =SPC t m= + +** TODO Minimap doesn't close when disabled diff --git a/modules/ui/minimap/config.el b/modules/ui/minimap/config.el new file mode 100644 index 000000000..e631e4282 --- /dev/null +++ b/modules/ui/minimap/config.el @@ -0,0 +1,14 @@ +;;; ~/Nextcloud/Dotfiles/doom/minimap/config.el -*- lexical-binding: t; -*- + +(use-package! minimap + :hook doom-load-theme-hook + :config + (setq minimap-window-location 'right + minimap-update-delay 0 + minimap-width-fraction 0.09 + minimap-minimum-width 15) + (custom-set-faces! + `(minimap-current-line-face + :background ,(doom-color 'selection)) + `(minimap-active-region-background + :background ,(doom-color 'vertical-bar)))) diff --git a/modules/ui/minimap/packages.el b/modules/ui/minimap/packages.el new file mode 100644 index 000000000..a3b91b021 --- /dev/null +++ b/modules/ui/minimap/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; ~/Nextcloud/Dotfiles/doom/minimap/packages.el + +(package! minimap) From ce8feda2ca9bb367ce15b5fb864b301084e7b09a Mon Sep 17 00:00:00 2001 From: Steven vanZyl Date: Sat, 16 May 2020 18:24:45 -0400 Subject: [PATCH 2/4] Minimap Module fixes First round of fixes suggested by @gagbo, including moving some keybinds to be alphabetical, fixing some paths, and pinning the package version. --- modules/config/default/+emacs-bindings.el | 6 +++--- modules/config/default/+evil-bindings.el | 6 ++++-- modules/ui/minimap/config.el | 2 +- modules/ui/minimap/packages.el | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index 7472ab5bf..1718c122d 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -259,6 +259,8 @@ :desc "Flycheck" "f" #'flycheck-mode) (:when (featurep! :ui indent-guides) :desc "Indent guides" "i" #'highlight-indent-guides-mode) + (:when (featurep! :ui minimap) + :desc "Minimap mode" "m" #'minimap-mode) (:when (featurep! :lang org +present) :desc "org-tree-slide mode" "p" #'+org-present/start) :desc "Read-only mode" "r" #'read-only-mode @@ -267,9 +269,7 @@ (:when (featurep! :lang org +pomodoro) :desc "Pomodoro timer" "t" #'org-pomodoro) (:when (featurep! :ui zen) - :desc "Zen mode" "z" #'writeroom-mode) - (:when (featurep! :ui minimap) - :desc "Minimap mode" "m" #'minimap-mode)) + :desc "Zen mode" "z" #'writeroom-mode)) ;;; v --- versioning (:prefix-map ("v" . "versioning") diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 5bfbb339f..6037322b1 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -645,6 +645,8 @@ :desc "Indent guides" "i" #'highlight-indent-guides-mode) :desc "Indent style" "I" #'doom/toggle-indent-style :desc "Line numbers" "l" #'doom/toggle-line-numbers + (:when (featurep! :ui zen) + :desc "Minimap" "m" #'minimap-mode) (:when (featurep! :lang org +present) :desc "org-tree-slide mode" "p" #'org-tree-slide-mode) :desc "Read-only mode" "r" #'read-only-mode @@ -655,8 +657,8 @@ :desc "Soft line wrapping" "w" #'visual-line-mode (:when (featurep! :editor word-wrap) :desc "Soft line wrapping" "w" #'+word-wrap-mode) - :desc "Zen mode" "z" #'writeroom-mode - :desc "Minimap" "m" #'minimap-mode)) + (:when (featurep! :ui zen) + :desc "Zen mode" "z" #'writeroom-mode))) (after! which-key (let ((prefix-re (regexp-opt (list doom-leader-key doom-leader-alt-key)))) diff --git a/modules/ui/minimap/config.el b/modules/ui/minimap/config.el index e631e4282..e9db7321f 100644 --- a/modules/ui/minimap/config.el +++ b/modules/ui/minimap/config.el @@ -1,4 +1,4 @@ -;;; ~/Nextcloud/Dotfiles/doom/minimap/config.el -*- lexical-binding: t; -*- +;;; ui/minimap/config.el -*- lexical-binding: t; -*- (use-package! minimap :hook doom-load-theme-hook diff --git a/modules/ui/minimap/packages.el b/modules/ui/minimap/packages.el index a3b91b021..6b2b34bbc 100644 --- a/modules/ui/minimap/packages.el +++ b/modules/ui/minimap/packages.el @@ -1,4 +1,4 @@ ;; -*- no-byte-compile: t; -*- -;;; ~/Nextcloud/Dotfiles/doom/minimap/packages.el +;;; ui/minimap/packages.el -(package! minimap) +(package! minimap :pin "5765245dee97a3c8818fd5cd3db1eca7247fcbbc") From c1937397f3cc123ab117635b1e0a4859a748e056 Mon Sep 17 00:00:00 2001 From: Steven vanZyl Date: Sat, 16 May 2020 18:31:24 -0400 Subject: [PATCH 3/4] Remove custom faces from module Removed the custom faces from the module in favor of setting them in doom-themes itself https://github.com/hlissner/emacs-doom-themes/pull/467 --- modules/ui/minimap/config.el | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/ui/minimap/config.el b/modules/ui/minimap/config.el index e9db7321f..9b4b009ee 100644 --- a/modules/ui/minimap/config.el +++ b/modules/ui/minimap/config.el @@ -6,9 +6,4 @@ (setq minimap-window-location 'right minimap-update-delay 0 minimap-width-fraction 0.09 - minimap-minimum-width 15) - (custom-set-faces! - `(minimap-current-line-face - :background ,(doom-color 'selection)) - `(minimap-active-region-background - :background ,(doom-color 'vertical-bar)))) + minimap-minimum-width 15)) From fe68c654c095afc8fb3339d4b8fbed91e75085d3 Mon Sep 17 00:00:00 2001 From: Steven vanZyl Date: Sun, 17 May 2020 15:54:09 -0400 Subject: [PATCH 4/4] Minimap Fixes Another set of fixes to the minimap as suggested by @hlissner. - Changed the use-package to :defer t - Updated the README.org and removed the Hacks section - Alphabetized the init.example.el list --- init.example.el | 2 +- modules/ui/minimap/README.org | 9 ++------- modules/ui/minimap/config.el | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/init.example.el b/init.example.el index d35a725c7..5cd3b8b9e 100644 --- a/init.example.el +++ b/init.example.el @@ -33,6 +33,7 @@ hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW ;;hydra ;;indent-guides ; highlighted indent columns + ;;minimap ; show a map of the code on the side modeline ; snazzy, Atom-inspired modeline, plus API ;;nav-flash ; blink cursor line after big motions ;;neotree ; a project drawer, like NERDTree for vim @@ -47,7 +48,6 @@ ;;window-select ; visually switch windows workspaces ; tab emulation, persistence & separate workspaces ;;zen ; distraction-free coding or writing - ;;minimap ; show a map of the code on the side :editor (evil +everywhere); come to the dark side, we have cookies diff --git a/modules/ui/minimap/README.org b/modules/ui/minimap/README.org index c4c3770a6..28d485899 100644 --- a/modules/ui/minimap/README.org +++ b/modules/ui/minimap/README.org @@ -1,6 +1,6 @@ -#+TITLE: Minimap +#+TITLE: :ui minimap #+DATE: May 8, 2020 -#+SINCE: v2.0 +#+SINCE: v3.0.0 #+STARTUP: inlineimages nofold * Table of Contents :TOC_3:noexport: @@ -8,7 +8,6 @@ - [[#maintainers][Maintainers]] - [[#module-flags][Module Flags]] - [[#plugins][Plugins]] - - [[#hacks][Hacks]] - [[#features][Features]] - [[#configuration][Configuration]] - [[#troubleshooting][Troubleshooting]] @@ -28,10 +27,6 @@ This module provides no flags. ** Plugins + [[https://elpa.gnu.org/packages/minimap.html][minimap.el]] -** Hacks -+ The colors used by the minimap are terrible so are overridden with - =custom-set-faces!= using colors out of the current DOOM theme. - * Features A minimap which provides an overview of the current buffer to the side, displaying the currently visible region and the current line. You can left-click diff --git a/modules/ui/minimap/config.el b/modules/ui/minimap/config.el index 9b4b009ee..86afde935 100644 --- a/modules/ui/minimap/config.el +++ b/modules/ui/minimap/config.el @@ -1,7 +1,7 @@ ;;; ui/minimap/config.el -*- lexical-binding: t; -*- (use-package! minimap - :hook doom-load-theme-hook + :defer t :config (setq minimap-window-location 'right minimap-update-delay 0