Created
August 16, 2018 23:05
-
-
Save codygman/7b41f511547c47cb2a94d33f528c47d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Package configs | |
(require 'package) | |
(setq package-enable-at-startup nil) | |
(setq package-archives '(("org" . "http://orgmode.org/elpa/") | |
("gnu" . "http://elpa.gnu.org/packages/") | |
("melpa" . "https://melpa.org/packages/"))) | |
(package-initialize) | |
;; Bootstrap `use-package` | |
(unless (package-installed-p 'use-package) | |
(package-refresh-contents) | |
(package-install 'use-package)) | |
(require 'use-package) | |
(defun find-dotfile () | |
"Edit the `dotfile', in the current window." | |
(interactive) | |
(find-file-existing (concat user-emacs-directory "init.el"))) | |
;; PATH | |
(let ((path (shell-command-to-string ". ~/.bash_profile; echo -n $PATH"))) | |
(setenv "PATH" path) | |
(setq exec-path | |
(append | |
(split-string-and-unquote path ":") | |
exec-path))) | |
;; Some term enhancement | |
(defadvice term-sentinel (around my-advice-term-sentinel (proc msg)) | |
(if (memq (process-status proc) '(signal exit)) | |
(let ((buffer (process-buffer proc))) | |
ad-do-it | |
(kill-buffer buffer)) | |
ad-do-it)) | |
(ad-activate 'term-sentinel) | |
(defadvice ansi-term (before force-bash) | |
(interactive (list "/bin/zsh"))) | |
(ad-activate 'ansi-term) | |
;; Other configs | |
(setq make-backup-files nil) | |
(setq auto-save-default nil) | |
;; Splash Screen | |
(setq inhibit-startup-screen t) | |
(setq initial-scratch-message ";; Happy Hacking") | |
;; Show matching parens | |
(setq show-paren-delay 0) | |
(show-paren-mode 1) | |
;; Keybinding for term mode | |
(add-hook 'term-mode | |
(lambda () (global-set-key (kbd "s-v") 'term-paste))) | |
(defvar my/org-habit-show-graphs-everywhere nil | |
"If non-nil, show habit graphs in all types of agenda buffers. | |
Normally, habits display consistency graphs only in | |
\"agenda\"-type agenda buffers, not in other types of agenda | |
buffers. Set this variable to any non-nil variable to show | |
consistency graphs in all Org mode agendas. | |
https://emacs.stackexchange.com/a/17328/16972 | |
") | |
(defun my/org-agenda-mark-habits () | |
"Mark all habits in current agenda for graph display. | |
This function enforces `my/org-habit-show-graphs-everywhere' by | |
marking all habits in the current agenda as such. When run just | |
before `org-agenda-finalize' (such as by advice; unfortunately, | |
`org-agenda-finalize-hook' is run too late), this has the effect | |
of displaying consistency graphs for these habits. | |
When `my/org-habit-show-graphs-everywhere' is nil, this function | |
has no effect. | |
https://emacs.stackexchange.com/a/17328/16972 | |
" | |
(when (and my/org-habit-show-graphs-everywhere | |
(not (get-text-property (point) 'org-series))) | |
(let ((cursor (point)) | |
item data) | |
(while (setq cursor (next-single-property-change cursor 'org-marker)) | |
(setq item (get-text-property cursor 'org-marker)) | |
(when (and item (org-is-habit-p item)) | |
(with-current-buffer (marker-buffer item) | |
(setq data (org-habit-parse-todo item))) | |
(put-text-property cursor | |
(next-single-property-change cursor 'org-marker) | |
'org-habit-p data)))))) | |
(setq my/org-habit-show-graphs-everywhere t) | |
(setq org-habit-show-habits-only-for-today nil) | |
(setq alert-default-style 'osx-notifier) | |
(with-eval-after-load "ob-restclient" | |
(defun restclient-http-parse-current-and-do (func &rest args) | |
(save-excursion | |
(goto-char (restclient-current-min)) | |
(when (re-search-forward restclient-method-url-regexp (point-max) t) | |
(let ((method (match-string-no-properties 1)) | |
(url (match-string-no-properties 2)) | |
(vars (restclient-find-vars-before-point)) | |
(headers '())) | |
(forward-line) | |
(while (cond | |
((and (looking-at restclient-header-regexp) (not (looking-at restclient-empty-line-regexp))) | |
(setq headers (cons (restclient-replace-all-in-header vars (restclient-make-header)) headers))) | |
((looking-at restclient-use-var-regexp) | |
(setq headers (append headers (restclient-parse-headers (restclient-replace-all-in-string vars (match-string 1))))))) | |
(forward-line)) | |
(when (looking-at restclient-empty-line-regexp) | |
(forward-line)) | |
(let* ((cmax (restclient-current-max)) | |
(entity (restclient-parse-body (buffer-substring (min (point) cmax) cmax) vars)) | |
(url (restclient-replace-all-in-string vars (string-trim url)))) | |
(apply func method url headers entity args)))))) | |
) | |
(with-eval-after-load "haskell-mode" | |
(defun haskell-mode-stylish-buffer () | |
"Apply stylish-haskell to the current buffer. | |
Use `haskell-mode-stylish-haskell-path' to know where to find | |
stylish-haskell executable. This function tries to preserve | |
cursor position and markers by using | |
`haskell-mode-buffer-apply-command'." | |
(interactive) | |
(haskell-mode-buffer-apply-command haskell-mode-stylish-haskell-path haskell-mode-stylish-haskell-arguments)) | |
(defun haskell-mode-buffer-apply-command (cmd args) | |
"Execute shell command CMD with current buffer as input and output. | |
Use buffer as input and replace the whole buffer with the | |
output. If CMD fails the buffer remains unchanged." | |
(set-buffer-modified-p t) | |
(let* ((out-file (make-temp-file "stylish-output")) | |
(err-file (make-temp-file "stylish-error"))) | |
(unwind-protect | |
(let* ((_errcode | |
(call-process-region (point-min) (point-max) cmd haskell-mode-stylish-haskell-arguments | |
`((:file ,out-file) ,err-file) | |
nil)) | |
(err-file-empty-p | |
(equal 0 (nth 7 (file-attributes err-file)))) | |
(out-file-empty-p | |
(equal 0 (nth 7 (file-attributes out-file))))) | |
(if err-file-empty-p | |
(if out-file-empty-p | |
(message "Error: %s produced no output and no error information, leaving buffer alone" cmd) | |
;; Command successful, insert file with replacement to preserve | |
;; markers. | |
(insert-file-contents out-file nil nil nil t)) | |
(progn | |
;; non-null stderr, command must have failed | |
(with-current-buffer | |
(get-buffer-create "*haskell-mode*") | |
(insert-file-contents err-file) | |
(buffer-string)) | |
(message "Error: %s ended with errors, leaving buffer alone, see *haskell-mode* buffer for stderr" cmd) | |
(with-temp-buffer | |
(insert-file-contents err-file) | |
;; use (warning-minimum-level :debug) to see this | |
(display-warning cmd | |
(buffer-substring-no-properties (point-min) (point-max)) | |
:debug))))) | |
(ignore-errors | |
(delete-file err-file)) | |
(ignore-errors | |
(delete-file out-file)))))) | |
(fset 'yes-or-no-p 'y-or-n-p) | |
(with-eval-after-load 'org | |
(setq org-agenda-files '("/Users/codygoodman/org")) | |
(setq org-html-validation-link nil) | |
(setq org-use-fast-todo-selection t) | |
;; use *all tags* in *all agenda files* instead of just that buffers | |
(setq org-complete-tags-always-offer-all-agenda-tags t) | |
(setq org-todo-keywords | |
'((sequence "TODO(t)" "IN-PROGRESS(i)" "WAITING(w@/!)" "SOMEDAY(s)" "DELEGATED(x@!)" "|" "DONE(d)" "CANCELLED(c@/!)"))) | |
(setq org-agenda-custom-commands | |
'(("c" "Simple agenda view" | |
( | |
(tags-todo "keystone+STYLE=\"habit\"&SCHEDULED<=\"<tomorrow>\"" | |
((org-agenda-overriding-header "Keystone Habits") | |
(org-agenda-sorting-strategy | |
'(priority-down time-down todo-state-down | |
effort-up category-keep)))) | |
(tags-todo "PRIORITY=\"A\"&SCHEDULED<=\"<+2d>\"&-STYLE=\"habit\"" | |
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) | |
(org-agenda-overriding-header "High-priority unfinished tasks scheduled +2d:"))) | |
(tags-todo "today+LEVEL<3" | |
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) | |
(org-agenda-overriding-header "Tasks marked to be done today:"))) | |
(agenda "" ((org-agenda-start-with-log-mode '(closed clock state)) | |
(org-agenda-span 'day) | |
)) | |
;; removed because things stopped loading :S | |
(alltodo "" | |
((org-agenda-skip-function | |
'(or (air-org-skip-subtree-if-priority ?A) | |
(org-agenda-skip-if nil '(scheduled deadline)))))) | |
)) | |
("h" "habits agenda view" | |
( | |
(tags-todo "keystone+STYLE=\"habit\"" | |
((org-agenda-overriding-header "Keystone Habits") | |
(org-agenda-sorting-strategy | |
'(priority-down time-down todo-state-down | |
effort-up category-keep)))) | |
(tags-todo "STYLE=\"habit\"&SCHEDULED<=\"<tomorrow>\"" | |
((org-agenda-overriding-header "All Habits (today)") | |
(org-agenda-sorting-strategy | |
'(priority-down time-down todo-state-down | |
effort-up category-keep)))) | |
(tags-todo "STYLE=\"habit\"" | |
((org-agenda-overriding-header "All Habits)") | |
(org-agenda-sorting-strategy | |
'(priority-down time-down todo-state-down | |
effort-up category-keep)))) | |
)) | |
("r" "refiling view" | |
( | |
(tags-todo "refile" | |
((org-agenda-overriding-header "All Refile") | |
(org-agenda-sorting-strategy | |
'(priority-down time-down todo-state-down | |
effort-up category-keep)))) | |
;; NOTE wait we can't do recent refile unless we store date on everything | |
;; when capturing. This will be possible after we store CREATED date prop | |
;; (tags-todo "refile+CREATED<=\"<-2w>\"" | |
;; ((org-agenda-overriding-header "Recent Refile") | |
;; (org-agenda-sorting-strategy | |
;; '(priority-down time-down todo-state-down | |
;; effort-up category-keep)))) | |
;; (tags-todo "STYLE=\"habit\"&SCHEDULED<=\"<tomorrow>\"" | |
;; ((org-agenda-overriding-header "All Habits") | |
;; (org-agenda-sorting-strategy | |
;; '(priority-down time-down todo-state-down | |
;; effort-up category-keep)))) | |
)) | |
)) | |
(setq org-modules (add-to-list 'org-modules 'org-habit)) | |
(org-babel-do-load-languages | |
'org-babel-load-languages | |
'( | |
(haskell . t) | |
;(dot . t) | |
(shell . t) | |
(restclient . t) | |
)) | |
(setq org-confirm-babel-evaluate nil) | |
(setq org-babel-default-header-args:sh | |
'((:prologue . "exec 2>&1") (:epilogue . ":")) | |
) | |
(setq org-babel-default-header-args:shell | |
'((:prologue . "exec 2>&1") (:epilogue . ":")) | |
) | |
;; todo set these back to ~/ after I vet the new vanilla emacs install | |
(setq org-capture-templates | |
(quote (("t" "Todo") | |
("tt" "todo" entry (file+headline "/users/codygoodman/org/misc.org" "Misc") | |
"* TODO %? | |
:PROPERTIES: | |
:CREATED: %U | |
:END: | |
%U | |
%a | |
" :prepend t) | |
("tc" "Clubhouse Issue Todo" entry (file+headline "/users/codygoodman/org/someday.org" "Clubhouse") | |
"* TODO %? :clubhouse:%^G | |
%U | |
%a | |
" :prepend t) | |
("tp" "High Priority Todo" entry (file+headline "/users/codygoodman/org/priority.org" "Priority") | |
"* TODO [#A] %? :urgent:highPriority:%^G | |
%U | |
%a | |
" :prepend t) | |
("tT" "todo w/date" entry (file+headline "/users/codygoodman/org/misc.org" "Misc") | |
"* TODO %<%Y%m%d> %? | |
%U | |
%a | |
" :prepend t) | |
("tu" "urgent todo" entry (file+headline "/users/codygoodman/org/priority.org" "Priority") | |
"* TODO [#A] %? :urgent:highPriority: | |
%U | |
%a | |
" :prepend t :clock-in t) | |
("i" "infra") | |
("is" "Infrastructure Stability" entry (file+headline "/users/codygoodman/org/misc.org" "Infrastructure") | |
"* TODO %? :infrastructure:stability: | |
:PROPERTIES: | |
:CREATED: %U | |
:END: | |
" :prepend t :clock-in t) | |
("s" "Standup/Ceremonies") | |
("sc" "Company Standup" entry (file+headline "/users/codygoodman/org/misc.org" "Daily") | |
"* TODO %<%Y%m%d> standup :standup:company:%<%Y%m%d>: | |
%U | |
%?" :prepend t :clock-in t) | |
("se" "Engineering Standup" entry (file+headline "/users/codygoodman/org/misc.org" "Daily") | |
"* TODO %<%Y%m%d> engineering standup :standup:engineering:%<%Y%m%d>: | |
%U | |
%?" :prepend t :clock-in t) | |
("sp" "Sprint Planning" entry (file+headline "/users/codygoodman/org/misc.org" "Ceremonies") | |
"* TODO %<%Y%m%d> sprint planning :ceremony:sprintPlanning:%<%Y%m%d>: | |
%U | |
%?" :prepend t :clock-in t) | |
("sr" "Retrospective" entry (file+headline "/users/codygoodman/org/misc.org" "Ceremonies") | |
"* TODO %<%Y%m%d> retro :ceremony:retro:%<%Y%m%d>: | |
%U | |
%?" :prepend t :clock-in t) | |
("w" "workflow") | |
("wt" "Team Workflow Improvements Todo" entry (file+headline "/users/codygoodman/org/misc.org" "Team Workflow Improvements") | |
"* TODO %? :teamWorkflow:efficiency:team:workflow:%^G | |
%U | |
%a | |
" :prepend t) | |
("wm" "My Workflow Improvements Todo" entry (file+headline "/users/codygoodman/org/misc.org" "My Workflow Improvements") | |
"* TODO %? :my:workflow:efficiency:workflow:%^G | |
%U | |
%a | |
" :prepend t) | |
("o" "Meta org") | |
("oe" "Org Efficiency Todo" entry (file+headline "/users/codygoodman/org/misc.org" "My Workflow Improvements") | |
"* TODO %? :org:efficiency:orgEfficiency:workflow:%^G | |
:PROPERTIES: | |
:CREATED: %U | |
:END: | |
%U | |
%a | |
" :prepend t) | |
("r" "Reading") | |
("ra" "Article to read" entry (file+headline "/users/codygoodman/org/misc.org" "Reading List") | |
"* TODO %? :article:read:%^G | |
%U | |
%?" :prepend t) | |
("rh" "Haskell article to read" entry (file+headline "/users/codygoodman/org/misc.org" "Haskell Reading List") | |
"* TODO %? :article:read:haskell:%^G | |
%U | |
%?" :prepend t) | |
))) | |
;; resume clocks after closing emacs | |
(setq org-clock-persist t) | |
(org-clock-persistence-insinuate) | |
(setq org-log-into-drawer t) | |
;; use a depth level of 6 max | |
(setq org-refile-targets | |
'((org-agenda-files . (:maxlevel . 4)))) | |
;; TODO install ob-mongo stuff | |
;; (setq ob-mongo:default-port 27018) | |
;; (setq ob-mongo:default-db "itprotv_local") | |
;; setup org EasyTemplates | |
(with-eval-after-load 'org | |
(add-to-list 'org-structure-template-alist | |
'("E" "#+BEGIN_SRC elisp\n ?\n#+END_SRC ")) | |
(add-to-list 'org-structure-template-alist | |
'("s" "#+BEGIN_SRC shell :results verbatim\n ?\n#+END_SRC ")) | |
(add-to-list 'org-structure-template-alist | |
'("S" "#+BEGIN_SRC ?\n\n#+END_SRC ")) | |
(add-to-list 'org-structure-template-alist | |
'("m" "#+BEGIN_SRC mongo\n ?\n#+END_SRC ")) | |
(add-to-list 'org-structure-template-alist | |
'("j" "#+BEGIN_SRC json\n ?\n#+END_SRC ")) | |
(add-to-list 'org-structure-template-alist | |
'("h" "#+BEGIN_SRC haskell\n ?\n#+END_SRC ")) | |
;; org archiving advise to preserve structure | |
(defadvice org-archive-subtree (around fix-hierarchy activate) | |
(let* ((fix-archive-p (and (not current-prefix-arg) | |
(not (use-region-p)))) | |
(afile (org-extract-archive-file (org-get-local-archive-location))) | |
(buffer (or (find-buffer-visiting afile) (find-file-noselect afile)))) | |
ad-do-it | |
(when fix-archive-p | |
(with-current-buffer buffer | |
(goto-char (point-max)) | |
(while (org-up-heading-safe)) | |
(let* ((olpath (org-entry-get (point) "ARCHIVE_OLPATH")) | |
(path (and olpath (split-string olpath "/"))) | |
(level 1) | |
tree-text) | |
(when olpath | |
(org-mark-subtree) | |
(setq tree-text (buffer-substring (region-beginning) (region-end))) | |
(let (this-command) (org-cut-subtree)) | |
(goto-char (point-min)) | |
(save-restriction | |
(widen) | |
(-each path | |
(lambda (heading) | |
(if (re-search-forward | |
(rx-to-string | |
`(: bol (repeat ,level "*") (1+ " ") ,heading)) nil t) | |
(org-narrow-to-subtree) | |
(goto-char (point-max)) | |
(unless (looking-at "^") | |
(insert "\n")) | |
(insert (make-string level ?*) | |
" " | |
heading | |
"\n")) | |
(cl-incf level))) | |
(widen) | |
(org-end-of-subtree t t) | |
(org-paste-subtree level tree-text)))))))) | |
) | |
;; org columns | |
;; %10Time_Spent{:} | |
;; (setq org-columns-default-format "%25ITEM %TODO %3PRIORITY %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T %TAGS") | |
(setq org-columns-default-format "%75ITEM %CLOCKSUM %TODO %TAGS") | |
;; org reveal settings | |
(setq Org-Reveal-root "/Users/codygoodman/Downloads/reveal.js-3.6.0/js/reveal.js") | |
(setq Org-Reveal-title-slide nil) | |
;; end org stuff | |
) | |
;; allow copying both to buffer in ediff | |
(defun ediff-copy-both-to-C () | |
(interactive) | |
(ediff-copy-diff ediff-current-difference nil 'C nil | |
(concat | |
(ediff-get-region-contents ediff-current-difference 'A ediff-control-buffer) | |
(ediff-get-region-contents ediff-current-difference 'B ediff-control-buffer)))) | |
(defun add-d-to-ediff-mode-map () (define-key ediff-mode-map "d" 'ediff-copy-both-to-C)) | |
(add-hook 'ediff-keymap-setup-hook 'add-d-to-ediff-mode-map) | |
(with-eval-after-load 'org-habit | |
(advice-add #'org-agenda-finalize :before #'my/org-agenda-mark-habits) | |
) | |
;; TODO this might be a little faster? - spacemacs/toggle-fullscreen () | |
(defun spacemacs/toggle-frame-fullscreen-non-native () | |
"Toggle full screen non-natively. Uses the `fullboth' frame paramerter | |
rather than `fullscreen'. Useful to fullscreen on OSX w/o animations." | |
(interactive) | |
(modify-frame-parameters | |
nil | |
`((maximized | |
. ,(unless (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth)) | |
(frame-parameter nil 'fullscreen))) | |
(fullscreen | |
. ,(if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth)) | |
(if (eq (frame-parameter nil 'maximized) 'maximized) | |
'maximized) | |
'fullboth))))) | |
;; OrgMode Configs (put in eval-after-load block?) | |
(defun air-org-skip-subtree-if-priority (priority) | |
"Skip an agenda subtree if it has a priority of PRIORITY. | |
PRIORITY may be one of the characters ?A, ?B, or ?C." | |
(let ((subtree-end (save-excursion (org-end-of-subtree t))) | |
(pri-value (* 1000 (- org-lowest-priority priority))) | |
(pri-current (org-get-priority (thing-at-point 'line t)))) | |
(if (= pri-value pri-current) | |
subtree-end | |
nil))) | |
;(setq org-todo-keyword-faces | |
; '(("TODO" . "blue") | |
; ("WORKING" . "yellow") | |
; ("HOLD" . "red") | |
; ("DONE" . "green"))) | |
;; UI configurations | |
(scroll-bar-mode -1) | |
(tool-bar-mode -1) | |
(tooltip-mode -1) | |
(menu-bar-mode -1) | |
;(global-linum-mode 1) | |
;(add-to-list 'default-frame-alist '(font . "Iosevka-11")) | |
(add-to-list 'default-frame-alist '(height . 24)) | |
(add-to-list 'default-frame-alist '(width . 80)) | |
(set-face-attribute 'default nil | |
:family "Source Code Pro" | |
:height 130 | |
:weight 'normal | |
:width 'normal) | |
;; Vim mode | |
(use-package evil | |
:ensure t | |
:init | |
(setq evil-want-C-u-scroll t) ;; TODO this doesn't seem to work | |
:config | |
(evil-mode 1)) | |
;; (use-package evil-leader | |
;; :ensure t | |
;; :after evil | |
;; :init | |
;; :config | |
;; (global-evil-leader-mode)) | |
;; better than evil-org for navigating I think | |
(use-package org-evil :ensure t :after (evil org) | |
:config | |
(progn | |
(add-hook 'org-mode-hook 'org-evil-mode))) | |
;; found these custom org-agenda with general from https://gist.github.com/amirrajan/301e74dc844a4c9ffc3830dc4268f177 | |
(eval-after-load 'org-agenda | |
'(progn | |
(evil-set-initial-state 'org-agenda-mode 'normal) | |
(evil-define-key 'normal org-agenda-mode-map | |
(kbd "<RET>") 'org-agenda-switch-to | |
(kbd "\t") 'org-agenda-goto | |
"q" 'org-agenda-quit | |
"r" 'org-agenda-redo | |
"S" 'org-save-all-org-buffers | |
"gj" 'org-agenda-goto-date | |
"gJ" 'org-agenda-clock-goto | |
"gm" 'org-agenda-bulk-mark | |
"go" 'org-agenda-open-link | |
"s" 'org-agenda-schedule | |
"+" 'org-agenda-priority-up | |
"," 'org-agenda-priority | |
"-" 'org-agenda-priority-down | |
"y" 'org-agenda-todo-yesterday | |
"n" 'org-agenda-add-note | |
"t" 'org-agenda-todo | |
":" 'org-agenda-set-tags | |
";" 'org-timer-set-timer | |
"I" 'helm-org-task-file-headings | |
"i" 'org-agenda-clock-in | |
"O" 'org-agenda-clock-out | |
"u" 'org-agenda-bulk-unmark | |
"x" 'org-agenda-exit | |
"j" 'org-agenda-next-line | |
"k" 'org-agenda-previous-line | |
"vt" 'org-agenda-toggle-time-grid | |
"va" 'org-agenda-archives-mode | |
"vw" 'org-agenda-week-view | |
"vl" 'org-agenda-log-mode | |
"vd" 'org-agenda-day-view | |
"vc" 'org-agenda-show-clocking-issues | |
"g/" 'org-agenda-filter-by-tag | |
"o" 'delete-other-windows | |
"gh" 'org-agenda-holiday | |
"gv" 'org-agenda-view-mode-dispatch | |
"f" 'org-agenda-later | |
"b" 'org-agenda-earlier | |
"c" 'helm-org-capture-templates | |
"e" 'org-agenda-set-effort | |
"n" nil ; evil-search-next | |
"{" 'org-agenda-manipulate-query-add-re | |
"}" 'org-agenda-manipulate-query-subtract-re | |
"A" 'org-agenda-toggle-archive-tag | |
"." 'org-agenda-goto-today | |
"0" 'evil-digit-argument-or-evil-beginning-of-line | |
"<" 'org-agenda-filter-by-category | |
">" 'org-agenda-date-prompt | |
"F" 'org-agenda-follow-mode | |
"D" 'org-agenda-deadline | |
"H" 'org-agenda-holidays | |
"J" 'org-agenda-next-date-line | |
"K" 'org-agenda-previous-date-line | |
"L" 'org-agenda-recenter | |
"P" 'org-agenda-show-priority | |
"R" 'org-agenda-clockreport-mode | |
"Z" 'org-agenda-sunrise-sunset | |
"T" 'org-agenda-show-tags | |
"X" 'org-agenda-clock-cancel | |
"[" 'org-agenda-manipulate-query-add | |
"g\\" 'org-agenda-filter-by-tag-refine | |
"]" 'org-agenda-manipulate-query-subtract))) | |
;; NOTE this has some bugs | |
;; evil keybindings in org | |
;; (use-package evil-org | |
;; :ensure t | |
;; :after org | |
;; :config | |
;; (add-hook 'org-mode-hook 'evil-org-mode) | |
;; (add-hook 'evil-org-mode-hook | |
;; (lambda () | |
;; (evil-org-set-key-theme))) | |
;; (require 'evil-org-agenda) | |
;; (evil-org-agenda-set-keys)) | |
(use-package evil-escape | |
:ensure t | |
:init | |
(setq-default evil-escape-key-sequence "jk") | |
:config | |
(evil-escape-mode 1)) | |
;; Anzu for search matching | |
;; (use-package anzu | |
;; :ensure t | |
;; :config | |
;; (global-anzu-mode 1) | |
;; (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp) | |
;; (global-set-key [remap query-replace] 'anzu-query-replace)) | |
; Theme | |
(use-package doom-themes | |
:ensure t | |
:config | |
; (load-theme 'doom-one-light t) | |
; (load-theme 'doom-one-vibrant t) | |
;; (load-theme 'doom-solarized-light t) | |
) | |
(use-package org-bullets | |
:ensure t | |
:init | |
;; (setq org-bullets-bullet-list '("◉" "◎" "" "○" "►" "◇")) | |
:config | |
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) | |
(use-package orgit :defer t :ensure t) | |
;; (use-package spacemacs-theme :defer t :ensure t) | |
(use-package spacemacs-theme | |
:defer t | |
:init (load-theme 'spacemacs-dark t)) | |
;; Helm | |
(use-package helm | |
:ensure t | |
:init | |
(setq helm-M-x-fuzzy-match t | |
helm-mode-fuzzy-match t | |
helm-buffers-fuzzy-matching t | |
helm-recentf-fuzzy-match t | |
helm-locate-fuzzy-match t | |
helm-semantic-fuzzy-match t | |
helm-imenu-fuzzy-match t | |
helm-completion-in-region-fuzzy-match t | |
helm-candidate-number-list 80 | |
;; helm-split-window-in-side-p t | |
helm-move-to-line-cycle-in-source t | |
helm-echo-input-in-header-line t | |
helm-autoresize-max-height 0 | |
helm-autoresize-min-height 20 | |
helm-always-two-windows t | |
) | |
:config | |
(helm-mode 1) | |
:bind (:map helm-map | |
("<tab>" . helm-execute-persistent-action) | |
("C-h" . helm-find-files-up-one-level) | |
("<backtab>" . helm-find-files-up-one-level) | |
("C-z" . helm-select-action) | |
) | |
) | |
;; RipGrep | |
(use-package helm-rg :ensure t) | |
;; haskell | |
(use-package haskell-mode | |
:ensure t | |
:mode "\\.hs\\'" | |
:commands haskell-mode | |
:bind ("C-c C-s" . fix-imports) | |
:config | |
(custom-set-variables | |
'(haskell-ask-also-kill-buffers nil) | |
'(haskell-process-type (quote stack-ghci)) | |
'(haskell-interactive-popup-errors nil)) | |
(add-hook 'haskell-mode-hook 'haskell-indentation-mode) | |
(add-hook 'haskell-mode-hook 'interactive-haskell-mode) | |
(add-hook 'haskell-mode-hook 'flycheck-mode) | |
(add-hook 'haskell-mode-hook 'hindent-mode) | |
(add-hook 'haskell-mode-hook (lambda () | |
(add-hook 'before-save-hook 'haskell-mode-format-imports nil 'local))) | |
) | |
(use-package restclient :ensure t) | |
(use-package ob-restclient :ensure t :after org) | |
(use-package ob-async :ensure t :after org) | |
(use-package web-mode | |
:ensure t | |
:mode (("\\.js\\'" . web-mode) | |
("\\.jsx\\'" . web-mode) | |
("\\.ts\\'" . web-mode) | |
("\\.tsx\\'" . web-mode) | |
("\\.html\\'" . web-mode) | |
("\\.vue\\'" . web-mode) | |
("\\.json\\'" . web-mode)) | |
:interpreter ("node" . web-mode) | |
:commands web-mode | |
:config | |
(setq-default web-mode-code-indent-offset 2) | |
(setq-default web-mode-markup-indent-offset 2) | |
(setq-default web-mode-enable-auto-pairing nil) | |
(setq-default web-mode-enable-auto-indentation nil) | |
(setq-default web-mode-enable-auto-quoting nil) | |
(add-hook 'web-mode-hook | |
(lambda () | |
(when | |
(or | |
(string-equal "jsx" (file-name-extension buffer-file-name)) | |
(string-equal "js" (file-name-extension buffer-file-name))) | |
(if (flycheck-may-use-checcker 'javascript-eslint) | |
(progn | |
(my/use-eslint-from-node-modules) | |
(flycheck-select-checker 'javascript-eslint) | |
(flycheck-mode) | |
))))) | |
(add-hook 'web-mode-hook | |
(lambda () | |
(when | |
(string-equal "json" (file-name-extension buffer-file-name)) | |
(progn | |
(flycheck-select-checker 'web-mode-python-json) | |
(flycheck-mode) | |
)))) | |
(add-hook 'web-mode-hook | |
(lambda () | |
(when | |
(or | |
(string-equal "tsx" (file-name-extension buffer-file-name)) | |
(string-equal "ts" (file-name-extension buffer-file-name))) | |
(setup-tide-mode)))) | |
) | |
(defmacro after-evil (&rest body) | |
`(eval-after-load "evil" | |
(lambda () | |
,@body))) | |
(use-package magit :ensure t) | |
(use-package magit | |
:ensure t | |
:commands (magit-toplevel magit-status magit-blame magit-log) | |
:config | |
(after-evil | |
(evil-define-key 'normal magit-log-mode-map | |
(kbd "`") 'magit-process-buffer | |
(kbd "~") 'magit-diff-default-context | |
(kbd "0") 'evil-digit-argument-or-evil-beginning-of-line | |
(kbd "$") 'evil-end-of-line) | |
(evil-define-key 'normal magit-status-mode-map | |
(kbd "q") 'quit-window | |
(kbd "`") 'magit-process-buffer | |
(kbd "~") 'magit-diff-default-context | |
(kbd "0") 'evil-digit-argument-or-evil-beginning-of-line | |
(kbd "$") 'evil-end-of-line | |
(kbd "Q") 'delete-window) | |
(evil-define-key 'normal magit-repolist-mode-map | |
(kbd "q") 'quit-window | |
(kbd "Q") 'delete-window | |
(kbd "RET") 'magit-repolist-status | |
(kbd "gr") 'magit-list-repositories))) | |
(use-package evil-magit :ensure t :after magit) | |
;; Projectile | |
(use-package projectile | |
:ensure t | |
:init | |
(setq projectile-require-project-root nil) | |
:config | |
(projectile-mode 1)) | |
;; Helm Projectile | |
(use-package helm-projectile | |
:ensure t | |
:init | |
(setq helm-projectile-fuzzy-match t) | |
:config | |
(helm-projectile-on)) | |
;; All The Icons | |
(use-package all-the-icons :ensure t) | |
;; NeoTree | |
;;(use-package neotree | |
;; :ensure t | |
;; :init | |
;; (setq neo-theme (if (display-graphic-p) 'icons 'arrow))) | |
;; Which Key | |
(use-package which-key | |
:ensure t | |
:init | |
(setq which-key-separator " ") | |
(setq which-key-prefix-prefix "+") | |
:config | |
(which-key-mode)) | |
(use-package avy | |
:ensure t | |
:config | |
(avy-setup-default)) | |
(use-package helm-org-rifle | |
:ensure t | |
:after (helm org) | |
) | |
(defun spacemacs/helm-swoop-region-or-symbol () | |
"Call `helm-swoop' with default input." | |
(interactive) | |
(let ((helm-swoop-pre-input-function | |
(lambda () | |
(if (region-active-p) | |
(buffer-substring-no-properties (region-beginning) | |
(region-end)) | |
(let ((thing (thing-at-point 'symbol t))) | |
(if thing thing "")))))) | |
(call-interactively 'helm-swoop))) | |
;; our own implementation of kill-this-buffer from menu-bar.el | |
(defun spacemacs/kill-this-buffer (&optional arg) | |
"Kill the current buffer. | |
If the universal prefix argument is used then kill also the window." | |
(interactive "P") | |
(if (window-minibuffer-p) | |
(abort-recursive-edit) | |
(if (equal '(4) arg) | |
(kill-buffer-and-window) | |
(kill-buffer)))) | |
(defun my-switch-to-scratch-buffer () | |
(switch-to-buffer (get-buffer-create "*scratch*"))) | |
(defun my-org-insert-subheading (arg) | |
"Insert a new subheading and demote it. | |
Works for outline headings and for plain lists alike." | |
(interactive "P") | |
(evil-org-end-of-line) ;; go to end of line first | |
(org-insert-heading arg) | |
(cond | |
((org-at-heading-p) (org-do-demote)) | |
((org-at-item-p) (org-indent-item)))) | |
;; Custom keybinding | |
(use-package general | |
:ensure t | |
:config | |
(general-unbind 'org-agenda-mode-map | |
"SPC") | |
(general-create-definer my-leader-def | |
:prefix "SPC") | |
(my-leader-def | |
:states '(normal visual emacs motion) | |
:prefix "SPC" | |
:keymaps 'override | |
:non-normal-prefix "M-SPC" | |
"/" '(helm-projectile-rg :which-key "ripgrep") | |
"TAB" '(switch-to-prev-buffer :which-key "previous buffer") | |
"SPC" '(helm-M-x :which-key "M-x") | |
"TF" '(spacemacs/toggle-frame-fullscreen-non-native :which-key "Full Screen") | |
"pf" '(helm-projectile-find-file :which-key "find files") | |
"jj" '(avy-goto-char :which-key "Jump To Char") | |
"jl" '(avy-goto-line :which-key "Jump To line") | |
"pp" '(helm-projectile-switch-project :which-key "switch project") | |
"pb" '(helm-projectile-switch-to-buffer :which-key "switch buffer") | |
"pr" '(helm-show-kill-ring :which-key "show kill ring") | |
;; applications | |
"ad" '(dired :which-key "open dired") | |
"aoo" '(org-agenda :which-key "open org agenda") | |
"aoa" '(org-agenda-list :which-key "open org agenda list") | |
"aol" '(org-store-link :which-key "store org link") | |
"aorr" '(helm-org-rifle :which-key "helm org rfile") | |
;; rifle current buffer | |
;; rifle directories | |
;; rifle files | |
;; c | |
"Cc" '(org-capture :which-key "org-capture") | |
;; magit | |
"gs" '(magit-status :which-key "magit status") | |
;; help | |
"hdk" '(describe-key :which-key "describe key") | |
"hdm" '(describe-mode :which-mode "describe mode") | |
"hdv" '(describe-variable :which-key "describe variable") | |
"hdf" '(describe-function :which-key "describe function") | |
"hdd" '(helm-apropos :which-key "apropos at point") | |
;; Buffers | |
"bb" '(helm-mini :which-key "buffers list") | |
;; "bs" '(my-switch-to-scratch-buffer :which-key "scratch buffer") | |
;; "bs" '((switch-to-buffer "*scratch*") :which-key "scratch buffer") | |
"bd" '(spacemacs/kill-this-buffer :which-key "kill-this-buffer") | |
;; Search | |
"ss" '(helm-swoop :which-key "helm-swoop") | |
"sS" '(spacemacs/helm-swoop-region-or-symbol :which-key "helm-swoop-region-or-symbol") | |
;; Window | |
;; TODO install winum (https://github.com/deb0ch/emacs-winum) and use emacs keybindings | |
;; so I can navigate with SPC N | |
"wl" '(windmove-right :which-key "move right") | |
"wh" '(windmove-left :which-key "move left") | |
"wk" '(windmove-up :which-key "move up") | |
"wj" '(windmove-down :which-key "move bottom") | |
"w/" '(split-window-right :which-key "split right") | |
"0" '(winum-select-window-0 :which-key "window 0") | |
"1" '(winum-select-window-1 :which-key "window 1") | |
"2" '(winum-select-window-2 :which-key "window 2") | |
"3" '(winum-select-window-3 :which-key "window 3") | |
"4" '(winum-select-window-4 :which-key "window 4") | |
"5" '(winum-select-window-5 :which-key "window 5") | |
"6" '(winum-select-window-6 :which-key "window 6") | |
"7" '(winum-select-window-7 :which-key "window 7") | |
"8" '(winum-select-window-8 :which-key "window 8") | |
"9" '(winum-select-window-8 :which-key "window 9") | |
"w-" '(split-window-below :which-key "split bottom") | |
"wx" '(delete-window :which-key "delete window") | |
"qz" '(delete-frame :which-key "delete frame") | |
"qq" '(kill-emacs :which-key "quit") | |
;; NeoTree | |
"ft" '(neotree-toggle :which-key "toggle neotree") | |
;; find files | |
"ff" '(helm-find-files :which-key "find files") | |
;; Others | |
"at" '(ansi-term :which-key "open terminal") | |
"cl" '(comment-line :which-key "comment line") | |
"fed" '(find-dotfile :which-key "go to init.el") | |
;; global org | |
"aokj" '(org-clock-jump-to-current-clock :which-key "jump to current clock") | |
"aoki" '(org-clock-in-last :which-key "clock in last task") | |
) | |
(general-define-key | |
"M-x" 'helm-M-x) | |
(general-evil-define-key 'normal emacs-lisp-mode-map | |
:prefix "," | |
"ef" 'eval-defun :which-key "eval defun" | |
"eb" 'eval-buffer :which-key "eval buffer" | |
"er" 'eval-region :which-key "eval region" | |
) | |
(general-evil-define-key '(normal motion override) org-babel-map | |
:prefix "," | |
"," 'org-ctrl-c-ctrl-c :which-key "execute babel block") | |
(general-evil-define-key 'normal org-mode-map | |
"RET" 'org-open-at-point :which-key "org open at point") | |
(general-evil-define-key 'normal org-mode-map | |
:prefix "," | |
"Ci" 'org-clock-in :which-key "clock in" | |
"Co" 'org-clock-out :which-key "clock out" | |
"Cc" 'org-clock-cancel :which-key "clock cancel" | |
"TT" 'org-todo :which-key "org todo" | |
;; insert | |
"it" 'org-set-tags :which-key "org set tags" | |
"is" 'my-org-insert-subheading :which-key "org set tags" | |
"il" 'org-insert-link :which-key "org insert link" | |
"sh" 'org-promote-subtree :which-key "promote subtree-left" | |
"sj" 'org-move-subtree-down :which-key "subtree-down" | |
"sk" 'org-move-subtree-up :which-key "subtree-up" | |
"sl" 'org-demote-subtree :which-key "demote subtree-right" | |
"sn" 'org-narrow-to-subtree :which-key "org narrow" | |
"sN" 'widen :which-key "org widen" | |
"sb" 'org-tree-to-indirect-buffer :which-key "org tree to indirect buffer" | |
"#" 'org-update-statistics-cookies :which-key "org-update-statistics-cookies" | |
) | |
(general-evil-define-key '(normal override motion) org-agenda-mode-map | |
"d" 'org-agenda-day-view :which-key "day view" | |
"L" 'org-agenda-log-mode :which-key "org agenda log mode" | |
) | |
) | |
;; hl-line | |
;; (global-hl-line-mode +1) | |
;; (set-face-background 'hl-line "#efeae9") ;; TODO change this | |
;; Fancy titlebar for MacOS | |
;; (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) | |
;; (add-to-list 'default-frame-alist '(ns-appearance . dark)) | |
;; (setq ns-use-proxy-icon nil) | |
;; (setq frame-title-format nil) | |
;; Helm swoop | |
(use-package helm-swoop | |
:ensure t | |
:init | |
(setq helm-swoop-split-with-multiple-windows t | |
helm-swoop-split-direction 'split-window-vertically | |
helm-swoop-speed-or-color t | |
helm-swoop-split-window-function 'helm-default-display-buffer | |
helm-swoop-pre-input-function (lambda () ""))) | |
;; Flycheck | |
(use-package flycheck | |
:ensure t | |
:init (global-flycheck-mode)) | |
;; Winum | |
(use-package winum | |
:ensure t | |
:init (winum-mode)) | |
;; LSP | |
;;(use-package lsp-mode | |
;; :ensure t | |
;; :init | |
;; (add-hook 'prog-major-mode #'lsp-prog-major-mode-enable)) | |
;; | |
;;(use-package lsp-ui | |
;; :ensure t | |
;; :init | |
;; (add-hook 'lsp-mode-hook 'lsp-ui-mode)) | |
;; Company mode | |
(use-package company | |
:ensure t | |
:init | |
(setq company-minimum-prefix-length 3) | |
(setq company-auto-complete nil) | |
(setq company-idle-delay 0) | |
(setq company-require-match 'never) | |
(setq company-frontends | |
'(company-pseudo-tooltip-unless-just-one-frontend | |
company-preview-frontend | |
company-echo-metadata-frontend)) | |
(setq tab-always-indent 'complete) | |
(defvar completion-at-point-functions-saved nil) | |
:config | |
(global-company-mode 1) | |
(define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle) | |
(define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle) | |
(define-key company-active-map (kbd "S-TAB") 'company-select-previous) | |
(define-key company-active-map (kbd "<backtab>") 'company-select-previous) | |
(define-key company-mode-map [remap indent-for-tab-command] 'company-indent-for-tab-command) | |
(defun company-indent-for-tab-command (&optional arg) | |
(interactive "P") | |
(let ((completion-at-point-functions-saved completion-at-point-functions) | |
(completion-at-point-functions '(company-complete-common-wrapper))) | |
(indent-for-tab-command arg))) | |
(defun company-complete-common-wrapper () | |
(let ((completion-at-point-functions completion-at-point-functions-saved)) | |
(company-complete-common)))) | |
(use-package company-lsp | |
:ensure t | |
:init | |
(push 'company-lsp company-backends)) | |
;; Powerline | |
(use-package spaceline | |
:ensure t | |
:init | |
(setq powerline-default-separator 'slant) | |
:config | |
(spaceline-emacs-theme) | |
(spaceline-toggle-minor-modes-off) | |
(spaceline-toggle-buffer-size-off) | |
(spaceline-toggle-evil-state-on)) | |
;;;;;;;;;;;;;;;;;;;;;;; | |
;; Language Supports ;; | |
;;;;;;;;;;;;;;;;;;;;;;; | |
;; JavaScript | |
;;(use-package js2-mode | |
;; :ensure t | |
;; :init | |
;; (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))) | |
;;(use-package tern :ensure t) | |
;;;; Rust | |
;;(use-package rust-mode | |
;; :ensure t | |
;; :init | |
;; (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))) | |
;; | |
;;(use-package lsp-rust | |
;; :ensure t | |
;; :init | |
;; (setq lsp-rust-rls-command '("rustup" "run" "nightly" "rls")) | |
;; (add-hook 'rust-mode-hook #'lsp-rust-enable) | |
;; (add-hook 'rust-mode-hook #'flycheck-mode)) | |
;; | |
;; ;; Typescript | |
;;(use-package typescript-mode | |
;; :ensure t | |
;; :init | |
;; (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))) | |
;; | |
;;(use-package tide | |
;; :ensure t | |
;; :after (typescript-mode company flycheck) | |
;; :hook ((typescript-mode . tide-setup) | |
;; (typescript-mode . tide-hl-identifier-mode))) | |
;; | |
;; Auto-generated | |
;; 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 | |
(general which-key helm doom-themes evil use-package))) | |
;; fullscreen, org-agenda-list, and delete other windows | |
(spacemacs/toggle-frame-fullscreen-non-native) | |
(org-agenda nil "c") | |
(delete-other-windows) ;; need to switch to agenda first | |
(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. | |
) | |
(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. | |
'(custom-safe-themes | |
(quote | |
("bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" "ecba61c2239fbef776a72b65295b88e5534e458dfe3e6d7d9f9cb353448a569e" "93a0885d5f46d2aeac12bf6be1754faa7d5e28b27926b8aa812840fe7d0b7983" default))) | |
'(haskell-ask-also-kill-buffers nil) | |
'(haskell-interactive-popup-errors nil) | |
'(haskell-process-type (quote stack-ghci)) | |
'(package-selected-packages | |
(quote | |
(org-evil orgit org-bullets spacemacs-theme ob-async ob-restclient restclient restclient-mode web-mode haskell-mode helm-org-rifle evil-magit magit evil-org spaceline company-lsp company flycheck general avy which-key helm-projectile projectile helm-rg helm doom-themes evil-escape evil use-package)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment