summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
authorAlan Pearce2018-06-07 14:28:24 +0200
committerAlan Pearce2018-06-07 14:28:24 +0200
commit5dcf152b33736305314f1b6f13ebd0a4b1add0f6 (patch)
treedf496ca8eb55872e23c434c8644af71d4a989c77 /emacs
parent5bf9309274e40456e0e4f49133fb4abe6f6fafd2 (diff)
downloadnixfiles-5dcf152b33736305314f1b6f13ebd0a4b1add0f6.tar.lz
nixfiles-5dcf152b33736305314f1b6f13ebd0a4b1add0f6.tar.zst
nixfiles-5dcf152b33736305314f1b6f13ebd0a4b1add0f6.zip
Emacs: convert to the dark side
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/main.el170
1 files changed, 124 insertions, 46 deletions
diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el
index e0712559..e79075be 100644
--- a/emacs/.emacs.d/main.el
+++ b/emacs/.emacs.d/main.el
@@ -142,6 +142,7 @@
 ;; Monotropic-theme.  I don't need colours.
 
 (use-package monotropic-theme
+  :disabled t
   :if (or window-system
           (daemonp))
   :config (progn
@@ -152,6 +153,10 @@
                                     '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8"))))
                                     '(mode-line ((t (:height 1.0)))))))
 
+(if (or window-system
+          (daemonp))
+  (load-theme 'spacemacs-light t))
+
 ;; Highlighting quasi-quoted expressions in lisps is quite useful, but I
 ;; don't need it all the time.  I'll keep it around for a while so that I
 ;; can enable it if needed.
@@ -262,6 +267,7 @@
               :name resize-powerline
               (setq powerline-height (* 2  (ceiling (* (default-font-height) (+ 1 (* 2 line-spacing))) 2)))
               (setq-default mode-line-format (spaceline-spacemacs-theme)))
+            (setq spaceline-highlight-face-func #'spaceline-highlight-face-evil-state)
             (setq-default mode-line-format (spaceline-spacemacs-theme))))
 
 ;;;;; Chrome
@@ -277,15 +283,6 @@
         window-divider-default-places t)
   (window-divider-mode +1))
 
-;;;;; Highlight Changes
-
-;; Highlight what just changed when I undo, yank, and so on.
-
-(use-package volatile-highlights
-  :diminish volatile-highlights-mode
-  :config (progn
-            (volatile-highlights-mode t)))
-
 ;;;;; Renaming major modes
 
 ;; Diminishing major modes does not happen in the same manner as minor
@@ -583,7 +580,6 @@
             (def-projectile-commander-method ?A
               "Find rg on project."
               (call-interactively #'counsel-projectile-rg))
-            (setq counsel-projectile-rg-initial-input '(projectile-symbol-or-selection-at-point))
             (define-key counsel-projectile-command-map (kbd "s s") #'counsel-projectile-rg)))
 
 ;;;;; vc
@@ -809,8 +805,6 @@
 
 (setq-default tab-width 2
               indent-tabs-mode nil)
-(electric-indent-mode +1)
-
 
 ;;;;; smart-tabs-mode
 
@@ -975,7 +969,10 @@
              ("M-7" . eyebrowse-switch-to-window-config-7)
              ("M-8" . eyebrowse-switch-to-window-config-8)
              ("M-9" . eyebrowse-switch-to-window-config-9))
-            (eyebrowse-mode +1)))
+            (eyebrowse-mode +1)
+            (define-hook-helper evil-after-load ()
+              :name evil-eyebrowse-setup
+              (eyebrowse-setup-evil-keys))))
 
 ;;;; Sessions
 
@@ -1030,7 +1027,7 @@
 
 (setq completion-styles '(basic initials partial-completion substring)
       completion-ignore-case t
-      tab-always-indent 'complete)
+      tab-always-indent t)
 
 ;;;;; Company
 
@@ -1039,12 +1036,10 @@
 ;; seems to work perfectly well for me.
 
 (use-package company
-  :commands (company-mode)
   :diminish " C"
   :bind* (("C-<tab>" . company-complete))
-  :bind  (("TAB" . company-indent-or-complete-common))
+  :bind  (("TAB" . company-complete))
   :init (progn
-          (add-hook 'prog-mode-hook #'company-mode-on)
           (setq company-backends '(company-bbdb company-web-html company-tern company-nxml company-css company-eclim company-semantic company-elisp
                                                 company-clang company-xcode company-cmake company-capf
                                                 company-files (company-gtags
@@ -1057,7 +1052,8 @@
                 company-auto-complete #'company-explicit-action-p
                 company-auto-complete-chars '(?\ ?\( ?\) ?.)
                 company-tooltip-align-annotations t
-                company-selection-wrap-around t)))
+                company-selection-wrap-around t)
+          (global-company-mode +1)))
 
 (use-package company-web
   :after company)
@@ -1814,10 +1810,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer."
 
 ;;;; Programming
 
-(define-hook-helper prog-mode ()
-  :name long-lines
-  (setq-local truncate-lines t))
-
 ;;;;; flycheck
 
 ;; On-the-fly error checking in programming modes?  Yes please.
@@ -2301,8 +2293,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer."
                   web-mode-script-padding 0
                   web-mode-comment-style 2
                   web-mode-enable-auto-pairing nil
-                  web-mode-enable-auto-quoting nil)
-            (sp-local-pair '(web-mode) "<%" "%>")))
+                  web-mode-enable-auto-quoting nil)))
 
 ;;;;; Live coding
 
@@ -2496,7 +2487,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'."
 (put 'downcase-region 'disabled nil)
 (setq sentence-end-double-space t
       line-move-visual nil)
-(setq-default truncate-lines nil)
+(visual-line-mode +1)
 
 ;;;;; align
 
@@ -2525,26 +2516,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'."
 
 ;;;;; Selection
 
-;; I’m quite used to deleting text by selecting it and typing.  Emacs has
-;; a mode for that.
-
-(use-package delsel
-  :config (delete-selection-mode t))
-
-;; Sub-word movement is really nice for camel- and Pascal-case
-
-(use-package subword
-  :diminish subword-mode
-  :init (global-subword-mode t))
-
-;; I find that =zap-up-to-char= normally makes more sense to me than
-;; =zap-to-char=.
-
-(use-package misc
-  :ensure nil
-  :bind (("M-z" . zap-up-to-char)
-         ("M-Z" . zap-to-char)))
-
 ;; Expanding the region by semantic units was something I quite liked
 ;; from Sublime Text.  As always, there’s a mode for that.
 
@@ -2561,7 +2532,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'."
   :defer 5
   :bind* (("M-g g" . avy-goto-line)
           ("M-g M-g" . avy-goto-line)
-          ("C-|" . avy-goto-line)
           ("M-r" . avy-goto-word-1)
           ("C-c SPC" . avy-goto-char-timer))
   :config (progn
@@ -2675,6 +2645,114 @@ Pass ARG to `comint-delchar-or-maybe-eof'."
          ("C-c q" . vr/query-replace)
          ("C-c m" . vr/mc-mark)))
 
+;;;; Evil
+
+(use-package evil-leader
+  ;; must load before evil-mode
+  :init (global-evil-leader-mode +1)
+  :config (progn
+            (evil-leader/set-leader ",")
+            (evil-leader/set-key
+              "w" #'save-buffer
+              "q" #'kill-or-delete-this-buffer-dwim
+              "v" #'split-window-right
+              "o" #'other-window
+              "b" #'ibuffer
+              "x" #'counsel-M-x)))
+
+(setq evil-want-integration nil)
+(use-package evil
+  :config (progn
+            (evil-mode +1)
+            (setq evil-shift-width 2)
+            (bind-keys :map evil-normal-state-map
+                       (";" . evil-ex))
+            (define-key evil-motion-state-map (kbd "C-;") #'evil-avy-goto-line)
+            (define-key evil-normal-state-map [escape] #'keyboard-quit)
+            (define-key evil-visual-state-map [escape] #'keyboard-quit)
+            (define-key minibuffer-local-map [escape] #'minibuffer-keyboard-quit)
+            (define-key minibuffer-local-ns-map [escape] #'minibuffer-keyboard-quit)
+            (define-key minibuffer-local-completion-map [escape] #'minibuffer-keyboard-quit)
+            (define-key minibuffer-local-must-match-map [escape] #'minibuffer-keyboard-quit)
+            (define-key minibuffer-local-isearch-map [escape] #'minibuffer-keyboard-quit)
+            (evil-define-key 'normal emacs-lisp-mode-map (kbd "K") #'elisp-slime-nav-describe-elisp-thing-at-point)))
+
+(use-package evil-collection
+  :if evil-mode
+  :init (progn
+          (setq evil-collection-company-use-tng nil))
+  :config (evil-collection-init))
+
+(use-package evil-commentary
+  :if evil-mode
+  :config (evil-commentary-mode +1))
+
+(use-package evil-goggles
+  :if evil-mode
+  :config (progn
+            (evil-goggles-mode +1)
+            (evil-goggles-use-diff-faces)))
+
+(use-package evil-mu4e
+  :if evil-mode
+  :after mu4e)
+
+(use-package evil-magit
+  :if evil-mode
+  :defines (evil-magit-use-y-for-yank)
+  :after magit
+  :config (progn
+            (setq evil-magit-use-y-for-yank nil)))
+
+(use-package evil-quickscope
+  :if evil-mode
+  :config (progn
+            (global-evil-quickscope-mode +1)))
+
+(use-package evil-org
+  :if evil-mode
+  :config (progn
+            (define-hook-helper org-mode ()
+              (evil-org-mode +1))
+            (define-hook-helper evil-org-mode ()
+              (evil-org-set-key-theme))))
+
+(use-package evil-org-agenda
+  :if evil-mode
+  :after evil-org
+  :functions (evil-org-agenda-set-keys)
+  :config (progn
+            (require 'evil-org-agenda)
+            (evil-org-agenda-set-keys)))
+
+(use-package evil-snipe
+  :defines (evil-snipe-scope)
+  :if evil-mode
+  :config (progn
+            (setq evil-snipe-scope 'visible)
+            (evil-snipe-mode +1)
+            (add-hook 'magit-mode-hook #'turn-off-evil-snipe-override-mode)))
+
+(use-package evil-surround
+  :if evil-mode
+  :config (progn
+            (global-evil-surround-mode +1)))
+
+(use-package evil-space
+  :if evil-mode
+  :config (progn
+            (evil-space-mode +1)))
+
+(use-package sentence-navigation
+  :if evil-mode
+  :config (progn
+            (define-key evil-motion-state-map ")" 'sentence-nav-evil-forward)
+            (define-key evil-motion-state-map "(" 'sentence-nav-evil-backward)
+            (define-key evil-motion-state-map "g)" 'sentence-nav-evil-forward-end)
+            (define-key evil-motion-state-map "g(" 'sentence-nav-evil-backward-end)
+            (define-key evil-outer-text-objects-map "s" 'sentence-nav-evil-a-sentence)
+            (define-key evil-inner-text-objects-map "s" 'sentence-nav-evil-inner-sentence)))
+
 ;;;; End
 
 ;; Start a server if possible.  A daemon is already a server.