diff options
author | Blaise Thompson <blaise@untzag.com> | 2019-10-16 20:18:30 -0500 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2019-10-16 20:18:30 -0500 |
commit | 63cf3a01209c7d3688b68deed400468befa69b44 (patch) | |
tree | 7d8b0b10304d973b2e858312e989f9638eaf86f2 | |
parent | 1ded41679584aaff8d93da5bc46152ba691448e4 (diff) |
2019-10-16 20:18
-rw-r--r-- | emacs/#init.el# | 293 | ||||
-rw-r--r-- | emacs/init.el | 3 |
2 files changed, 294 insertions, 2 deletions
diff --git a/emacs/#init.el# b/emacs/#init.el# new file mode 100644 index 0000000..9ad9af1 --- /dev/null +++ b/emacs/#init.el# @@ -0,0 +1,293 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; 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. + '(ledger-reports + (quote + (("test" "ledger bal") + ("bal" "%(binary) -f %(ledger-file) bal") + ("reg" "%(binary) -f %(ledger-file) reg") + ("payee" "%(binary) -f %(ledger-file) reg @%(payee)") + ("account" "%(binary) -f %(ledger-file) reg %(account)")))) + '(org-agenda-files + (quote + ("/home/blaise/org/agenda.org" "/home/blaise/org/anniversaries.org" "/home/blaise/org/repeat.org" "/home/blaise/org/todo.org" "/home/blaise/org/clocked.org"))) + '(package-selected-packages + (quote + (treemacs-evil treemacs avy move-text es-lib 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. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) + +;; Bootstrap `use-package' +(require 'package) +(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/"))) +;;(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) +(package-initialize) +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +;; settings --------------------------------------------------------------------------------------- + +(global-auto-revert-mode t) + +(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow)) + +(setq make-backup-files nil) + +;; packages --------------------------------------------------------------------------------------- + +;; company +(use-package company + :ensure t + ) + +;; evil +(use-package evil-leader + :ensure t + :config + (evil-leader/set-leader "<SPC>") + (global-evil-leader-mode) + ) +(use-package evil + :config + (evil-mode 1) + (modify-syntax-entry ?_ "w") + ) + +;; flycheck +(use-package flycheck + :ensure t + :init (global-flycheck-mode)) + +;; helm +(use-package helm + :ensure t + :config + (define-key helm-map (kbd "TAB") #'helm-execute-persistent-action) + (define-key helm-map (kbd "<tab>") #'helm-execute-persistent-action) + (define-key helm-map (kbd ":") #'helm-select-action) + ) +(use-package helm-flyspell + :ensure t + :init (flyspell-mode) + ) +(use-package helm-swoop + :ensure t + ) +(use-package helm-bibtex + :ensure t + :init + (setq bibtex-completion-bibliography '("~/literature/database.bib")) + (setq bibtex-completion-library-path '("~/literature")) + (setq bibtex-completion-notes-path "~/literature") + (setq bibtex-completion-pdf-open-function + (lambda (fpath) + (call-process "evince" nil 0 nil fpath) + ) + ) + ) + +;; ledger +(use-package ledger-mode + :ensure t + :mode "\\.ledger$" + ) +; TODO: consider using flycheck-ledger + +;; org +(use-package org + :ensure t + ) +(setq org-todo-keywords '((sequence "TODO" "WAITING" "|" "DONE" "DELEGATED" "CANCELED"))) +(setq org-tags-column -99) +(use-package org-brain + :ensure t + :init + (setq org-brain-path "~/brain") + ;; For Evil users + (with-eval-after-load 'evil + (evil-set-initial-state 'org-brain-visualize-mode 'emacs)) + :config + (setq org-id-track-globally t) + (setq org-id-locations-file "~/.emacs.d/.org-id-locations") + (setq org-brain-visualize-default-choices 'all) + (setq org-brain-title-max-length 12) + (setq org-agenda-files '("~/org/")) + (setq org-agenda-span 1) + (setq org-agenda-start-with-log-mode t) + (setq org-agenda-start-day "0d") + (setq org-agenda-window-setup 'only-window) + (setq org-clock-mode-line-total 'today) + (setq org-duration-format (quote h:mm)) + ) + +;; spaceline +(use-package spaceline :ensure t) +(spaceline-compile + ; left side + '( + (buffer-id :priority 99) + (major-mode :priority 76) + (version-control :when active :priority 75) + (org-clock :when active :priority 99) + ) + ; right side + '( + (line-column :priority 99) + (buffer-position :priority 75) + (buffer-size :priority 95) + ) + ) +(setq powerline-default-separator 'bar) +(spaceline-emacs-theme) +(spaceline-toggle-minor-modes-off) +(spaceline-toggle-buffer-encoding-abbrev-off) +(spaceline-compile) + +;; 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) + +(setq-default left-margin-width 0 right-margin-width 0) + +(load-file "~/source/dotfiles/emacs/color-theme-tomorrow.el") +(color-theme-tomorrow-night) +(set-face-attribute 'helm-selection nil + :background "#373b41" + :foreground "#c5c8c6" + ) +(set-face-attribute 'highlight nil + :background "#373b41" + ) +hl-line-mode + +(add-to-list 'org-emphasis-alist + '("*" (: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 print-file() + "Blaise's custom print-file function" + (interactive) + (shell-command (concat "enscript -Bc \"" buffer-file-name "\""))) + +(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 ----------------------------------------------------------------------------------------- + +;; text mode +(add-hook 'text-mode-hook 'flyspell-mode) +(add-hook 'text-mode-hook 'turn-on-visual-line-mode) + +;; global +(add-hook 'after-init-hook 'global-company-mode) +(add-hook 'before-save-hook 'delete-trailing-whitespace) + +;;; keybindings ----------------------------------------------------------------------------------- + + + +(org-babel-do-load-languages 'org-babel-load-languages + (append org-babel-load-languages + '((python . t) + (ledger . t) + (shell .t) + (ruby . t)))) + + + +(global-set-key "\t" 'company-complete-common) +(evil-leader/set-key "a" 'org-agenda-list) +(evil-leader/set-key "c" 'calc) +(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 "l" 'helm-bibtex) +(evil-leader/set-key "m" 'helm-mini) +(evil-leader/set-key "p" 'print-file) +(evil-leader/set-key "q" 'save-buffers-kill-terminal) +(evil-leader/set-key "q" 'shell-command) +(evil-leader/set-key "s" 'check-next-spelling-error) +(evil-leader/set-key "t" 'org-clock-goto) +(evil-leader/set-key "T" 'org-clock-out) +(evil-leader/set-key "," 'other-window) +(evil-leader/set-key "/" 'helm-swoop) +(evil-leader/set-key "<SPC>" 'helm-M-x) diff --git a/emacs/init.el b/emacs/init.el index 0464931..a4d6c6e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -276,8 +276,6 @@ hl-line-mode (global-set-key "\t" 'company-complete-common) (evil-leader/set-key "a" 'org-agenda-list) -(evil-leader/set-key "b" 'org-brain-visualize) -(evil-leader/set-key "B" 'org-brain-visualize) (evil-leader/set-key "c" 'calc) (evil-leader/set-key "f" 'helm-find-files) (evil-leader/set-key "j" 'dired-jump) @@ -286,6 +284,7 @@ hl-line-mode (evil-leader/set-key "m" 'helm-mini) (evil-leader/set-key "p" 'print-file) (evil-leader/set-key "q" 'save-buffers-kill-terminal) +(evil-leader/set-key "r" 'shell-command) (evil-leader/set-key "s" 'check-next-spelling-error) (evil-leader/set-key "t" 'org-clock-goto) (evil-leader/set-key "T" 'org-clock-out) |