summaryrefslogtreecommitdiff
path: root/emacs/init.el
diff options
context:
space:
mode:
authorBlaise Thompson <blaise@untzag.com>2018-07-03 09:13:37 -0500
committerBlaise Thompson <blaise@untzag.com>2018-07-03 09:13:37 -0500
commitf972585b1ce8c6f29320f157cdd711277b3f5c33 (patch)
treecd7ba9ca7f208da1be56381aa68492e92344a898 /emacs/init.el
parent7bcb0b78ce9e70b5e09ed84677742357ffdd3709 (diff)
2018-07-03 09:13
Diffstat (limited to 'emacs/init.el')
-rw-r--r--emacs/init.el117
1 files changed, 108 insertions, 9 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 8a49306..dc9dead 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -3,13 +3,9 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
- '(custom-enabled-themes (quote (sanityinc-tomorrow-night)))
- '(custom-safe-themes
- (quote
- ("06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" default)))
'(package-selected-packages
(quote
- (helm-swoop evil-leader helm spaceline evil use-package))))
+ (helm-flyspell flycheck which-key helm-swoop evil-leader helm spaceline evil use-package))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -25,6 +21,8 @@
(package-refresh-contents)
(package-install 'use-package))
+;; packages ---------------------------------------------------------------------------------------
+
;; evil
(use-package evil-leader
:ensure t
@@ -37,6 +35,11 @@
(modify-syntax-entry ?_ "w")
)
+;; flycheck
+(use-package flycheck
+ :ensure t
+ :init (global-flycheck-mode))
+
;; helm
(use-package helm
:ensure t
@@ -45,6 +48,10 @@
(define-key helm-map (kbd "<tab>") #'helm-execute-persistent-action)
(define-key helm-map (kbd "C-z") #'helm-select-action)
)
+(use-package helm-flyspell
+ :ensure t
+ :init (flyspell-mode)
+ )
(use-package helm-swoop
:ensure t
)
@@ -71,13 +78,105 @@
(setq powerline-default-separator 'bar)
(spaceline-emacs-theme)
-;; theme
+;; which-key
+(use-package which-key
+ :ensure t
+ :config
+ (setq which-key-popup-type 'minibuffer)
+ (setq which-key-allow-evil-operators t)
+ )
+(which-key-mode)
+
+;; theme ------------------------------------------------------------------------------------------
+
(menu-bar-mode -1)
(tool-bar-mode -1)
(toggle-scroll-bar -1)
-(color-theme-sanityinc-tomorrow-night)
+;; TODO: color theme
+
+(setq-default left-margin-width 0 right-margin-width 0)
-;; keybindings
+(load-file "~/source/dotfiles/emacs/color-theme-tomorrow.el")
+(color-theme-tomorrow-night)
+(set-face-attribute 'helm-selection nil
+ :background "#373b41"
+ :foreground "#c5c8c6")
+
+;;; functions -------------------------------------------------------------------------------------
+
+(defun flyspell-goto-previous-error (arg)
+ "Go to arg previous spelling error."
+ (interactive "p")
+ (while (not (= 0 arg))
+ (let ((pos (point))
+ (min (point-min)))
+ (if (and (eq (current-buffer) flyspell-old-buffer-error)
+ (eq pos flyspell-old-pos-error))
+ (progn
+ (if (= flyspell-old-pos-error min)
+ ;; goto beginning of buffer
+ (progn
+ (message "Restarting from end of buffer")
+ (goto-char (point-max)))
+ (backward-word 1))
+ (setq pos (point))))
+ ;; seek the next error
+ (while (and (> pos min)
+ (let ((ovs (overlays-at pos))
+ (r '()))
+ (while (and (not r) (consp ovs))
+ (if (flyspell-overlay-p (car ovs))
+ (setq r t)
+ (setq ovs (cdr ovs))))
+ (not r)))
+ (backward-word 1)
+ (setq pos (point)))
+ ;; save the current location for next invocation
+ (setq arg (1- arg))
+ (setq flyspell-old-pos-error pos)
+ (setq flyspell-old-buffer-error (current-buffer))
+ (goto-char pos)
+ (if (= pos min)
+ (progn
+ (message "No more miss-spelled word!")
+ (setq arg 0))))))
+
+(defun check-previous-spelling-error ()
+ "Jump to previous spelling error and correct it"
+ (interactive)
+ (push-mark-no-activate)
+ (flyspell-goto-previous-error 1)
+ (call-interactively 'helm-flyspell-correct))
+
+(defun check-next-spelling-error ()
+ "Jump to next spelling error and correct it"
+ (interactive)
+ (push-mark-no-activate)
+ (flyspell-buffer)
+ (flyspell-goto-next-error)
+ (call-interactively 'helm-flyspell-correct))
+
+(defun push-mark-no-activate ()
+ "Pushes `point' to `mark-ring' and does not activate the region
+ Equivalent to \\[set-mark-command] when \\[transient-mark-mode] is disabled"
+ (interactive)
+ (push-mark (point) t nil)
+ (message "Pushed mark to ring"))
+
+;;; hooks -----------------------------------------------------------------------------------------
+
+(add-hook 'text-mode-hook 'flyspell-mode)
+
+;; keybindings ------------------------------------------------------------------------------------
+
+(evil-leader/set-key "b" 'org-brain-visualize)
(evil-leader/set-key "f" 'helm-find-files)
+(evil-leader/set-key "j" 'dired-jump)
+(evil-leader/set-key "k" 'kill-buffer)
(evil-leader/set-key "m" 'helm-mini)
-(evil-leader/set-key "b" 'org-brain-visualize)
+(evil-leader/set-key "q" 'save-buffers-kill-terminal)
+(evil-leader/set-key "s" 'check-next-spelling-error)
+(evil-leader/set-key "t" 'color-theme-tomorrow-night)
+(evil-leader/set-key "T" 'color-theme-tomorrow)
+(evil-leader/set-key "x" 'helm-M-x)
+(evil-leader/set-key "," 'other-window)