@ -1,601 +1,11 @@ | |||||
;; -*- lexical-binding: t; -*- | ;; -*- lexical-binding: t; -*- | ||||
(defvar file-name-handler-alist-old file-name-handler-alist) | |||||
(add-to-list 'load-path (concat user-emacs-directory "lisp/")) | |||||
(setq file-name-handler-alist nil | |||||
message-log-max 16384 | |||||
gc-cons-threshold 402653184 | |||||
gc-cons-percentage 0.6 | |||||
auto-window-vscroll nil) | |||||
(add-hook 'after-init-hook | |||||
`(lambda () | |||||
(setq file-name-handler-alist file-name-handler-alist-old | |||||
gc-cons-threshold 800000 | |||||
gc-cons-percentage 0.1) | |||||
(garbage-collect)) t) | |||||
;; Configure Melpa | |||||
;; Package management | |||||
;; set load-path manually | |||||
;; don't call package-initialize | |||||
(eval-and-compile | |||||
(setq load-prefer-newer t | |||||
package-user-dir "~/.emacs.d/elpa" | |||||
package--init-file-ensured t ; so it doesn't call package initialize | |||||
package-enable-at-startup nil) ; do not automatically load packages | |||||
(unless (file-directory-p package-user-dir) | |||||
(make-directory package-user-dir t))) | |||||
(setq use-package-verbose t | |||||
use-package-always-defer nil ;I'm not used to that | |||||
use-package-minimum-reported-time 0.01) | |||||
;; Initialize package management | |||||
(eval-when-compile ; when byte compiled skip this | |||||
(require 'package) | |||||
;; add aditional package archives | |||||
(setq package-archives | |||||
`(("gnu" . "https://elpa.gnu.org/packages/") | |||||
("melpa" . "https://melpa.org/packages/") | |||||
("org" . "https://orgmode.org/elpa/"))) | |||||
;; initialize packages and ensure that use-package is installed | |||||
(package-initialize) | |||||
(unless (package-installed-p 'use-package) | |||||
(package-refresh-contents) | |||||
(package-install 'use-package)) ; install if it's missing | |||||
(require 'use-package) | |||||
(setq use-package-always-ensure t)) | |||||
;; Define custom keymap prefixes | |||||
(eval-and-compile | |||||
(mapc #'(lambda (entry) | |||||
(define-prefix-command (cdr entry)) | |||||
(bind-key (car entry) (cdr entry))) | |||||
'( | |||||
;; ("C-," . my-ctrl-comma-map) | |||||
;; ("<C-m>" . my-ctrl-m-map) | |||||
;; ("C-h e" . my-ctrl-h-e-map) | |||||
;; ("C-h x" . my-ctrl-h-x-map) | |||||
("C-c b" . my-ctrl-c-b-map) | |||||
;; ("C-c e" . my-ctrl-c-e-map) | |||||
;; ("C-c m" . my-ctrl-c-m-map) | |||||
;; ("C-c w" . my-ctrl-c-w-map) | |||||
;; ("C-c y" . my-ctrl-c-y-map) | |||||
;; ("C-c H" . my-ctrl-c-H-map) | |||||
;; ("C-c N" . my-ctrl-c-N-map) | |||||
;; ("C-c (" . my-ctrl-c-open-paren-map) | |||||
;; ("C-c -" . my-ctrl-c-minus-map) | |||||
;; ("C-c =" . my-ctrl-c-equals-map) | |||||
;; ("C-c ." . my-ctrl-c-r-map) | |||||
))) | |||||
;; Compile function | |||||
(defun compile-init () | |||||
"If the current buffer is 'init.el' tangled file is compiled." | |||||
(when (equal (buffer-file-name) | |||||
(expand-file-name (concat user-emacs-directory "init.el"))) | |||||
;; Avoid running hooks when tangling. | |||||
(let ((prog-mode-hook nil)) | |||||
(byte-compile-file (concat user-emacs-directory "init.el"))))) | |||||
;; (add-hook 'after-save-hook 'compile-init) | |||||
;; Some Basic Init | |||||
(defvar backup-dir (expand-file-name "~/.emacs.d/backup/")) | |||||
(defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/")) | |||||
(setq initial-scratch-message nil | |||||
backup-directory-alist (list (cons ".*" backup-dir)) | |||||
auto-save-list-file-prefix autosave-dir | |||||
auto-save-file-name-transforms `((".*" ,autosave-dir t))) | |||||
;; Turn off the menus, scrollbars, and toolbars | |||||
(menu-bar-mode 0) | |||||
(scroll-bar-mode 0) | |||||
(tool-bar-mode 0) | |||||
(horizontal-scroll-bar-mode 0) | |||||
;; Revert to file on disk if it changes | |||||
(global-auto-revert-mode t) | |||||
;; Highlight the current line | |||||
(global-hl-line-mode t) | |||||
;; Show the column number after the line number (i.e. 50:57) | |||||
(column-number-mode t) | |||||
;; C-c <left>|<right> to undo|redo window changes like adding buffers. | |||||
(winner-mode t) | |||||
;; Show matching paren | |||||
(show-paren-mode t) | |||||
;; Indent w/spaces only | |||||
(setq indent-tabs-mode nil) | |||||
;; Prevent stale elisp bytecode | |||||
(setq load-prefer-newer t) | |||||
;; Add newline on save | |||||
(setq require-final-newline t) | |||||
;; C-c to copy in Linux can be pasted in emacs | |||||
(setq select-enable-clipboard t) | |||||
;; after mouse selection can be pasted in emacs | |||||
(setq select-enable-primary t) | |||||
;; Paste at current point, not mouse location when "middle-clicking" | |||||
(setq mouse-yank-at-point t) | |||||
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |||||
;; Set auth source | |||||
;; (setq auth-sources '("~/.authinfo.gpg")) | |||||
(defalias 'yes-or-no-p 'y-or-n-p) | |||||
(setq browse-url-generic-program "brave" | |||||
browse-url-browser-function 'browse-url-generic) | |||||
(defun display-startup-echo-area-message () | |||||
"Display startup echo area message." | |||||
(message "Initialized in %s" (emacs-init-time))) | |||||
(defun leo--find-user-init-file () | |||||
"Edit the `~/.emacs.d/init.el' file." | |||||
(interactive) | |||||
(find-file "~/.emacs.d/init.el")) | |||||
(defun leo--tidy () | |||||
"Indent, untabify and unwhitespacify current buffer, or region if active." | |||||
(interactive) | |||||
(let ((beg (if (region-active-p) (region-beginning) (point-min))) | |||||
(end (if (region-active-p) (region-end) (point-max)))) | |||||
(let ((inhibit-message t)) | |||||
(indent-region beg end)) | |||||
(whitespace-cleanup) | |||||
(untabify beg (if (< end (point-max)) end (point-max))) | |||||
(if (region-active-p) (message "Indenting Region...Done") (message "Indenting File...Done")))) | |||||
(defun leo--comment-or-uncomment-region-or-line () | |||||
"Comment or uncomment the region or the current line if there's no active region." | |||||
(interactive) | |||||
(let (beg end) | |||||
(if (region-active-p) | |||||
(setq beg (region-beginning) end (region-end)) | |||||
(setq beg (line-beginning-position) end (line-end-position))) | |||||
(comment-or-uncomment-region beg end))) | |||||
(defun leo--duplicate-thing (comment) | |||||
"Duplicates the current line, or the region if active. If an argument (COMMENT) is given, the duplicated region will be commented out." | |||||
(interactive "P") | |||||
(save-excursion | |||||
(let ((start (if (region-active-p) (region-beginning) (point-at-bol))) | |||||
(end (if (region-active-p) (region-end) (point-at-eol)))) | |||||
(goto-char end) | |||||
(unless (region-active-p) | |||||
(newline)) | |||||
(insert (buffer-substring start end)) | |||||
(when comment (comment-region start end))))) | |||||
(defun leo--kill-this-buffer-unless-scratch () | |||||
"Works like `kill-this-buffer' unless the current buffer is the *scratch* buffer. In which case the buffer content is deleted and the buffer is buried." | |||||
(interactive) | |||||
(if (or (string= (buffer-name) "*dashboard*") (string= (buffer-name) "*scratch*")) | |||||
(progn | |||||
(bury-buffer (buffer-name)) | |||||
(switch-to-buffer (other-buffer))) | |||||
(kill-this-buffer))) | |||||
(defun leo--jump-to-symbol (&optional backwardp) | |||||
"Jumps to the next symbol near the point if such a symbol exists. If BACKWARDP is non-nil it jumps backward." | |||||
(let* ((point (point)) | |||||
(bounds (find-tag-default-bounds)) | |||||
(beg (car bounds)) (end (cdr bounds)) | |||||
(str (isearch-symbol-regexp (find-tag-default))) | |||||
(search (if backwardp 'search-backward-regexp | |||||
'search-forward-regexp))) | |||||
(goto-char (if backwardp beg end)) | |||||
(funcall search str nil t) | |||||
(cond ((<= beg (point) end) (goto-char point)) | |||||
(backwardp (forward-char (- point beg))) | |||||
(t (backward-char (- end point)))))) | |||||
(defun leo--jump-to-prev-symbol () | |||||
"Jumps to the previous occurrence of the symbol at point." | |||||
(interactive) | |||||
(leo--jump-to-symbol t)) | |||||
(defun leo--jump-to-next-symbol () | |||||
"Jumps to the next occurrence of the symbol at point." | |||||
(interactive) | |||||
(leo--jump-to-symbol)) | |||||
;; USE PACKAGE help | |||||
;; (use-package package-here | |||||
;; :commands (cmd cmd-all cmd-etc) ;; List commands used to ":defer" the package | |||||
;; :bind-keymap | |||||
;; ("M-q" . package-here-keymap) ;; Setup an entire keymap using Prefix "M-q" | |||||
;; :bind | |||||
;; (("M-s" . cmd) ;; Available Globally | |||||
;; :map here-mode-map | |||||
;; ("C-t" . cmd-all) ;; Available only in "here-mode" | |||||
;; ("C-e" . cmd-etc)) ;; Available only in "here-mode" | |||||
;; :init | |||||
;; (setq stuff t) ;; declar vars etc... | |||||
;; :config | |||||
;; (here-mode 1) ;; eval stuff here after the init | |||||
;; | |||||
;; (use-package ruby-mode | |||||
;; :mode "\\.rb\\'" | |||||
;; :interpreter "ruby" | |||||
;; | |||||
;; ;; OR when the package name isn't the same as the =mode= | |||||
;; (use-package python | |||||
;; :mode ("\\.py\\'" . python-mode) | |||||
;; :interpreter ("python" . python-mode)) | |||||
;; | |||||
;; USE ":defer" when you aren't using either :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, :interpreter, or :hook | |||||
;; (use-package deferred-package | |||||
;; :defer t) | |||||
;; https://github.com/jwiegley/use-package/blob/master/bind-key.el | |||||
(use-package bind-key | |||||
:ensure t | |||||
:bind | |||||
("C-<tab>" . leo--tidy) | |||||
("C-;" . leo--comment-or-uncomment-region-or-line) | |||||
("C-c e" . leo--find-user-init-file) | |||||
("M-q" . leo--kill-this-buffer-unless-scratch) | |||||
("C-c d" . leo--duplicate-thing) | |||||
("M-n" . leo--jump-to-next-symbol) | |||||
("M-p" . leo--jump-to-prev-symbol) | |||||
("M-u" . upcase-dwim) | |||||
("M-c" . capitalize-dwim) | |||||
("M-l" . downcase-dwim) | |||||
) | |||||
;; https://github.com/winterTTr/ace-jump-mode | |||||
(use-package ace-jump-mode | |||||
:bind | |||||
(("C-c SPC" . just-one-space) | |||||
("M-SPC" . ace-jump-mode))) | |||||
;; https://github.com/abo-abo/ace-window | |||||
(use-package ace-window | |||||
:ensure t | |||||
:bind | |||||
("M-o" . ace-window) | |||||
:init | |||||
(setq aw-keys '(?a ?s ?h ?t ?g ?y ?n ?e ?o ?i)) | |||||
) | |||||
;; https://github.com/hlissner/emacs-doom-themes | |||||
(use-package doom-themes | |||||
:ensure t | |||||
:config | |||||
(load-theme 'doom-one t)) | |||||
;; https://github.com/belak/base16-emacs | |||||
(use-package base16-theme | |||||
:disabled | |||||
:ensure t | |||||
:config | |||||
(load-theme 'base16-onedark t)) | |||||
;; https://github.com/Malabarba/beacon | |||||
(use-package beacon | |||||
:diminish | |||||
:commands beacon-mode | |||||
:init | |||||
(setq beacon-size 80)) | |||||
;; https://github.com/coldnew/linum-relative | |||||
(use-package linum-relative | |||||
:ensure t | |||||
:config | |||||
(linum-relative-mode)) | |||||
;; https://github.com/Fanael/rainbow-delimiters | |||||
(use-package rainbow-delimiters | |||||
:ensure t | |||||
:hook (prog-mode . rainbow-delimiters-mode)) | |||||
;; M-x all-the-icons-install-fonts | |||||
(use-package all-the-icons | |||||
:ensure t) | |||||
(use-package doom-modeline | |||||
:ensure t | |||||
:after (all-the-icons) | |||||
:hook (after-init . doom-modeline-mode)) | |||||
(use-package dashboard | |||||
:ensure t | |||||
:init | |||||
(setq dashboard-items '((recents . 6) | |||||
(bookmarks . 5) | |||||
;; (projects . 5) | |||||
(agenda . 5))) | |||||
(setq dashboard-center-content t) | |||||
(setq dashboard-banner-logo-title "Let's begin...") | |||||
(setq dashboard-startup-banner 1) | |||||
(setq dashboard-show-shortcuts t) | |||||
(setq show-week-agenda-p t) | |||||
(setq dashboard-org-agenda-categories '("work" "tasks")) | |||||
:config | |||||
(dashboard-setup-startup-hook)) | |||||
(use-package helm | |||||
:ensure t | |||||
:demand t | |||||
:bind | |||||
("M-x" . helm-M-x) | |||||
("C-c b" . helm-buffers-list) | |||||
("C-x C-f" . helm-find-files)) | |||||
;; https://github.com/emacsorphanage/helm-swoop | |||||
(use-package helm-swoop | |||||
:ensure t | |||||
:after (helm) | |||||
:bind | |||||
("C-s" . helm-swoop) | |||||
:config | |||||
;; If you prefer fuzzy matching | |||||
(setq helm-swoop-use-fuzzy-match t)) | |||||
;; https://github.com/syohex/emacs-helm-ag | |||||
(use-package helm-ag | |||||
:ensure t | |||||
:after (helm) | |||||
:bind | |||||
("C-c k" . helm-ag)) | |||||
;; https://github.com/magnars/expand-region.el | |||||
(use-package expand-region | |||||
:ensure t | |||||
:bind | |||||
("C-@" . er/expand-region) | |||||
("C-#" . er/contract-region)) | |||||
;; https://github.com/magnars/multiple-cursors.el | |||||
(use-package multiple-cursors | |||||
:ensure t | |||||
:bind | |||||
("C-}" . mc/mark-next-like-this) | |||||
("C-)" . mc/unmark-next-like-this) | |||||
("C-{" . mc/mark-previous-like-this) | |||||
("C-(" . mc/unmark-previous-like-this)) | |||||
;; https://github.com/joodland/bm | |||||
(use-package bm | |||||
:bind (("C-c b b" . bm-toggle) | |||||
("C-c b n" . bm-next) | |||||
("C-c b p" . bm-previous)) | |||||
:commands (bm-repository-load | |||||
bm-buffer-save | |||||
bm-buffer-save-all | |||||
bm-buffer-restore) | |||||
:init | |||||
(setq bm-restore-repository-on-load t) | |||||
(setq bm-repository-file (concat user-emacs-directory "bookmark-repo")) | |||||
(add-hook 'after-init-hook 'bm-repository-load) | |||||
(add-hook 'find-file-hooks 'bm-buffer-restore) | |||||
(add-hook 'after-revert-hook #'bm-buffer-restore) | |||||
(add-hook 'kill-buffer-hook #'bm-buffer-save) | |||||
(add-hook 'after-save-hook #'bm-buffer-save) | |||||
(add-hook 'vc-before-checkin-hook #'bm-buffer-save) | |||||
(add-hook 'kill-emacs-hook #'(lambda nil | |||||
(bm-buffer-save-all) | |||||
(bm-repository-save)))) | |||||
;; https://github.com/rmuslimov/browse-at-remote | |||||
(use-package browse-at-remote | |||||
:bind ("C-c B" . browse-at-remote)) | |||||
;; https://github.com/justbur/emacs-which-key | |||||
(use-package which-key | |||||
:ensure t | |||||
:config | |||||
(which-key-setup-minibuffer) | |||||
(which-key-mode)) | |||||
;; https://github.com/lewang/fic-mode | |||||
(use-package fic-mode | |||||
:ensure t | |||||
:hook prog-mode) | |||||
;; https://github.com/joaotavora/yasnippet | |||||
(use-package yasnippet | |||||
:ensure t | |||||
:hook (prog-mode . yas-minor-mode) | |||||
:init | |||||
(setq yas-snippet-dirs (list (concat user-emacs-directory "snippets"))) | |||||
:config | |||||
(yas-reload-all)) | |||||
;; https://company-mode.github.io/ | |||||
(use-package company | |||||
:ensure t | |||||
:hook (prog-mode . company-mode)) | |||||
;; https://github.com/magit/magit | |||||
(use-package magit | |||||
:commands magit-status | |||||
:ensure t | |||||
:init | |||||
(setq magit-completing-read-function 'helm-completing-read-default-handler) | |||||
:bind | |||||
("C-x g" . magit-status) | |||||
("C-c g" . magit-status)) | |||||
;; https://github.com/bbatsov/projectile | |||||
(use-package projectile | |||||
:ensure t | |||||
:bind-keymap | |||||
("C-c p" . projectile-command-map) | |||||
) | |||||
;; https://github.com/magit/git-modes | |||||
(use-package gitignore-mode | |||||
:ensure t) | |||||
;; https://github.com/magit/git-modes | |||||
(use-package gitconfig-mode | |||||
:ensure t) | |||||
;; http://web-mode.org/ | |||||
(use-package web-mode | |||||
:ensure t | |||||
:mode "\\.html?\\'") | |||||
;; https://github.com/joshwnj/json-mode | |||||
(use-package json-mode | |||||
:ensure t | |||||
:mode "\\.json\\'") | |||||
;; https://github.com/antonj/scss-mode | |||||
(use-package scss-mode | |||||
:ensure t | |||||
:mode ("\\.s?css\\'" . scss-mode)) | |||||
;; https://elpa.gnu.org/packages/csv-mode.html | |||||
(use-package csv-mode | |||||
:disabled | |||||
:ensure t | |||||
:mode ("\\.csv\\'" . csv-mode)) | |||||
;; https://orgmode.org/elpa.html | |||||
(use-package org | |||||
:commands (org-cycle-agenda-files org-capture) | |||||
:ensure org-plus-contrib | |||||
:mode ("\\.org\\'" . org-mode) | |||||
:bind ( | |||||
("C-," . org-cycle-agenda-files) | |||||
("C-c C-d" . org-capture) | |||||
:map org-mode-map | |||||
("M-RET" . org-insert-todo-heading) | |||||
) | |||||
:init | |||||
(setq org-agenda-files '("~/Dropbox/Org/todo.org" | |||||
"~/Dropbox/Org/archive.org" | |||||
"~/Dropbox/Org/diary/eaglecrk.org")) | |||||
(setq org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)") | |||||
(sequence "BUG(b)" "INPROGRESS(i)" "|" "FIXED(f)") | |||||
(sequence "TEST(T)" "NOTEST(N)" "|" "COMPLETE(C)") | |||||
(sequence "|" "CANCELED(c)") | |||||
(sequence "|" "NEEDCLARIFICATION(n)") | |||||
(sequence "|" "PROVIDEUPDATE(p)") | |||||
(sequence "|" "WAITING(w)")) | |||||
org-refile-targets '((nil :maxlevel . 3) | |||||
(org-agenda-files :maxlevel . 3)) | |||||
org-directory "~/Dropbox/Org" | |||||
org-default-notes-file (concat org-directory "/todo.org") | |||||
org-startup-folded t | |||||
org-startup-indented t | |||||
org-startup-align-all-tables t | |||||
org-startup-with-inline-images t | |||||
org-startup-with-latex-preview t | |||||
org-src-tab-acts-natively t | |||||
org-confirm-babel-evaluate nil | |||||
org-log-done t | |||||
org-log-done-with-time t | |||||
org-log-into-drawer t | |||||
org-hide-leading-stars t | |||||
org-pretty-entities t | |||||
org-use-property-inheritance t | |||||
org-html-validation-link nil | |||||
org-html-text-markup-alist '((bold . "<b>%s</b>") | |||||
(code . "<code>%s</code>") | |||||
(italic . "<i>%s</i>") | |||||
(strike-through . "<del>%s</del>") | |||||
(underline . "<span class=\"underline\">%s</span>") | |||||
(verbatim . "<code class=\"verbatim\">%s</code>")) | |||||
) | |||||
:config | |||||
(org-babel-do-load-languages 'org-babel-load-languages '((js . t) | |||||
(shell . t) | |||||
(emacs-lisp . t))) | |||||
(add-to-list 'org-structure-template-alist | |||||
(list "e" (concat "#+BEGIN_SRC emacs-lisp :results silent\n" | |||||
"\n" | |||||
"#+END_SRC"))) | |||||
(add-to-list 'org-structure-template-alist | |||||
(list "j" (concat "#+BEGIN_SRC js :cmd \"/usr/local/bin/babel-node\" :results output code\n" | |||||
"\n" | |||||
"#+END_SRC"))) | |||||
(add-to-list 'org-structure-template-alist | |||||
(list "r" (concat "#+BEGIN_SRC restclient :results raw\n" | |||||
"\n" | |||||
"#+END_SRC"))) | |||||
) | |||||
;; https://github.com/sabof/org-bullets | |||||
(use-package org-bullets | |||||
:ensure t | |||||
:after (org) | |||||
:hook (org-mode . org-bullets-mode) | |||||
:config | |||||
(set-face-attribute 'org-level-1 nil :height 1.3) | |||||
(set-face-attribute 'org-level-2 nil :height 1.1) | |||||
(set-face-attribute 'org-level-3 nil :height 1.05) | |||||
(set-face-attribute 'org-level-4 nil :height 1.05) | |||||
(set-face-attribute 'org-scheduled-today nil :height 1.0) | |||||
(set-face-attribute 'org-agenda-date-today nil :height 1.1)) | |||||
;; https://orgmode.org/worg/org-contrib/org-protocol.html | |||||
(use-package org-protocol | |||||
:ensure org-plus-contrib | |||||
:after (org) | |||||
:init | |||||
(setq org-capture-templates | |||||
'(("t" "new task" entry (file+headline "~/Dropbox/Org/todo.org" "Tasks") | |||||
"* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n") | |||||
("n" "new note" entry (file+headline org-default-notes-file "Notes") | |||||
"* %?\n%i\n") | |||||
("l" "store link" entry (file+olp org-default-notes-file "Links" "Unfiled") | |||||
"* %a\n%?\n") | |||||
("d" "store link w/drawer" entry (file+olp org-default-notes-file "Links" "Unfiled") | |||||
"* %?\n%l\n:COPIED_TEXT:\n %i\n:END:\n") | |||||
("f" "dotfile" entry (file+headline "~/Dropbox/Org/dotfiles.org" "Other") | |||||
"* %?\n:PROPERTIES:\n:CUSTOM_ID: %(org-id-get-create)\n:END:\n") | |||||
)) | |||||
) | |||||
(cond ((member "PragmataPro Liga" (font-family-list)) | |||||
(set-face-attribute 'default nil :font "PragmataPro Liga-12"))) | |||||
(require 'custom-early-init) | |||||
(require 'custom-package-setup) | |||||
(require 'custom-init) | |||||
(require 'custom-functions) | |||||
(require 'custom-packages) | |||||
(server-start) | (server-start) | ||||
;; Reset GC as late as possible | |||||
;; (add-hook 'emacs-startup-hook | |||||
;; (setq gc-cons-threshold 16777216 | |||||
;; gc-cons-percentage 0.1)) | |||||
(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. | |||||
'(package-selected-packages | |||||
(quote | |||||
(browse-at-remote bm yasnippet which-key web-mode use-package scss-mode rainbow-delimiters projectile org-plus-contrib org-bullets multiple-cursors magit linum-relative json-mode helm-swoop helm-ag gitignore-mode gitconfig-mode fic-mode expand-region doom-themes doom-modeline dashboard company beacon ace-window ace-jump-mode))) | |||||
'(safe-local-variable-values | |||||
(quote | |||||
((eval org-content 2) | |||||
(whitespace-line-column . 120))))) | |||||
(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. | |||||
) |
@ -0,0 +1,29 @@ | |||||
;; -*- lexical-binding: t; -*- | |||||
;;; custom-early-init --- Provide early init vars | |||||
(defvar file-name-handler-alist-old file-name-handler-alist) | |||||
(defvar personal-keybindings nil | |||||
"List of bindings performed by `bind-key'. | |||||
Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)") | |||||
(setq file-name-handler-alist nil | |||||
message-log-max 16384 | |||||
gc-cons-threshold 402653184 | |||||
gc-cons-percentage 0.6 | |||||
auto-window-vscroll nil) | |||||
(setq safe-local-variable-values (quote ( | |||||
(eval org-content 2) | |||||
(whitespace-line-column . 120) | |||||
))) | |||||
(setq custom-file (concat user-emacs-directory "lisp/unused.el")) | |||||
(add-hook 'after-init-hook | |||||
`(lambda () | |||||
(setq file-name-handler-alist file-name-handler-alist-old | |||||
gc-cons-threshold 800000 | |||||
gc-cons-percentage 0.1) | |||||
(garbage-collect)) t) | |||||
(provide 'custom-early-init) |
@ -0,0 +1,101 @@ | |||||
;; -*- lexical-binding: t; -*- | |||||
;;; custom-functions --- custom functions prefixed with "leo/" | |||||
(defun leo/compile-init () | |||||
"If the current buffer is 'init.el', compile it." | |||||
(interactive) | |||||
(when (equal (buffer-file-name) | |||||
(expand-file-name (concat user-emacs-directory "init.el"))) | |||||
;; Avoid running hooks when tangling. | |||||
(let ((prog-mode-hook nil)) | |||||
(byte-compile-file (concat user-emacs-directory "init.el"))))) | |||||
(defun leo/find-user-init-file () | |||||
"Edit the `~/.emacs.d/init.el' file." | |||||
(interactive) | |||||
(find-file "~/.emacs.d/init.el")) | |||||
(defun leo/tidy () | |||||
"Indent, untabify and unwhitespacify current buffer, or region if active." | |||||
(interactive) | |||||
(let ((beg (if (region-active-p) (region-beginning) (point-min))) | |||||
(end (if (region-active-p) (region-end) (point-max)))) | |||||
(let ((inhibit-message t)) | |||||
(indent-region beg end)) | |||||
(whitespace-cleanup) | |||||
(untabify beg (if (< end (point-max)) end (point-max))) | |||||
(if (region-active-p) (message "Indenting Region...Done") (message "Indenting File...Done")))) | |||||
(defun leo/comment-or-uncomment-region-or-line () | |||||
"Comment or uncomment the region or the current line if there's no active region." | |||||
(interactive) | |||||
(let (beg end) | |||||
(if (region-active-p) | |||||
(setq beg (region-beginning) end (region-end)) | |||||
(setq beg (line-beginning-position) end (line-end-position))) | |||||
(comment-or-uncomment-region beg end))) | |||||
(defun leo/duplicate-thing (comment) | |||||
"Duplicates the current line, or the region if active. If an argument (COMMENT) is given, the duplicated region will be commented out." | |||||
(interactive "P") | |||||
(save-excursion | |||||
(let ((start (if (region-active-p) (region-beginning) (point-at-bol))) | |||||
(end (if (region-active-p) (region-end) (point-at-eol)))) | |||||
(goto-char end) | |||||
(unless (region-active-p) | |||||
(newline)) | |||||
(insert (buffer-substring start end)) | |||||
(when comment (comment-region start end))))) | |||||
(defun leo/kill-this-buffer-unless-scratch () | |||||
"Works like `kill-this-buffer' unless the current buffer is the *scratch* buffer. In which case the buffer content is deleted and the buffer is buried." | |||||
(interactive) | |||||
(if (or (string= (buffer-name) "*dashboard*") (string= (buffer-name) "*scratch*")) | |||||
(progn | |||||
(bury-buffer (buffer-name)) | |||||
(switch-to-buffer (other-buffer))) | |||||
(kill-this-buffer))) | |||||
(defun leo/jump-to-symbol (&optional backwardp) | |||||
"Jumps to the next symbol near the point if such a symbol exists. If BACKWARDP is non-nil it jumps backward." | |||||
(let* ((point (point)) | |||||
(bounds (find-tag-default-bounds)) | |||||
(beg (car bounds)) (end (cdr bounds)) | |||||
(str (isearch-symbol-regexp (find-tag-default))) | |||||
(search (if backwardp 'search-backward-regexp | |||||
'search-forward-regexp))) | |||||
(goto-char (if backwardp beg end)) | |||||
(funcall search str nil t) | |||||
(cond ((<= beg (point) end) (goto-char point)) | |||||
(backwardp (forward-char (- point beg))) | |||||
(t (backward-char (- end point)))))) | |||||
(defun leo/jump-to-prev-symbol () | |||||
"Jumps to the previous occurrence of the symbol at point." | |||||
(interactive) | |||||
(leo/jump-to-symbol t)) | |||||
(defun leo/jump-to-next-symbol () | |||||
"Jumps to the next occurrence of the symbol at point." | |||||
(interactive) | |||||
(leo/jump-to-symbol)) | |||||
(defun leo/last-car (list) | |||||
"Return only the item in the last position of a list." | |||||
(car (last list)) | |||||
) | |||||
(defun leo/get-package-from-url (url) | |||||
"Accept a URL and return a stripped package name." | |||||
(let ((mode | |||||
(car | |||||
(split-string | |||||
(leo/last-car (split-string url "/" t)) | |||||
"\\." nil) | |||||
) | |||||
)) | |||||
(message mode)) | |||||
) | |||||
(provide 'custom-functions) |
@ -0,0 +1,60 @@ | |||||
;; -*- lexical-binding: t; -*- | |||||
;;; custom-init --- Provide custom basic init for emacs | |||||
(defvar backup-dir (expand-file-name "~/.emacs.d/backup/")) | |||||
(defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/")) | |||||
(cond ((member "PragmataPro Liga" (font-family-list)) | |||||
(set-face-attribute 'default nil :font "PragmataPro Liga-12"))) | |||||
(setq initial-scratch-message nil | |||||
backup-directory-alist (list (cons ".*" backup-dir)) | |||||
auto-save-list-file-prefix autosave-dir | |||||
auto-save-file-name-transforms `((".*" ,autosave-dir t))) | |||||
;; Turn off the menus, scrollbars, and toolbars | |||||
(menu-bar-mode 0) | |||||
(scroll-bar-mode 0) | |||||
(tool-bar-mode 0) | |||||
(horizontal-scroll-bar-mode 0) | |||||
;; Revert to file on disk if it changes | |||||
(global-auto-revert-mode t) | |||||
;; Highlight the current line | |||||
(global-hl-line-mode t) | |||||
;; Show the column number after the line number (i.e. 50:57) | |||||
(column-number-mode t) | |||||
;; C-c <left>|<right> to undo|redo window changes like adding buffers. | |||||
(winner-mode t) | |||||
;; Show matching paren | |||||
(show-paren-mode t) | |||||
;; Indent w/spaces only | |||||
(setq indent-tabs-mode nil) | |||||
;; Prevent stale elisp bytecode | |||||
(setq load-prefer-newer t) | |||||
;; Add newline on save | |||||
(setq require-final-newline t) | |||||
;; C-c to copy in Linux can be pasted in emacs | |||||
(setq select-enable-clipboard t) | |||||
;; after mouse selection can be pasted in emacs | |||||
(setq select-enable-primary t) | |||||
;; Paste at current point, not mouse location when "middle-clicking" | |||||
(setq mouse-yank-at-point t) | |||||
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |||||
;; Set auth source | |||||
;; (setq auth-sources '("~/.authinfo.gpg")) | |||||
(defalias 'yes-or-no-p 'y-or-n-p) | |||||
(setq browse-url-generic-program "brave" | |||||
browse-url-browser-function 'browse-url-generic) | |||||
(defun display-startup-echo-area-message () | |||||
"Display startup echo area message." | |||||
(message "Initialized in %s" (emacs-init-time))) | |||||
(provide 'custom-init) |
@ -0,0 +1,54 @@ | |||||
;; -*- lexical-binding: t; -*- | |||||
;;; custom-package-setup --- Provide setup for packages and use-package | |||||
;; Configure Melpa | |||||
;; Package management | |||||
;; set load-path manually | |||||
;; don't call package-initialize | |||||
(eval-and-compile | |||||
(setq load-prefer-newer t | |||||
package-user-dir "~/.emacs.d/elpa" | |||||
package--init-file-ensured t ; so it doesn't call package initialize | |||||
package-enable-at-startup nil) ; do not automatically load packages | |||||
(unless (file-directory-p package-user-dir) | |||||
(make-directory package-user-dir t))) | |||||
(setq use-package-verbose t | |||||
use-package-always-defer nil ;I'm not used to that | |||||
use-package-minimum-reported-time 0.01) | |||||
;; Initialize package management | |||||
(eval-when-compile ; when byte compiled skip this | |||||
(require 'package) | |||||
;; add aditional package archives | |||||
(setq package-archives | |||||
`(("gnu" . "https://elpa.gnu.org/packages/") | |||||
("melpa" . "https://melpa.org/packages/") | |||||
("org" . "https://orgmode.org/elpa/"))) | |||||
;; initialize packages and ensure that use-package is installed | |||||
(package-initialize) | |||||
(unless (package-installed-p 'use-package) | |||||
(package-refresh-contents) | |||||
(package-install 'use-package)) ; install if it's missing | |||||
(unless (package-installed-p 'diminish) | |||||
(package-refresh-contents) | |||||
(package-install 'diminish)) ; install if it's missing | |||||
(require 'use-package) | |||||
(require 'bind-key) | |||||
(require 'diminish) | |||||
(setq use-package-always-ensure t)) | |||||
(eval-and-compile | |||||
(require 'use-package) | |||||
(require 'bind-key) | |||||
(require 'diminish) | |||||
(bind-keys :prefix-map my-ctrl-x-b-map | |||||
:prefix "C-x b") | |||||
(bind-keys :prefix-map my-ctrl-x-ctrl-l-map | |||||
:prefix "C-x C-l")) | |||||
(provide 'custom-package-setup) |
@ -0,0 +1,462 @@ | |||||
;;; custom-packages --- Provide all the use-package declarations | |||||
;;; | |||||
;;; Commentary: | |||||
;;; | |||||
;;;;; See https://github.com/jwiegley/use-package for help | |||||
;;;;; USE PACKAGE help | |||||
;;;;; (use-package package-here | |||||
;;;;; :commands (cmd cmd-all cmd-etc) ;; List commands used to ":defer" the package | |||||
;;;;; :bind-keymap | |||||
;;;;; ("M-q" . package-here-keymap) ;; Setup an entire keymap using Prefix "M-q" | |||||
;;;;; :bind | |||||
;;;;; (("M-s" . cmd) ;; Available Globally | |||||
;;;;; :map here-mode-map | |||||
;;;;; ("C-t" . cmd-all) ;; Available only in "here-mode" | |||||
;;;;; ("C-e" . cmd-etc)) ;; Available only in "here-mode" | |||||
;;;;; :init | |||||
;;;;; (setq stuff t) ;; declar vars etc... | |||||
;;;;; :config | |||||
;;;;; (here-mode 1) ;; eval stuff here after the init | |||||
;;;;; | |||||
;;;;; (use-package ruby-mode | |||||
;;;;; :mode "\\.rb\\'" | |||||
;;;;; :interpreter "ruby" | |||||
;;;;; | |||||
;;;;; ;; OR when the package name isn't the same as the =mode= | |||||
;;;;; (use-package python | |||||
;;;;; :mode ("\\.py\\'" . python-mode) | |||||
;;;;; :interpreter ("python" . python-mode)) | |||||
;;;;; | |||||
;;;;; USE ":defer" when you aren't using either :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, :interpreter, or :hook | |||||
;;;;; (use-package deferred-package | |||||
;;;;; :defer t) | |||||
;;; | |||||
;;; Code: | |||||
;;; | |||||
;; https://github.com/jwiegley/use-package/blob/master/bind-key.el | |||||
(use-package bind-key | |||||
:ensure t | |||||
:bind | |||||
("C-<tab>" . leo/tidy) | |||||
("C-;" . leo/comment-or-uncomment-region-or-line) | |||||
("C-c e" . leo/find-user-init-file) | |||||
("M-q" . leo/kill-this-buffer-unless-scratch) | |||||
("C-c d" . leo/duplicate-thing) | |||||
("M-n" . leo/jump-to-next-symbol) | |||||
("M-p" . leo/jump-to-prev-symbol) | |||||
("M-u" . upcase-dwim) | |||||
("M-c" . capitalize-dwim) | |||||
("M-l" . downcase-dwim) | |||||
) | |||||
;; https://github.com/myrjola/diminish.el | |||||
(use-package diminish | |||||
:ensure t | |||||
:demand t) | |||||
;; https://github.com/winterTTr/ace-jump-mode | |||||
(use-package ace-jump-mode | |||||
:bind | |||||
(("C-c SPC" . just-one-space) | |||||
("M-SPC" . ace-jump-mode))) | |||||
;; https://github.com/abo-abo/ace-window | |||||
(use-package ace-window | |||||
:ensure t | |||||
:bind | |||||
([remap other-window] . ace-window) | |||||
:init | |||||
(setq aw-keys '(?a ?s ?h ?t ?g ?y ?n ?e ?o ?i))) | |||||
;; https://github.com/hlissner/emacs-doom-themes | |||||
(use-package doom-themes | |||||
:ensure t | |||||
:config | |||||
(load-theme 'doom-one t)) | |||||
;; https://github.com/belak/base16-emacs | |||||
(use-package base16-theme | |||||
:disabled | |||||
:ensure t | |||||
:config | |||||
(load-theme 'base16-onedark t)) | |||||
;; https://github.com/Malabarba/beacon | |||||
(use-package beacon | |||||
:diminish | |||||
:commands beacon-mode | |||||
:demand t | |||||
:init | |||||
(setq beacon-size 80)) | |||||
;; https://github.com/coldnew/linum-relative | |||||
(use-package linum-relative | |||||
:ensure t | |||||
:config | |||||
(linum-relative-mode)) | |||||
;; https://github.com/Fanael/rainbow-delimiters | |||||
(use-package rainbow-delimiters | |||||
:ensure t | |||||
:hook (prog-mode . rainbow-delimiters-mode)) | |||||
;; M-x all-the-icons-install-fonts | |||||
(use-package all-the-icons | |||||
:ensure t) | |||||
;; https://github.com/tarsius/minions | |||||
(use-package minions | |||||
:ensure t | |||||
:config | |||||
(minions-mode 1)) | |||||
(use-package doom-modeline | |||||
:ensure t | |||||
:after (all-the-icons minions) | |||||
:hook (after-init . doom-modeline-mode) | |||||
:init | |||||
(setq doom-modeline-height 40) | |||||
(setq doom-modeline-bar-width 6) | |||||
(setq doom-modeline-checker-simple-format nil) | |||||
(setq doom-modeline-minor-modes (featurep 'minions)) | |||||
) | |||||
(use-package dashboard | |||||
:ensure t | |||||
:preface | |||||
(defvar show-week-agenda-p) | |||||
:init | |||||
(setq dashboard-items '((recents . 6) | |||||
(bookmarks . 5) | |||||
;; (projects . 5) | |||||
(agenda . 5))) | |||||
(setq dashboard-center-content t) | |||||
(setq dashboard-banner-logo-title "Let's begin...") | |||||
(setq dashboard-startup-banner 1) | |||||
(setq dashboard-show-shortcuts t) | |||||
(setq show-week-agenda-p t) | |||||
(setq dashboard-org-agenda-categories '("work" "tasks")) | |||||
:config | |||||
(dashboard-setup-startup-hook)) | |||||
(use-package helm | |||||
:ensure t | |||||
:demand t | |||||
:bind | |||||
("M-x" . helm-M-x) | |||||
("C-c b" . helm-buffers-list) | |||||
("C-x C-f" . helm-find-files)) | |||||
;; https://github.com/emacsorphanage/helm-swoop | |||||
(use-package helm-swoop | |||||
:ensure t | |||||
:after (helm) | |||||
:bind | |||||
("C-s" . helm-swoop) | |||||
:config | |||||
;; If you prefer fuzzy matching | |||||
(setq helm-swoop-use-fuzzy-match t)) | |||||
;; https://github.com/syohex/emacs-helm-ag | |||||
(use-package helm-ag | |||||
:ensure t | |||||
:after (helm) | |||||
:bind | |||||
("C-c k" . helm-ag)) | |||||
;; https://github.com/magnars/expand-region.el | |||||
(use-package expand-region | |||||
:ensure t | |||||
:bind | |||||
("C-@" . er/expand-region) | |||||
("C-#" . er/contract-region)) | |||||
;; https://github.com/magnars/multiple-cursors.el | |||||
(use-package multiple-cursors | |||||
:ensure t | |||||
:bind | |||||
("C-}" . mc/mark-next-like-this) | |||||
("C-)" . mc/unmark-next-like-this) | |||||
("C-{" . mc/mark-previous-like-this) | |||||
("C-(" . mc/unmark-previous-like-this)) | |||||
;; https://github.com/joodland/bm | |||||
(use-package bm | |||||
:ensure t | |||||
:demand t | |||||
:bind (("C-x b b" . bm-toggle) | |||||
("C-x b n" . bm-next) | |||||
("C-x b p" . bm-previous)) | |||||
:commands (bm-repository-load | |||||
bm-repository-save | |||||
bm-buffer-save | |||||
bm-buffer-save-all | |||||
bm-buffer-restore) | |||||
:preface | |||||
(setq left-fringe-width 6) | |||||
(setq right-fringe-width 0) | |||||
(defface bm-face '((t nil)) "Specify face used to highlight the current line" :group 'bm) | |||||
(defface bm-fringe-face '((t (:background "DarkOrange1" :foreground "DarkOrange1"))) "Specify face used to highlight the fringe" :group 'bm) | |||||
(defface bm-fringe-persistent-face '((t (:background "DarkOrange1" :foreground "DarkOrange1"))) "Specify face used to highlight the fringe for persistant bookmarks" :group 'bm) | |||||
(defface bm-persistent-face '((t nil)) "Specify face used to highlight the current line for persistant bookmarks" :group 'bm) | |||||
(defface fringe '((t nil)) "Specify face used for the fringe" :group 'basic-faces :group 'frames) | |||||
:init | |||||
(setq bm-restore-repository-on-load t) | |||||
:config | |||||
(setq bm-cycle-all-buffers t) | |||||
(setq bm-repository-file (concat user-emacs-directory "bookmark-repo")) | |||||
(setq-default bm-buffer-persistence t) | |||||
(setq bm-highlight-style 'bm-highlight-only-fringe) | |||||
(add-hook 'after-init-hook 'bm-repository-load) | |||||
(add-hook 'find-file-hooks 'bm-buffer-restore) | |||||
(add-hook 'after-revert-hook #'bm-buffer-restore) | |||||
(add-hook 'kill-buffer-hook #'bm-buffer-save) | |||||
(add-hook 'after-save-hook #'bm-buffer-save) | |||||
(add-hook 'vc-before-checkin-hook #'bm-buffer-save) | |||||
(add-hook 'kill-emacs-hook #'(lambda nil | |||||
(bm-buffer-save-all) | |||||
(bm-repository-save)))) | |||||
;; link | |||||
(use-package elfeed | |||||
:ensure t | |||||
:commands (elfeed) | |||||
:bind ("C-x C-l e" . elfeed) | |||||
:init | |||||
(setq elfeed-feeds | |||||
'( | |||||
("http://telescoper.wordpress.com/feed/" daily) | |||||
("http://xkcd.com/rss.xml" daily) | |||||
("http://timharford.com/feed/" daily) | |||||
("http://understandinguncertainty.org/rss.xml" daily) | |||||
("http://pragmaticemacs.com/feed/" emacs) | |||||
("http://www.reddit.com/r/emacs/.rss" emacs) | |||||
("http://planet.emacsen.org/atom.xml" emacs) | |||||
("http://feeds.feedburner.com/XahsEmacsBlog" emacs) | |||||
("http://emacs.stackexchange.com/feeds" emacs) | |||||
))) | |||||
;; https://github.com/rmuslimov/browse-at-remote | |||||
(use-package browse-at-remote | |||||
:bind ("C-c B" . browse-at-remote)) | |||||
;; https://github.com/justbur/emacs-which-key | |||||
(use-package which-key | |||||
:ensure t | |||||
:config | |||||
(which-key-setup-minibuffer) | |||||
(which-key-mode)) | |||||
;; https://github.com/lewang/fic-mode | |||||
(use-package fic-mode | |||||
:ensure t | |||||
:hook prog-mode | |||||
:init | |||||
(defface fic-face '((t :foreground "red" :weight bold)) "Specify face used for fic-mode highlighting" :group 'basic-faces) | |||||
(defface fic-author-face '((t :foreground "red" :underline t)) "Specify face used for fic-mode highlighting" :group 'basic-faces) | |||||
) | |||||
;; https://github.com/joaotavora/yasnippet | |||||
(use-package yasnippet | |||||
:ensure t | |||||
:commands (yas-reload-all) | |||||
:hook (prog-mode . yas-minor-mode) | |||||
:init | |||||
(setq yas-snippet-dirs (list (concat user-emacs-directory "snippets"))) | |||||
:config | |||||
(yas-reload-all)) | |||||
;; https://company-mode.github.io/ | |||||
(use-package company | |||||
:ensure t | |||||
:defer 5 | |||||
:commands (company-mode) | |||||
:hook (prog-mode . company-mode)) | |||||
;; https://github.com/pashky/restclient.el | |||||
(use-package restclient | |||||
:ensure t | |||||
:mode ("\\.rest\\'" . restclient-mode)) | |||||
;; https://github.com/iquiw/company-restclient | |||||
(use-package company-restclient | |||||
:ensure t | |||||
:after (company restclient)) | |||||
;; https://github.com/magit/magit | |||||
(use-package magit | |||||
:commands magit-status | |||||
:ensure t | |||||
:init | |||||
(setq magit-completing-read-function 'helm-completing-read-default-handler) | |||||
:bind | |||||
("C-x g" . magit-status) | |||||
("C-c g" . magit-status)) | |||||
;; https://github.com/bbatsov/projectile | |||||
(use-package projectile | |||||
:ensure t | |||||
:bind-keymap | |||||
("C-c p" . projectile-command-map) | |||||
) | |||||
;; https://github.com/magit/git-modes | |||||
(use-package gitignore-mode | |||||
:ensure t) | |||||
;; https://github.com/magit/git-modes | |||||
(use-package gitconfig-mode | |||||
:ensure t) | |||||
;; http://web-mode.org/ | |||||
(use-package web-mode | |||||
:ensure t | |||||
:mode "\\.html?\\'") | |||||
;; https://github.com/joshwnj/json-mode | |||||
(use-package json-mode | |||||
:ensure t | |||||
:mode "\\.json\\'") | |||||
;; https://github.com/antonj/scss-mode | |||||
(use-package scss-mode | |||||
:ensure t | |||||
:mode ("\\.s?css\\'" . scss-mode)) | |||||
;; https://elpa.gnu.org/packages/csv-mode.html | |||||
(use-package csv-mode | |||||
:disabled | |||||
:ensure t | |||||
:mode ("\\.csv\\'" . csv-mode)) | |||||
;; https://github.com/kwrooijen/cargo.el | |||||
(use-package cargo | |||||
:hook (rust-mode . cargo-minor-mode)) | |||||
;; https://github.com/andre-r/centered-cursor-mode.el | |||||
(use-package centered-cursor-mode | |||||
:disabled | |||||
:commands centered-cursor-mode | |||||
:hook prog-mode) | |||||
;; https://github.com/flycheck/flycheck | |||||
(use-package flycheck | |||||
:ensure t | |||||
:init (global-flycheck-mode)) | |||||
;; https://orgmode.org/elpa.html | |||||
(use-package org | |||||
:commands (org-cycle-agenda-files org-capture) | |||||
:ensure org-plus-contrib | |||||
:mode ("\\.org\\'" . org-mode) | |||||
:bind ( | |||||
("C-," . org-cycle-agenda-files) | |||||
("C-c C-d" . org-capture) | |||||
:map org-mode-map | |||||
("M-RET" . org-insert-todo-heading) | |||||
) | |||||
:preface | |||||
(defvar org-html-validation-link) | |||||
(defvar org-html-text-markup-alist) | |||||
:init | |||||
(setq org-agenda-files '("~/Dropbox/Org/todo.org" | |||||
"~/Dropbox/Org/archive.org" | |||||
"~/Dropbox/Org/diary/eaglecrk.org")) | |||||
(setq org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)") | |||||
(sequence "BUG(b)" "INPROGRESS(i)" "|" "FIXED(f)") | |||||
(sequence "TEST(T)" "NOTEST(N)" "|" "COMPLETE(C)") | |||||
(sequence "|" "CANCELED(c)") | |||||
(sequence "|" "NEEDCLARIFICATION(n)") | |||||
(sequence "|" "PROVIDEUPDATE(p)") | |||||
(sequence "|" "WAITING(w)")) | |||||
org-refile-targets '((nil :maxlevel . 3) | |||||
(org-agenda-files :maxlevel . 3)) | |||||
org-directory "~/Dropbox/Org" | |||||
org-default-notes-file (concat org-directory "/todo.org") | |||||
org-startup-folded t | |||||
org-startup-indented t | |||||
org-startup-align-all-tables t | |||||
org-startup-with-inline-images t | |||||
org-startup-with-latex-preview t | |||||
org-src-tab-acts-natively t | |||||
org-confirm-babel-evaluate nil | |||||
org-log-done t | |||||
org-log-done-with-time t | |||||
org-log-into-drawer t | |||||
org-hide-leading-stars t | |||||
org-pretty-entities t | |||||
org-use-property-inheritance t | |||||
org-html-validation-link nil | |||||
org-html-text-markup-alist '((bold . "<b>%s</b>") | |||||
(code . "<code>%s</code>") | |||||
(italic . "<i>%s</i>") | |||||
(strike-through . "<del>%s</del>") | |||||
(underline . "<span class=\"underline\">%s</span>") | |||||
(verbatim . "<code class=\"verbatim\">%s</code>")) | |||||
) | |||||
:config | |||||
(org-babel-do-load-languages 'org-babel-load-languages '((js . t) | |||||
(shell . t) | |||||
(emacs-lisp . t))) | |||||
(add-to-list 'org-structure-template-alist | |||||
(list "e" (concat "#+BEGIN_SRC emacs-lisp :results silent\n" | |||||
"\n" | |||||
"#+END_SRC"))) | |||||
(add-to-list 'org-structure-template-alist | |||||
(list "j" (concat "#+BEGIN_SRC js :cmd \"/usr/local/bin/babel-node\" :results output code\n" | |||||
"\n" | |||||
"#+END_SRC"))) | |||||
(add-to-list 'org-structure-template-alist | |||||
(list "r" (concat "#+BEGIN_SRC restclient :results raw\n" | |||||
"\n" | |||||
"#+END_SRC"))) | |||||
) | |||||
;; https://github.com/sabof/org-bullets | |||||
(use-package org-bullets | |||||
:ensure t | |||||
:after (org) | |||||
:hook (org-mode . org-bullets-mode) | |||||
:config | |||||
(set-face-attribute 'org-level-1 nil :height 1.3) | |||||
(set-face-attribute 'org-level-2 nil :height 1.1) | |||||
(set-face-attribute 'org-level-3 nil :height 1.05) | |||||
(set-face-attribute 'org-level-4 nil :height 1.05) | |||||
(set-face-attribute 'org-scheduled-today nil :height 1.0) | |||||
(set-face-attribute 'org-agenda-date-today nil :height 1.1)) | |||||
;; https://orgmode.org/worg/org-contrib/org-protocol.html | |||||
(use-package org-protocol | |||||
:ensure org-plus-contrib | |||||
:after (org) | |||||
:preface | |||||
(defvar org-capture-templates) | |||||
:init | |||||
(setq org-capture-templates | |||||
'(("t" "new task" entry (file+headline "~/Dropbox/Org/todo.org" "Tasks") | |||||
"* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n") | |||||
("n" "new note" entry (file+headline org-default-notes-file "Notes") | |||||
"* %?\n%i\n") | |||||
("l" "store link" entry (file+olp org-default-notes-file "Links" "Unfiled") | |||||
"* %a\n%?\n") | |||||
("d" "store link w/drawer" entry (file+olp org-default-notes-file "Links" "Unfiled") | |||||
"* %?\n%l\n:COPIED_TEXT:\n %i\n:END:\n") | |||||
("f" "dotfile" entry (file+headline "~/Dropbox/Org/dotfiles.org" "Other") | |||||
"* %?\n:PROPERTIES:\n:CUSTOM_ID: %(org-id-get-create)\n:END:\n") | |||||
)) | |||||
) | |||||
;; https://github.com/seanohalpin/org-link-minor-mode | |||||
(use-package org-link-minor-mode | |||||
:ensure t | |||||
:defer t | |||||
:commands (org-link-minor-mode)) | |||||
(provide 'custom-packages) | |||||
;;; custom-packages.el ends here |