2017-08-15 01:22:55 +02:00
|
|
|
#+TITLE: Emacs config
|
|
|
|
#+AUTHOR: Yorick van Pelt
|
|
|
|
|
|
|
|
* Prelims
|
|
|
|
** use-package compile-time
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(eval-when-compile (require 'use-package))
|
|
|
|
(require 'diminish)
|
|
|
|
(require 'bind-key)
|
|
|
|
#+END_SRC
|
|
|
|
* Org stuff
|
|
|
|
** modules
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+END_SRC
|
|
|
|
** keybindings
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-01-10 22:48:00 +01:00
|
|
|
(bind-keys :map global-map
|
|
|
|
("C-c l" . org-store-link)
|
|
|
|
("C-c a" . org-agenda)
|
|
|
|
("C-c b" . org-iswitchb)
|
|
|
|
("C-c c" . org-capture))
|
2017-08-15 01:22:55 +02:00
|
|
|
#+END_SRC
|
|
|
|
** config
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-01-10 22:48:00 +01:00
|
|
|
(setq org-pretty-entities t)
|
|
|
|
(setq org-startup-indented t)
|
|
|
|
(setq org-src-fontify-natively t)
|
|
|
|
(setq org-completion-use-ido t)
|
|
|
|
(setq org-src-tab-acts-natively t)
|
|
|
|
(setq org-ellipsis "⬎")
|
|
|
|
(setq org-log-done t)
|
|
|
|
(setq org-todo-keywords
|
|
|
|
'((sequence "TODO(t)" "WAIT" "|" "DONE(d)" "CANCEL")))
|
|
|
|
(setq org-agenda-files (list "~/org/life.org"
|
|
|
|
"~/org/ru.org"
|
|
|
|
"~/org/symfo.org"
|
|
|
|
"~/org/fiction.org"))
|
|
|
|
(setq org-use-fast-todo-selection t)
|
|
|
|
(setq org-directory "~/org")
|
2017-08-15 01:22:55 +02:00
|
|
|
|
2018-01-10 22:48:00 +01:00
|
|
|
(defun org-file-path (filename)
|
|
|
|
"Return the absolute address of an org file, given its relative name."
|
|
|
|
(concat (file-name-as-directory org-directory) filename))
|
2017-08-15 01:22:55 +02:00
|
|
|
|
2018-01-10 22:48:00 +01:00
|
|
|
; (setq org-inbox-file "~/org/inbox.org")
|
|
|
|
(setq org-index-file (org-file-path "life.org"))
|
|
|
|
(setq org-archive-location
|
|
|
|
(concat (org-file-path "archive.org") "::* From %s"))
|
2017-08-15 01:22:55 +02:00
|
|
|
|
2018-01-10 22:48:00 +01:00
|
|
|
(setq org-default-notes-file "~/org/refile.org")
|
2017-08-15 01:22:55 +02:00
|
|
|
|
2018-01-10 22:48:00 +01:00
|
|
|
(setq org-agenda-todo-ignore-scheduled t)
|
2017-08-15 01:22:55 +02:00
|
|
|
|
2018-01-10 22:48:00 +01:00
|
|
|
(setq org-capture-templates
|
|
|
|
'(("l" "Today I learned"
|
|
|
|
entry
|
|
|
|
(file+datetree (org-file-path "til.org"))
|
|
|
|
"* %?\n")
|
|
|
|
("u" "link"
|
|
|
|
entry
|
|
|
|
(file+headline org-index-file "check links")
|
|
|
|
"* %^L\n")
|
|
|
|
("w" "Week review"
|
|
|
|
entry
|
|
|
|
(file+datetree (org-file-path "weeklog.org"))
|
|
|
|
"* %?\n")
|
|
|
|
("t" "todo item"
|
|
|
|
entry
|
|
|
|
(file+headline org-index-file "todo")
|
|
|
|
"* TODO %?\n")))
|
|
|
|
|
2017-08-15 01:22:55 +02:00
|
|
|
|
|
|
|
#+END_SRC
|
2018-01-10 22:48:00 +01:00
|
|
|
** add templates
|
2017-08-15 01:22:55 +02:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-01-10 22:48:00 +01:00
|
|
|
(add-to-list 'org-structure-template-alist
|
|
|
|
'("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"))
|
|
|
|
(add-to-list 'org-structure-template-alist
|
|
|
|
'("py" "#+BEGIN_SRC python\n?\n#+END_SRC"))
|
|
|
|
(org-babel-do-load-languages
|
|
|
|
'org-babel-load-languages
|
|
|
|
'((python . t)
|
|
|
|
(sh . t)
|
|
|
|
))
|
2017-08-15 01:22:55 +02:00
|
|
|
#+END_SRC
|
2018-01-10 22:48:00 +01:00
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
|
2017-08-15 01:22:55 +02:00
|
|
|
** org-bullets
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package org-bullets
|
|
|
|
:init (add-hook 'org-mode-hook 'org-bullets-mode t)
|
|
|
|
:commands org-bullets-mode
|
|
|
|
)
|
|
|
|
#+END_SRC
|
|
|
|
** TODO org-ref
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package org-ref
|
|
|
|
:disabled
|
|
|
|
:config
|
|
|
|
(setq org-ref-completion-library 'org-ref-ivy-cite))
|
|
|
|
#+END_SRC
|
|
|
|
* Look
|
|
|
|
** Solarized
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package solarized
|
|
|
|
:if window-system
|
|
|
|
:init
|
|
|
|
(setq-default frame-background-mode 'dark)
|
|
|
|
(set-frame-parameter nil 'background-mode 'dark)
|
|
|
|
(add-hook 'after-make-frame-functions (lambda (frame)
|
|
|
|
"Reenable solarized"
|
|
|
|
(enable-theme 'solarized-dark)))
|
|
|
|
:config
|
|
|
|
(load-theme 'solarized-dark t)
|
|
|
|
(enable-theme 'solarized-dark))
|
|
|
|
#+END_SRC
|
|
|
|
** Transparency
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(set-frame-parameter (selected-frame) 'alpha '(90 . 85))
|
|
|
|
(add-to-list 'default-frame-alist '(alpha . (90 . 85)))
|
|
|
|
#+END_SRC
|
|
|
|
** Cleaner frames
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(tool-bar-mode 0)
|
|
|
|
(menu-bar-mode 0)
|
2017-08-15 17:57:03 +02:00
|
|
|
(scroll-bar-mode 0)
|
2017-08-15 01:22:55 +02:00
|
|
|
#+END_SRC
|
|
|
|
** hl-line
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(when window-system (global-hl-line-mode))
|
2017-08-15 17:57:03 +02:00
|
|
|
(show-paren-mode t)
|
2017-08-15 01:22:55 +02:00
|
|
|
#+END_SRC
|
|
|
|
* Feel
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
#+END_SRC
|
2017-09-18 23:02:50 +02:00
|
|
|
** fix escape
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
; Map escape to cancel (like C-g)...
|
|
|
|
(define-key isearch-mode-map [escape] 'isearch-abort) ;; isearch
|
|
|
|
(define-key isearch-mode-map "\e" 'isearch-abort) ;; \e seems to work better for terminals
|
|
|
|
(global-set-key [escape] 'keyboard-escape-quit) ;; everywhere else
|
|
|
|
#+End_SRC
|
2017-08-15 01:22:55 +02:00
|
|
|
** Fix mouse wheel
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
|
|
|
|
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
|
|
|
|
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
|
|
|
|
(setq scroll-step 1) ;; keyboard scroll one line at a time
|
|
|
|
(defun sfp-page-down (&optional arg)
|
|
|
|
(interactive "^P")
|
|
|
|
(setq this-command 'next-line)
|
|
|
|
(next-line
|
|
|
|
(- (window-text-height)
|
|
|
|
next-screen-context-lines)))
|
|
|
|
(put 'sfp-page-down 'isearch-scroll t)
|
|
|
|
(put 'sfp-page-down 'CUA 'move)
|
|
|
|
(defun sfp-page-up (&optional arg)
|
|
|
|
(interactive "^P")
|
|
|
|
(setq this-command 'previous-line)
|
|
|
|
(previous-line
|
|
|
|
(- (window-text-height)
|
|
|
|
next-screen-context-lines)))
|
|
|
|
(put 'sfp-page-up 'isearch-scroll t)
|
|
|
|
(put 'sfp-page-up 'CUA 'move)
|
|
|
|
(setq scroll-error-top-bottom t)
|
|
|
|
#+END_SRC
|
|
|
|
** Ivy
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2017-09-18 23:02:50 +02:00
|
|
|
(use-package ivy
|
|
|
|
:init
|
|
|
|
(setq ivy-height 10)
|
|
|
|
(setq ivy-use-virtual-buffers t)
|
|
|
|
(setq enable-recursive-minibuffers t)
|
|
|
|
:config
|
|
|
|
(ivy-mode t)
|
|
|
|
:bind (("C-s" . swiper)
|
|
|
|
("C-c C-r" . ivy-resume)
|
|
|
|
("<f6>" . ivy-resume)))
|
2017-08-15 01:22:55 +02:00
|
|
|
#+END_SRC
|
|
|
|
** Counsel
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2017-09-18 23:02:50 +02:00
|
|
|
(use-package counsel
|
|
|
|
:bind (("M-x" . counsel-M-x)
|
|
|
|
("C-x C-f" . counsel-find-file)))
|
2017-08-15 01:22:55 +02:00
|
|
|
#+END_SRC
|
|
|
|
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
|
|
|
|
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
|
|
|
|
(global-set-key (kbd "<f1> l") 'counsel-find-library)
|
|
|
|
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
|
|
|
|
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
|
|
|
|
;; (global-set-key (kbd "C-c g") 'counsel-git)
|
|
|
|
;; (global-set-key (kbd "C-c j") 'counsel-git-grep)
|
|
|
|
;; (global-set-key (kbd "C-c k") 'counsel-ag)
|
|
|
|
;; (global-set-key (kbd "C-x l") 'counsel-locate)
|
|
|
|
;; (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
|
|
|
|
;; (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
|
2018-01-10 22:48:00 +01:00
|
|
|
** projectile
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package projectile
|
|
|
|
:config
|
|
|
|
(projectile-global-mode t)
|
|
|
|
(use-package counsel-projectile))
|
|
|
|
#+END_SRC
|
|
|
|
** ggtags
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package ggtags
|
|
|
|
:demand
|
|
|
|
:bind ("M-." . ggtags-find-tag-dwim))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
2017-09-18 23:02:50 +02:00
|
|
|
** TODO i3-emacs
|
2017-08-15 01:22:55 +02:00
|
|
|
* editing
|
|
|
|
** line numbers
|
|
|
|
*** relative
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package linum-relative
|
|
|
|
:commands linum-relative-toggle)
|
|
|
|
#+END_SRC
|
|
|
|
*** enable globally
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(global-linum-mode t)
|
|
|
|
#+END_SRC
|
|
|
|
** Indentation
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
(setq-default tab-width 2) ; or any other preferred value
|
|
|
|
(defvaralias 'c-basic-offset 'tab-width)
|
|
|
|
(defvaralias 'cperl-indent-level 'tab-width)
|
|
|
|
#+END_SRC
|
|
|
|
** git-gutter-fringe
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package git-gutter-fringe
|
|
|
|
:config (global-git-gutter-mode t))
|
|
|
|
#+END_SRC
|
|
|
|
** all-the-icons
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package all-the-icons
|
|
|
|
:commands all-the-icons-insert)
|
|
|
|
#+END_SRC
|
|
|
|
** backups
|
|
|
|
from [[https://www.emacswiki.org/emacs/BackupDirectory][emacs wiki]]
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2017-08-15 17:57:03 +02:00
|
|
|
(setq vc-make-backup-files t)
|
2017-08-15 01:22:55 +02:00
|
|
|
(setq
|
|
|
|
backup-by-copying t ; don't clobber symlinks
|
|
|
|
backup-directory-alist
|
|
|
|
'(("." . "~/.emacs.d/.saves")) ; don't litter my fs tree
|
|
|
|
delete-old-versions t
|
|
|
|
kept-new-versions 6
|
|
|
|
kept-old-versions 2
|
|
|
|
version-control t) ; use versioned backups
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
** Evil
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package evil
|
|
|
|
:config (evil-mode t))
|
|
|
|
(use-package which-key
|
|
|
|
:init
|
|
|
|
(setq which-key-allow-evil-operators t)
|
|
|
|
(setq which-key-show-operator-state-maps t)
|
|
|
|
:config
|
|
|
|
(which-key-mode 1)
|
|
|
|
(which-key-setup-minibuffer)) ; do I need this?
|
|
|
|
#+END_SRC
|
|
|
|
*** evil-goggles
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package evil-goggles
|
|
|
|
:config (evil-goggles-mode)
|
|
|
|
(evil-goggles-use-diff-faces))
|
|
|
|
#+END_SRC
|
2017-09-18 23:02:50 +02:00
|
|
|
*** TODO [[https://github.com/emacs-evil/evil-surround][evil-surround]]
|
|
|
|
*** TODO more evil bindings
|
|
|
|
**** https://github.com/Somelauw/evil-org-mode/blob/master/doc/keythemes.org
|
|
|
|
**** follow link with ret
|
|
|
|
** TODO multiple-cursors
|
2017-08-15 01:22:55 +02:00
|
|
|
* Tools
|
|
|
|
** Magit
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package magit
|
|
|
|
:bind (("C-c g" . magit-status)
|
|
|
|
("C-c C-g l" . magit-log-all)))
|
|
|
|
#+END_SRC
|
|
|
|
** Pass
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package pass
|
|
|
|
:commands pass)
|
|
|
|
#+END_SRC
|
|
|
|
*** TODO helm-pass or password-store or fix keybindings for pass
|
2017-09-18 23:02:50 +02:00
|
|
|
** TODO https://github.com/mbork/beeminder.el
|
2017-08-15 01:22:55 +02:00
|
|
|
* language-specific
|
|
|
|
** markdown
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package markdown-mode
|
|
|
|
:commands (markdown-mode gfm-mode)
|
|
|
|
:mode (("README\\.md\\'" . gfm-mode)
|
|
|
|
("\\.md\\'" . markdown-mode)
|
|
|
|
("\\.markdown\\'" . markdown-mode))
|
|
|
|
:init (setq markdown-command "multimarkdown"))
|
|
|
|
#+END_SRC
|
2017-09-18 23:02:50 +02:00
|
|
|
** org
|
|
|
|
*** TODO spellchecking
|
|
|
|
*** TODO disable linum on org mode
|
|
|
|
*** TODO use org-cliplink
|
2017-08-15 01:22:55 +02:00
|
|
|
** nix
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package nix-mode
|
|
|
|
:commands (nix-mode)
|
|
|
|
:mode (("\\.nix\\'" . nix-mode)))
|
|
|
|
#+END_SRC
|
2017-09-18 23:02:50 +02:00
|
|
|
** haskell
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(load-library "haskell-mode-autoloads")
|
|
|
|
(use-package intero
|
|
|
|
:config (add-hook 'haskell-mode-hook 'intero-mode)
|
|
|
|
)
|
|
|
|
#+END_SRC
|
|
|
|
*** TODO intero / haskell mode [[https://wiki.haskell.org/Emacs]]
|
|
|
|
** TODO proof-general
|
|
|
|
* Inspiration
|
|
|
|
** [[https://github.com/hrs/dotfiles/blob/master/emacs/.emacs.d/configuration.org][hrs]]
|
|
|
|
** [[https://github.com/angrybacon/dotemacs][angrybacon]]
|
|
|
|
** [[https://github.com/hlissner/.emacs.d][doom]]
|
|
|
|
** [[https://gist.github.com/fmap/b0e89549d43c4cc0d90c14579e366eb3][fmap]]
|
|
|
|
** [[https://github.com/muflax-scholars/emacs.d][muflax]]
|
|
|
|
** [[https://github.com/jwiegley/dot-emacs/blob/master/init.el][jwiegly]]
|