From 504efc57e750740749f94c475cfb1684fe6039e5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 23 May 2016 20:56:19 -0400 Subject: [PATCH] General update --- README.md | 18 +++++++++-------- core/core-evil.el | 24 ++++++++++------------ core/core-helm.el | 39 +++++++++++++++++------------------- core/core-popup.el | 13 ++++++------ core/core-project.el | 3 +++ core/core-scratch.el | 6 +++--- core/core-ui.el | 15 +++++++------- core/defuns/defuns-nlinum.el | 6 +++--- core/defuns/defuns-window.el | 9 +++++++++ 9 files changed, 71 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 897097ffb..cca6d9f6c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -![DOOM Emacs](/../screenshots/scratch.png?raw=true) -![Screenshot](/../screenshots/main.png?raw=true) +[![MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE) This is an Emacs configuration for stubborn vimmers and silent demon annihilating protagonists alike. It strives to emulate vim as best it can, and surpass it in any way possible. +![Splash page screenshot](../screenshots/scratch.png?raw=true) +![Main screenshots](../screenshots/main.png?raw=true) + ## Installation ``` @@ -44,7 +46,7 @@ To get a picture of what's in here, check out: * Project-wide search and replace with **helm-ag** (press shift-Tab while in results buffer) * Session persistence (and tab emulation) with **workgroups2** - ![Workgroups2 tabs emulation](/../screenshots/tabs.png?raw=true) + ![Workgroups2 tabs emulation](../screenshots/tabs.png?raw=true) * Run code inline with **quickrun** * REPLs for many major modes with **repl-toggle**, including Ruby, Python, PHP, JS, Elisp, Haskell and Lua. @@ -66,14 +68,14 @@ To get a picture of what's in here, check out: * **Modeline improvements** * evil-search/iedit/evil-substitute mode-line integration: - ![matches count in mode-line](/../screenshots/search.png?raw=true) - ![substitutions count in mode-line](/../screenshots/subst.png?raw=true) + ![matches count in mode-line](../screenshots/search.png?raw=true) + ![substitutions count in mode-line](../screenshots/subst.png?raw=true) * Macro-recording indicator: - ![macro indicator in modeline](/../screenshots/macro.png?raw=true) + ![macro indicator in modeline](../screenshots/macro.png?raw=true) * Show (py|rb)env version in mode-line - ![py/rb version in modeline](/../screenshots/version.png?raw=true) + ![py/rb version in modeline](../screenshots/version.png?raw=true) --- -![Yay! Evil!](/../screenshots/cacochan.png) +![Yay! Evil!](../screenshots/cacochan.png) diff --git a/core/core-evil.el b/core/core-evil.el index b707a78d7..d456c7aa1 100644 --- a/core/core-evil.el +++ b/core/core-evil.el @@ -2,8 +2,6 @@ (use-package evil :init - ;; Disable highlights on insert-mode - (add-hook 'evil-insert-state-entry-hook 'evil-ex-nohighlight) (setq evil-magic t evil-want-C-u-scroll t evil-ex-visual-char-range t ; column range for ex commands @@ -25,7 +23,7 @@ ;; Color-coded state cursors evil-default-cursor (face-attribute 'minibuffer-prompt :foreground nil t) evil-normal-state-cursor 'box - evil-emacs-state-cursor `(,(face-attribute 'highlight :foreground nil t) box) + evil-emacs-state-cursor `(,(face-attribute 'shadow :foreground nil nil) box) evil-insert-state-cursor 'bar evil-visual-state-cursor 'hollow @@ -42,6 +40,8 @@ (add-hook 'evil-operator-state-entry-hook 'show-paren-mode) (add-hook 'evil-operator-state-exit-hook 'show-paren-mode-off) (add-hook 'evil-normal-state-entry-hook 'show-paren-mode-off) + ;; Disable highlights on insert-mode + (add-hook 'evil-insert-state-entry-hook 'evil-ex-nohighlight) :config (evil-mode 1) @@ -344,17 +344,15 @@ :config (setq evil-escape-key-sequence "jk" evil-escape-delay 0.25) - (evil-escape-mode +1) - - ;; evil-escape causes noticable lag in linewise motions in visual mode, so disable it in - ;; visual mode + (push 'neotree-mode evil-escape-excluded-major-modes) + ;; evil-escape causes noticable lag in commands that start with j, so we + ;; enable it only where we need it. (defun doom|evil-escape-disable () (evil-escape-mode -1)) - (defun doom|evil-escape-enable () (evil-escape-mode +1)) - (add-hook 'evil-visual-state-entry-hook 'doom|evil-escape-disable) - (add-hook 'evil-visual-state-exit-hook 'doom|evil-escape-enable) - (add-hook 'evil-insert-state-exit-hook 'doom|evil-escape-enable) - - (push 'neotree-mode evil-escape-excluded-major-modes)) + (defun doom|evil-escape-enable () (evil-escape-mode +1)) + (add-hook 'evil-insert-state-entry-hook 'doom|evil-escape-enable) + (add-hook 'evil-insert-state-exit-hook 'doom|evil-escape-disable) + (add-hook 'evil-replace-state-entry-hook 'doom|evil-escape-enable) + (add-hook 'evil-replace-state-exit-hook 'doom|evil-escape-disable)) (provide 'core-evil) ;;; core-evil.el ends here diff --git a/core/core-helm.el b/core/core-helm.el index 1d4b621c8..b6fd9a9e0 100644 --- a/core/core-helm.el +++ b/core/core-helm.el @@ -5,26 +5,24 @@ :commands (helm helm-other-buffer helm-mode) :init (defvar helm-global-prompt "››› ") - (setq-default - helm-quick-update t - ;; Speedier without fuzzy matching - helm-mode-fuzzy-match nil - helm-buffers-fuzzy-matching nil - helm-apropos-fuzzy-match nil - helm-M-x-fuzzy-match nil - helm-recentf-fuzzy-match nil - helm-projectile-fuzzy-match nil - ;; Display extraineous helm UI elements - helm-display-header-line nil - helm-ff-auto-update-initial-value nil - helm-find-files-doc-header nil - ;; Don't override evil-ex's completion - helm-mode-handle-completion-in-region nil - helm-candidate-number-limit 50 - ;; Don't wrap item cycling - helm-move-to-line-cycle-in-source t) - (defvar helm-projectile-find-file-map (make-sparse-keymap)) + (setq helm-quick-update t + ;; Speedier without fuzzy matching + helm-mode-fuzzy-match nil + helm-buffers-fuzzy-matching nil + helm-apropos-fuzzy-match nil + helm-M-x-fuzzy-match nil + helm-recentf-fuzzy-match nil + helm-projectile-fuzzy-match nil + ;; Display extraineous helm UI elements + helm-display-header-line nil + helm-ff-auto-update-initial-value nil + helm-find-files-doc-header nil + ;; Don't override evil-ex's completion + helm-mode-handle-completion-in-region nil + helm-candidate-number-limit 50 + ;; Don't wrap item cycling + helm-move-to-line-cycle-in-source t) :config (set-keymap-parent helm-projectile-find-file-map helm-map) @@ -46,8 +44,7 @@ :e "ESC" 'helm-keyboard-quit) ;;; Helm hacks - (defvar doom-helm-header-fg (face-attribute 'helm-source-header :foreground) "docstring") - + (defconst doom-helm-header-fg (face-attribute 'helm-source-header :foreground)) ;; Shrink source headers if there is only one source (add-hook 'helm-after-initialize-hook 'doom*helm-hide-source-header-maybe) ;; A simpler prompt: see `helm-global-prompt' diff --git a/core/core-popup.el b/core/core-popup.el index 4b7aca579..501a33d5c 100644 --- a/core/core-popup.el +++ b/core/core-popup.el @@ -241,12 +241,13 @@ (setq org-agenda-archives-mode nil org-agenda-buffer nil)))) - (map! :map org-agenda-mode-map - :e "" 'doom/org-agenda-quit - :e "ESC" 'doom/org-agenda-quit - :e [escape] 'doom/org-agenda-quit - "q" 'doom/org-agenda-quit - "Q" 'doom/org-agenda-quit)) + (after! org-agenda + (map! :map org-agenda-mode-map + :e "" 'doom/org-agenda-quit + :e "ESC" 'doom/org-agenda-quit + :e [escape] 'doom/org-agenda-quit + "q" 'doom/org-agenda-quit + "Q" 'doom/org-agenda-quit))) (after! realgud ;; This allows realgud debuggers to run in a popup. diff --git a/core/core-project.el b/core/core-project.el index 6ace6b662..2bf8ed75c 100644 --- a/core/core-project.el +++ b/core/core-project.el @@ -143,6 +143,9 @@ (push "assets" projectile-globally-ignored-directories) (push ".cask" projectile-globally-ignored-directories) + (push ".elc" projectile-globally-ignored-file-suffixes) + (push doom-temp-dir projectile-globally-ignored-directories) + (projectile-global-mode +1)) (provide 'core-project) diff --git a/core/core-scratch.el b/core/core-scratch.el index 780a52580..d698586ab 100644 --- a/core/core-scratch.el +++ b/core/core-scratch.el @@ -48,9 +48,9 @@ (setq doom-buffer-edited nil) (insert (let* ((auto-detect-frame (or auto-detect-frame (not (display-graphic-p)))) - (width (if auto-detect-frame - (window-width) - (cdr (assq 'width default-frame-alist)))) + (width (max 3 (- (if auto-detect-frame + (window-width) + (cdr (assq 'width default-frame-alist))) 3))) (height (if auto-detect-frame (window-height) (cdr (assq 'height default-frame-alist)))) diff --git a/core/core-ui.el b/core/core-ui.el index 7e5b2d60e..ca7346529 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -42,7 +42,7 @@ ;; Initialize UI (load-theme doom-current-theme t) (tooltip-mode -1) ; show tooltips in echo area -(if (not window-system) +(if (not (display-graphic-p)) (menu-bar-mode -1) (scroll-bar-mode -1) ; no scrollbar (tool-bar-mode -1) ; no toolbar @@ -63,10 +63,13 @@ ;; Show tilde in margin on empty lines (define-fringe-bitmap 'tilde [64 168 16] nil nil 'center) (set-fringe-bitmap-face 'tilde 'fringe) - (setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)) + (setcdr (assq 'empty-line fringe-indicator-alist) 'tilde) + ;; Fix certain unicode characters without upsetting line-height + (doom-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?λ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))) -;; Fix certain unicode characters without upsetting line-height -(doom-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?λ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓)) +;; Hide mode-line in help/compile window +(add-hook 'help-mode-hook 'doom|hide-mode-line) +(add-hook 'compilation-mode-hook 'doom|hide-mode-line) ;; On by default in Emacs 25. I'll enable it manually, so disable it globally (when (and (> emacs-major-version 24) (featurep 'eldoc)) @@ -79,10 +82,6 @@ ("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'error prepend) ("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'success prepend)))) -;; Hide mode-line in help/compile window -(add-hook 'help-mode-hook 'doom|hide-mode-line) -(add-hook 'compilation-mode-hook 'doom|hide-mode-line) - ;; ;; Plugins diff --git a/core/defuns/defuns-nlinum.el b/core/defuns/defuns-nlinum.el index f937b5839..0d377ea4c 100644 --- a/core/defuns/defuns-nlinum.el +++ b/core/defuns/defuns-nlinum.el @@ -8,13 +8,13 @@ (doom|nlinum-enable))) ;;;###autoload -(defun doom|nlinum-enable () +(defun doom|nlinum-enable (&rest _) (nlinum-mode +1) (add-hook 'post-command-hook 'doom|nlinum-hl-line nil t) (doom|nlinum-unhl-line)) ;;;###autoload -(defun doom|nlinum-disable () +(defun doom|nlinum-disable (&rest _) (nlinum-mode -1) (remove-hook 'post-command-hook 'doom|nlinum-hl-line t) (doom|nlinum-unhl-line)) @@ -51,7 +51,7 @@ (when ov (doom|nlinum-unhl-line) (let ((str (nth 1 (get-text-property 0 'display (overlay-get ov 'before-string))))) - (put-text-property 0 (length str) 'face 'linum-highlight-face str) + (put-text-property 0 (length str) 'face 'doom-nlinum-highlight str) (setq doom--hl-nlinum-overlay ov doom--hl-nlinum-line line-no)))))))) diff --git a/core/defuns/defuns-window.el b/core/defuns/defuns-window.el index fb73fda7f..a995a2b46 100644 --- a/core/defuns/defuns-window.el +++ b/core/defuns/defuns-window.el @@ -47,6 +47,15 @@ evil-window-move-* (e.g. `evil-window-move-far-left')" (switch-to-buffer this-buffer)) (select-window that-window)))) +;;;###autoload +(defun doom/evil-window-move-l () (interactive) (doom/evil-window-move 'left)) +;;;###autoload +(defun doom/evil-window-move-d () (interactive) (doom/evil-window-move 'down)) +;;;###autoload +(defun doom/evil-window-move-u () (interactive) (doom/evil-window-move 'up)) +;;;###autoload +(defun doom/evil-window-move-r () (interactive) (doom/evil-window-move 'right)) + ;;;###autoload (defun doom/new-buffer () (interactive)