diff options
-rw-r--r-- | doom/config.el | 563 | ||||
-rw-r--r-- | doom/init.el | 35 | ||||
-rw-r--r-- | doom/packages.el | 16 | ||||
-rw-r--r-- | isync/.mbsyncrc | 12 | ||||
-rw-r--r-- | macos/skhd/skhdrc | 13 | ||||
-rwxr-xr-x | macos/yabai/yabairc | 3 | ||||
-rw-r--r-- | tmux/.tmux.conf | 7 | ||||
-rw-r--r-- | zsh/.zsh/export.zsh | 10 | ||||
-rw-r--r-- | zsh/.zshrc | 6 |
9 files changed, 558 insertions, 107 deletions
diff --git a/doom/config.el b/doom/config.el index 8f66eca..6dbe26b 100644 --- a/doom/config.el +++ b/doom/config.el @@ -16,8 +16,8 @@ ;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd ;; font string. You generally only need these two: (setq doom-font (font-spec :family "Iosevka" :size 16) - doom-variable-pitch-font (font-spec :family "Libre Baskerville" :size 12) - doom-serif-font (font-spec :family "Libre Baskerville" :size 12)) + doom-variable-pitch-font (font-spec :family "Alegreya" :size 12) + doom-serif-font (font-spec :family "Alegreya" :size 12)) ;; There are two ways to load a theme. Both assume the theme is installed and ;; available. You can either set `doom-theme' or manually load a theme with the @@ -32,6 +32,9 @@ ;; numbers are disabled. For relative line numbers, set this to `relative'. (setq display-line-numbers-type nil) +(setq auth-sources '("~/.authinfo.gpg" + "~/.authinfo")) + ;; Add some keybinding customisations. ;; Stop emacs from freezing when trying to minimize it on a tiling WM. @@ -84,7 +87,6 @@ (define-prefix-command 'y-map) (global-set-key (kbd "C-c y") 'y-map) -(define-key y-map (kbd "s") 'y/swap-windows) (define-key y-map (kbd "p") 'password-store-copy) (define-key y-map (kbd "i") 'password-store-insert) (define-key y-map (kbd "g") 'password-store-generate) @@ -124,6 +126,34 @@ auto-save-interval 200 ; number of keystrokes between auto-saves (default: 300) ) +(setq tramp-auto-save-directory "/tmp") +(defvar disable-tramp-backups '(all)) +(eval-after-load "tramp" + '(progn + ;; Modified from https://www.gnu.org/software/emacs/manual/html_node/tramp/Auto_002dsave-and-Backup.html + (setq backup-enable-predicate + (lambda (name) + (and (normal-backup-enable-predicate name) + ;; Disable all tramp backups + (and disable-tramp-backups + (member 'all disable-tramp-backups) + (not (file-remote-p name 'method))) + (not ;; disable backup for tramp with the listed methods + (let ((method (file-remote-p name 'method))) + (when (stringp method) + (member method disable-tramp-backups))))))) + + (defun tramp-set-auto-save--check (original) + (if (funcall backup-enable-predicate (buffer-file-name)) + (funcall original) + (auto-save-mode -1))) + + (advice-add 'tramp-set-auto-save :around #'tramp-set-auto-save--check) + + ;; Use my ~/.ssh/config control master settings according to https://puppet.com/blog/speed-up-ssh-by-reusing-connections + (setq tramp-ssh-controlmaster-options ""))) + + ;; Set sensitive data mode (setq auto-mode-alist (append @@ -131,6 +161,9 @@ '("\\.sv\\'" . verilog-mode)) auto-mode-alist)) +(after! verilog-mode + (setq verilog-simulator "iverilog")) + ;; Remove the ring for emacs (setq ring-bell-function 'ignore) @@ -154,7 +187,10 @@ ;; Configure activation for whitespace mode (use-package! whitespace - :bind (("C-x w" . whitespace-mode))) + :bind (("C-x w" . whitespace-mode)) + :init + (setq whitespace-style '(newline newline-mark)) + (setq whitespace-display-mappings '((newline-mark 10 [?¬ 10])))) ;; Configure expand-region mode. (use-package! expand-region @@ -169,15 +205,17 @@ :mode ("\\.org\\'" . org-mode) :init (map! :map org-mode-map - "M-n" #'outline-next-visible-heading - "M-p" #'outline-previous-visible-heading) + "M-n" #'outline-next-visible-heading + "M-p" #'outline-previous-visible-heading + "C-c ]" #'ebib-insert-citation + "C-," nil) (setq org-src-window-setup 'current-window org-return-follows-link t org-confirm-babel-evaluate nil org-use-speed-commands t org-hide-emphasis-markers t org-adapt-indentation nil - org-cycle-separator-lines 1 + org-cycle-separator-lines 2 org-structure-template-alist '(("a" . "export ascii") ("c" . "center") ("C" . "comment") @@ -191,9 +229,10 @@ ("el" . "src emacs-lisp") ("d" . "definition") ("t" . "theorem"))) - (customize-set-variable 'org-blank-before-new-entry - '((heading . nil) - (plain-list-item . nil)))) + ;;(customize-set-variable 'org-blank-before-new-entry + ;; '((heading . nil) + ;; (plain-list-item . nil))) + ) (use-package! org-contacts :after org @@ -202,49 +241,212 @@ ;; Disable org indent mode and remove C-, from the org-mode-map. (after! org - (define-key org-mode-map (kbd "C-,") nil) ;; Set agenda files, refile targets and todo keywords. - (setq org-startup-indented nil - org-agenda-files (mapcar 'expand-file-name + (setq org-startup-indented nil) + (setq org-log-done 'time + org-log-into-drawer t) + (setq org-agenda-files (mapcar 'expand-file-name (list "~/Dropbox/org/inbox.org" "~/Dropbox/org/main.org" "~/Dropbox/org/tickler.org" "~/Dropbox/org/projects.org" - "~/Dropbox/org/pldi2020.org" - (format-time-string "~/Dropbox/org/journals/%Y-%m.org"))) - org-refile-targets `(("~/Dropbox/org/main.org" :maxlevel . 2) + (format-time-string "~/Dropbox/org/%Y-%m.org") + "~/Dropbox/bibliography/reading_list.org"))) + (setq org-refile-targets `(("~/Dropbox/org/main.org" :level . 1) ("~/Dropbox/org/someday.org" :level . 1) - ("~/Dropbox/org/tickler.org" :maxlevel . 2) - ("~/Dropbox/org/projects.org" :level . 1) - (,(format-time-string "~/Dropbox/org/journals/%Y-%m.org") :maxlevel . 2)) + ("~/Dropbox/org/projects.org" :maxlevel . 2) + (,(format-time-string "~/Dropbox/org/%Y-%m.org") :level . 1))) + (setq org-agenda-text-search-extra-files '("~/Dropbox/zk/hls.org" + "~/Dropbox/zk/computing.org" + "~/Dropbox/zk/verification.org" + "~/Dropbox/zk/mathematics.org")) ;; Set custom agenda commands which can be activated in the agenda viewer. - org-agenda-custom-commands + (setq org-agenda-custom-commands '(("w" "At work" tags-todo "@work" ((org-agenda-overriding-header "Work"))) ("h" "At home" tags-todo "@home" ((org-agenda-overriding-header "Home"))) ("u" "At uni" tags-todo "@uni" - ((org-agenda-overriding-header "University")))) - org-log-done 'time - org-capture-templates - `(("t" "Todo" entry (file+headline ,(format-time-string "~/Dropbox/org/journals/%Y-%m.org") "Today") - "* TODO %^{Title}\nCreated: %U\n\n%?\n") + ((org-agenda-overriding-header "University"))))) + + (setq org-agenda-span 7 + org-agenda-start-day "." + org-agenda-start-on-week 1) + (setq org-agenda-include-diary t) + + (setq org-capture-templates + `(("t" "Todo" entry (file "inbox.org") + "* TODO %? +:PROPERTIES: +:ID: %(org-id-uuid) +:END: +:LOGBOOK: +- State \"TODO\" from \"\" %U +:END:" :empty-lines 1) + ("l" "Link Todo" entry (file "inbox.org") + "* TODO %? +:PROPERTIES: +:ID: %(org-id-uuid) +:END: +:LOGBOOK: +- State \"TODO\" from \"\" %U +:END: + +%a" :empty-lines 1) ("c" "Contacts" entry (file "~/Dropbox/org/contacts.org") "* %(org-contacts-template-name) :PROPERTIES: :EMAIL: %(org-contacts-template-email) - :END:")))) + :END:" :empty-lines 1)) + + org-todo-keywords + '((sequence + "TODO(t)" ; A task that needs doing & is ready to do + "PROJECT(p)" ; A project, which usually contains other tasks + "START(s)" ; A task that is in progress + "WAIT(w)" ; Something external is holding up this task + "HOLD(h)" ; This task is paused/on hold because of me + "DEFERRED(h)" ; Demoted for later + "SOMEDAY(m)" ; todo some day + "|" + "DONE(d!)" ; Task successfully completed + "KILL(k)") ; Task was cancelled, aborted or is no longer applicable + (sequence + "[ ](T)" ; A task that needs doing + "[-](S)" ; Task is in progress + "[?](W)" ; Task is being held up or paused + "|" + "[X](D)"))); Task was completed +;; (setq org-html-head-extra +;; "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.11.1/tocbot.min.js\"></script> +;;<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.11.1/tocbot.css\"> +;;<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///Users/yannherklotz/Projects/orgcss/src/css/org.css\"/>" + (setq org-html-head-extra "<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///Users/yannherklotz/Projects/orgcss/src/css/org.css\"/>" + org-html-head-include-default-style nil + org-html-head-include-scripts nil + org-html-postamble-format + '(("en" "")) + org-html-postamble t + org-html-divs '((preamble "header" "header") + (content "article" "content") + (postamble "footer" "postamble"))) + + (require 'calendar) + (setq calendar-mark-diary-entries-flag t) + (setq calendar-mark-holidays-flag t) + (setq calendar-mode-line-format nil) + (setq calendar-time-display-form + '(24-hours ":" minutes + (when time-zone + (format "(%s)" time-zone)))) + (setq calendar-week-start-day 1) ; Monday + (setq calendar-date-style 'iso) + (setq calendar-date-display-form calendar-iso-date-display-form) + (setq calendar-time-zone-style 'numeric) ; Emacs 28.1 + + (require 'cal-dst) + (setq calendar-standard-time-zone-name "+0000") + (setq calendar-daylight-time-zone-name "+0100") + + (require 'diary-lib) + (setq diary-file "~/Dropbox/org/diary") + (setq diary-date-forms diary-iso-date-forms) + (setq diary-comment-start ";;") + (setq diary-comment-end "") + (setq diary-nonmarking-symbol "!") + (setq diary-show-holidays-flag t) + (setq diary-display-function #'diary-fancy-display) ; better than its alternative + (setq diary-header-line-format nil) + (setq diary-list-include-blanks nil) + (setq diary-number-of-entries 2) + (setq diary-mail-days 2) + (setq diary-abbreviated-year-flag nil) + + (add-hook 'calendar-today-visible-hook #'calendar-mark-today) + (add-hook 'diary-list-entries-hook 'diary-sort-entries t) + + (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files) + (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files) + ;; Prevent Org from interfering with my key bindings. + (remove-hook 'calendar-mode-hook #'org--setup-calendar-bindings) + + (let ((map calendar-mode-map)) + (define-key map (kbd "s") #'calendar-sunrise-sunset) + (define-key map (kbd "l") #'lunar-phases) + (define-key map (kbd "i") nil) ; Org sets this, much to my chagrin (see `remove-hook' above) + (define-key map (kbd "i a") #'diary-insert-anniversary-entry) + (define-key map (kbd "i c") #'diary-insert-cyclic-entry) + (define-key map (kbd "i d") #'diary-insert-entry) ; for current "day" + (define-key map (kbd "i i") #'diary-insert-entry) ; most common action, easier to type + (define-key map (kbd "i m") #'diary-insert-monthly-entry) + (define-key map (kbd "i w") #'diary-insert-weekly-entry) + (define-key map (kbd "i y") #'diary-insert-yearly-entry) + (define-key map (kbd "M-n") #'calendar-forward-month) + (define-key map (kbd "M-p") #'calendar-backward-month)) + + (require 'ox-extra) + (ox-extras-activate '(ignore-headlines)) + + (require 'ox-beamer) + (require 'ox-latex) + (add-to-list 'org-latex-classes + '("beamer" + "\\documentclass\[presentation\]\{beamer\}" + ("\\section\{%s\}" . "\\section*\{%s\}") + ("\\subsection\{%s\}" . "\\subsection*\{%s\}") + ("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}"))) + (add-to-list 'org-latex-classes + '("scrartcl" + "\\documentclass\{scrartcl\}" + ("\\section\{%s\}" . "\\section*\{%s\}") + ("\\subsection\{%s\}" . "\\subsection*\{%s\}") + ("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}") + ("\\paragraph{%s}" . "\\paragraph*{%s}"))) + (add-to-list 'org-latex-packages-alist '("" "minted")) + (setq org-latex-listings 'minted) + + (setq org-latex-pdf-process + '("%latex -shell-escape -interaction nonstopmode -output-directory %o %f" + "%latex -shell-escape -interaction nonstopmode -output-directory %o %f" + "%latex -shell-escape -interaction nonstopmode -output-directory %o %f")) + (setq-default TeX-command-extra-options "-shell-escape" + TeX-engine 'xetex) + (setq org-beamer-environments-extra '(("onlyenv" "o" "\\begin{onlyenv}%a{%h}" "\\end{onlyenv}") + ("onlyenvNH" "o" "\\begin{onlyenv}%a" "\\end{onlyenv}") + ("blockNH" "o" "\\begin{block}%a{}" "\\end{block}") + ("minipage" "o" "\\begin{minipage}[t]%o[t]{1.0\\textwidth}" "\\end{minipage}")))) + +(use-package! ox-tufte + :after org) + +(use-package appt + :config + (setq appt-display-diary nil) + (setq appt-disp-window-function #'appt-disp-window) + (setq appt-display-mode-line t) + (setq appt-display-interval 3) + (setq appt-audible nil) + (setq appt-warning-time-regexp "appt \\([0-9]+\\)") + (setq appt-message-warning-time 15) + (run-at-time 10 nil #'appt-activate 1)) + ;; Set up org ref for PDFs (use-package! org-ref - :after org - :bind (("C-c r" . org-ref-cite-hydra/body) - ("C-c b" . org-ref-bibtex-hydra/body)) + :demand + :init + (setq org-ref-completion-library 'org-ref-ivy-cite) :config (setq org-ref-bibliography-notes "~/Dropbox/bibliography/notes.org" org-ref-default-bibliography '("~/Dropbox/bibliography/references.bib") - org-ref-pdf-directory "~/Dropbox/bibliography/papers/") - (setq org-ref-completion-library 'org-ref-ivy-cite)) + org-ref-pdf-directory "~/Dropbox/bibliography/papers" + org-ref-bib-html "") + (setq reftex-default-bibliography '("~/Dropbox/bibliography/references.bib"))) + +(use-package! org-transclusion + :after org + :config + (setq org-transclusion-exclude-elements '(property-drawer headline))) ;; Set up org-noter (use-package! org-noter @@ -257,26 +459,46 @@ (use-package! org-superstar :hook (org-mode . org-superstar-mode) :config - (setq org-superstar-headline-bullets-list '("♠" "♣" "♥" "♦") + (setq org-superstar-headline-bullets-list '("♚" "♛" "♜" "♝" "♞" "♟" "♔" "♕" "♖" "♗" "♘" "♙") org-superstar-special-todo-items t)) +(use-package! org-id + :after org + :config + (setq org-id-link-to-org-use-id 'use-existing) + (setq org-id-track-globally t)) + ;; Set up org registers to quickly jump to files that I use often. (set-register ?l (cons 'file "~/.emacs.d/loader.org")) (set-register ?m (cons 'file "~/Dropbox/org/main.org")) (set-register ?i (cons 'file "~/Dropbox/org/inbox.org")) -(set-register ?c (cons 'file (format-time-string "~/Dropbox/org/journals/%Y-%m.org"))) +(set-register ?p (cons 'file "~/Dropbox/org/projects.org")) +(set-register ?c (cons 'file (format-time-string "~/Dropbox/org/%Y-%m.org"))) + +(use-package counsel + :config + (setq counsel-rg-base-command + '("rg" "-M" "240" "--max-columns-preview" "--with-filename" + "--no-heading" "--line-number" "--color" "never" "%s"))) ;; Bibtex stuff (use-package! ebib :bind (("C-c y b" . ebib)) :init (setq ebib-preload-bib-files '("~/Dropbox/bibliography/references.bib") - ebib-notes-directory "~/Dropbox/bibliography/notes/") + ebib-notes-directory "~/Dropbox/bibliography/notes/" + ebib-notes-template "#+TITLE: Notes on: %T\n\n>|<" + ebib-keywords-file "~/Dropbox/bibliography/keywords.txt" + ebib-reading-list-file "~/Dropbox/bibliography/reading_list.org") + :config (add-to-list 'ebib-file-search-dirs "~/Dropbox/bibliography/papers") (add-to-list 'ebib-file-associations '("pdf" . "open")) + (add-to-list 'ebib-citation-commands '(org-mode (("ref" "cite:%(%K%,)")))) + (advice-add 'bibtex-generate-autokey :around #'(lambda (orig-func &rest args) - (replace-regexp-in-string ":" "" (apply orig-func args))))) + (replace-regexp-in-string ":" "" (apply orig-func args)))) + (remove-hook 'ebib-notes-new-note-hook #'org-narrow-to-subtree)) ;; Set up dictionaries (setq ispell-dictionary "en_GB") @@ -292,52 +514,71 @@ :bind-keymap ("C-c k" . zettelkasten-mode-map)) +(use-package! elfeed-org + :config + (elfeed-org) + (setq rmh-elfeed-org-files (list "~/Dropbox/org/elfeed.org"))) + ;; Proof general configuration (setq proof-splash-enable nil proof-auto-action-when-deactivating-scripting 'retract proof-delete-empty-windows nil proof-auto-raise-buffers t - coq-compile-before-require t) + coq-compile-before-require nil + coq-compile-vos t + coq-compile-parallel-in-background t + coq-max-background-compilation-jobs 4 + coq-compile-keep-going nil + coq-compile-quick 'no-quick) (setq coq-may-use-prettify nil company-coq-prettify-symbols nil) (global-prettify-symbols-mode -1) -(use-package smartparens - :bind (("M-[" . sp-backward-unwrap-sexp) - ("M-]" . sp-unwrap-sexp) - ("C-M-f" . sp-forward-sexp) - ("C-M-b" . sp-backward-sexp) - ("C-M-d" . sp-down-sexp) - ("C-M-a" . sp-backward-down-sexp) - ("C-M-e" . sp-up-sexp) - ("C-M-u" . sp-backward-up-sexp) - ("C-M-t" . sp-transpose-sexp) - ("C-M-n" . sp-next-sexp) - ("C-M-p" . sp-previous-sexp) - ("C-M-k" . sp-kill-sexp) - ("C-M-w" . sp-copy-sexp) - ("C-)" . sp-forward-slurp-sexp) - ("C-}" . sp-forward-barf-sexp) - ("C-(" . sp-backward-slurp-sexp) - ("C-{" . sp-backward-barf-sexp) - ("M-D" . sp-splice-sexp) - ("C-]" . sp-select-next-thing-exchange) - ("C-<left_bracket>" . sp-select-previous-thing) - ("C-M-]" . sp-select-next-thing) - ("M-F" . sp-forward-symbol) - ("M-B" . sp-backward-symbol) - ("M-r" . sp-split-sexp)) +(use-package! smartparens :config + (map! :map smartparens-mode-map + "M-[" #'sp-backward-unwrap-sexp + "M-]" #'sp-unwrap-sexp + "C-M-f" #'sp-forward-sexp + "C-M-b" #'sp-backward-sexp + "C-M-d" #'sp-down-sexp + "C-M-a" #'sp-backward-down-sexp + "C-M-e" #'sp-up-sexp + "C-M-u" #'sp-backward-up-sexp + "C-M-t" #'sp-transpose-sexp + "C-M-n" #'sp-next-sexp + "C-M-p" #'sp-previous-sexp + "C-M-k" #'sp-kill-sexp + "C-M-w" #'sp-copy-sexp + "C-)" #'sp-forward-slurp-sexp + "C-}" #'sp-forward-barf-sexp + "C-(" #'sp-backward-slurp-sexp + "C-{" #'sp-backward-barf-sexp + "M-D" #'sp-splice-sexp + "C-]" #'sp-select-next-thing-exchange + "C-<left_bracket>" #'sp-select-previous-thing + "C-M-]" #'sp-select-next-thing + "M-F" #'sp-forward-symbol + "M-B" #'sp-backward-symbol + "M-r" #'sp-split-sexp) (require 'smartparens-config) (show-smartparens-global-mode +1) (smartparens-global-mode 1)) -(use-package! ormolu - :hook (haskell-mode . ormolu-format-on-save-mode) - :bind - (:map haskell-mode-map - ("C-c r" . ormolu-format-buffer))) +;;(use-package! ormolu +;; :hook (haskell-mode . ormolu-format-on-save-mode) +;; :bind +;; (:map haskell-mode-map +;; ("C-c r" . ormolu-format-buffer))) + +(use-package! lsp-haskell + :config + (setq lsp-haskell-process-path-hie "haskell-language-server-wrapper") + ;; Comment/uncomment this line to see interactions between lsp client/server. + ;;(setq lsp-log-io t) +) + (after! writeroom-mode (setq +zen-text-scale 1)) @@ -345,6 +586,196 @@ (setq doc-view-resolution 300) +(after! tuareg-mode + (add-hook 'tuareg-mode-hook + (lambda () + (define-key tuareg-mode-map (kbd "C-M-<tab>") #'ocamlformat) + (add-hook 'before-save-hook #'ocamlformat-before-save)))) + +(use-package! ox-reveal + :after org) + +(use-package! direnv + :config + (direnv-mode)) + +(use-package! alectryon + :load-path "/Users/yannherklotz/Projects/alectryon/etc/elisp") + +(defun ymhg/incr-id (ident) + (let* ((ident-list (append nil ident nil)) + (last-ident (last ident-list))) + (setcar last-ident (+ (car last-ident) 1)) + (concat ident-list))) + +(defun ymhg/incr-id-total (ident) + (if (string-match-p "\\(.*[a-z]\\)\\([0-9]+\\)$" ident) + (progn + (string-match "\\(.*[a-z]\\)\\([0-9]+\\)$" ident) + (let ((pre (match-string 1 ident)) + (post (match-string 2 ident))) + (concat pre (number-to-string (+ 1 (string-to-number post)))))) + (ymhg/incr-id ident))) + +(defun ymhg/branch-id (ident) + (if (string-match-p ".*[0-9]$" ident) + (concat ident "a") + (concat ident "1"))) + +(defun ymhg/org-zettelkasten-create (incr newheading) + (let* ((current-id (org-entry-get nil "CUSTOM_ID")) + (next-id (funcall incr current-id))) + (funcall newheading) + (org-set-property "CUSTOM_ID" next-id))) + +(defun org-zettelkasten-create-next () + (ymhg/org-zettelkasten-create + 'ymhg/incr-id 'org-insert-heading)) + +(defun org-zettelkasten-create-branch () + (ymhg/org-zettelkasten-create + 'ymhg/branch-id '(lambda () (org-insert-subheading "")))) + +(defun org-zettelkasten-create-dwim () + (interactive) + (let ((current-point (save-excursion + (org-back-to-heading) + (point))) + (next-point (save-excursion + (org-forward-heading-same-level 1 t) + (point)))) + (if (= current-point next-point) + (org-zettelkasten-create-next) + (org-zettelkasten-create-branch)))) + +(defun org-zettelkasten-search-current-id () + (interactive) + (let ((current-id (org-entry-get nil "CUSTOM_ID"))) + (counsel-rg (concat "#" current-id) "~/Dropbox/zk" "-g *.org" "ID: "))) + +(define-key org-mode-map (kbd "C-c y n") #'org-zettelkasten-create-dwim) +(define-key org-mode-map (kbd "C-c y s") #'org-zettelkasten-search-current-id) + +(use-package! ox-hugo + :after ox) + +(defun sci-hub-pdf-url (doi) + "Get url to the pdf from SCI-HUB using DOI." + (setq *doi-utils-pdf-url* (concat "https://sci-hub.do/" doi) ;captcha + *doi-utils-waiting* t + ) + ;; try to find PDF url (if it exists) + (url-retrieve (concat "https://sci-hub.do/" doi) + (lambda (_) + (goto-char (point-min)) + (while (search-forward-regexp + "\\(https://\\|//sci-hub.do/downloads\\).+download=true'" nil t) + (let ((foundurl (match-string 0))) + (message foundurl) + (if (string-match "https:" foundurl) + (setq *doi-utils-pdf-url* foundurl) + (setq *doi-utils-pdf-url* (concat "https:" foundurl)))) + (setq *doi-utils-waiting* nil)))) + (while *doi-utils-waiting* (sleep-for 0.1)) + *doi-utils-pdf-url*) + +(defun download-pdf-from-doi (doi key) + "Download pdf from doi with KEY name." + (url-copy-file (sci-hub-pdf-url doi) + (concat "~/Dropbox/bibliography/papers/" key ".pdf"))) + +(defun get-bib-from-doi (doi) + "Get the bibtex from DOI." + (shell-command (concat "curl -L -H \"Accept: application/x-bibtex; charset=utf-8\" " + "https://doi.org/" doi))) + +(use-package erc + :commands (erc erc-tls) + :bind (:map erc-mode-map + ("C-c r" . reset-erc-track-mode)) + :preface + (defun irc () + (interactive) + (erc :server "ee-ymh15.ee.ic.ac.uk" :port 12844 :nick "ymherklotz" + :password "ymherklotz/freenode:xxx")) + + (defun ymhg/erc-notify (nickname message) + "Displays a notification message for ERC." + (let* ((channel (buffer-name)) + (nick (erc-hl-nicks-trim-irc-nick nickname)) + (title (if (string-match-p (concat "^" nickname) channel) + nick + (concat nick " (" channel ")"))) + (msg (s-trim (s-collapse-whitespace message)))) + (alert (concat nick ": " msg) :title title))) + :hook ((ercn-notify . ymhg/erc-notify)) + :config + (setq erc-autojoin-timing 'ident) + (setq erc-fill-function 'erc-fill-static) + (setq erc-fill-static-center 22) + (setq erc-hide-list '("JOIN" "PART" "QUIT")) + (setq erc-lurker-hide-list '("JOIN" "PART" "QUIT")) + (setq erc-lurker-threshold-time 43200) + (setq erc-prompt-for-password nil) + (setq erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" + "324" "329" "332" "333" "353" "477")) + (setq erc-fill-column 100) + (add-to-list 'erc-modules 'notifications) + (add-to-list 'erc-modules 'spelling) + (erc-services-mode 1) + (erc-update-modules) + (erc-track-minor-mode 1) + (erc-track-mode 1)) + +(use-package erc-hl-nicks + :after erc) + +(use-package znc + :after erc + :config + (setq znc-servers '(("ee-ymh15.ee.ic.ac.uk" 12843 t ((freenode "ymherklotz" "xxx")))))) + +(use-package alert + :custom + (alert-default-style 'osx-notifier)) + +;; Bug fixes + +;; Projectile compilation buffer not there anymore for some reason +(setq compilation-buffer-name-function #'compilation--default-buffer-name) + +(defun diary-last-day-of-month (date) + "Return `t` if DATE is the last day of the month." + (let* ((day (calendar-extract-day date)) + (month (calendar-extract-month date)) + (year (calendar-extract-year date)) + (last-day-of-month + (calendar-last-day-of-month month year))) + (= day last-day-of-month))) + +;;(setq smtpmail-smtp-server "smtp.mailbox.org" ;; <-- edit this !!! +;; smtpmail-smtp-service 587 ;; 25 is default -- uncomment and edit if needed +;; smtpmail-stream-type 'starttls) + +(setq user-mail-address "ymh15@ic.ac.uk" + smtpmail-smtp-server "smtp.office365.com" + smtpmail-smtp-service 587 + smtpmail-stream-type 'starttls) + +(setq message-signature "Yann Herklotz +Imperial College London +https://yannherklotz.com") + +(setq message-send-mail-function 'message-smtpmail-send-it) + +(setq auth-sources '("~/.authinfo" "~/.authinfo.gpg" "~/.netrc")) + +;;(use-package! ox-ssh +;; :after org +;; :config +;; (when (eq system-type 'darwin) +;; (setq org-ssh-header "XAuthLocation /opt/X11/bin/xauth"))) + ;; Here are some additional functions/macros that could help you configure Doom: ;; ;; - `load!' for loading external *.el files relative to this one diff --git a/doom/init.el b/doom/init.el index 682520c..4e8cff9 100644 --- a/doom/init.el +++ b/doom/init.el @@ -88,13 +88,12 @@ ;;ein ; tame Jupyter notebooks with emacs (eval +overlay) ; run code, run (also, repls) ;;gist ; interacting with github gists - ;;lookup ; navigate your code and its documentation - ;;lsp - macos ; MacOS-specific commands + lookup ; navigate your code and its documentation + lsp magit ; a git porcelain for Emacs ;;make ; run make tasks from Emacs pass ; password manager for nerds - pdf ; pdf enhancements + ;;pdf ; pdf enhancements ;;prodigy ; FIXME managing external services & code builders ;;rgb ; creating color strings ;;terraform ; infrastructure as code @@ -102,11 +101,11 @@ ;;upload ; map local to remote projects via ssh/ftp :lang - ;;agda ; types of types of types of types... - ;;assembly ; assembly for fun or debugging + agda ; types of types of types of types... + assembly ; assembly for fun or debugging cc ; C/C++/Obj-C madness clojure ; java with a lisp - ;;common-lisp ; if you've seen one lisp, you've seen them all + common-lisp ; if you've seen one lisp, you've seen them all coq ; proofs-as-programs ;;crystal ; ruby at the speed of c ;;csharp ; unity, .NET, and mono shenanigans @@ -120,12 +119,12 @@ ;;fsharp ; ML stands for Microsoft's Language ;;fstar ; (dependent) types and (monadic) effects and Z3 ;;go ; the hipster dialect - haskell ; a language that's lazier than I am + (haskell +lsp) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python - ;;idris ; + idris ; ;;(java +meghanada) ; the poster child for carpal tunnel syndrome ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) - ;;julia ; a better, faster MATLAB + julia ; a better, faster MATLAB ;;kotlin ; a better, slicker Java(Script) latex ; writing papers in Emacs has never been so fun ;;lean @@ -147,16 +146,16 @@ ;;perl ; write code no one else can comprehend ;;php ; perl's insecure younger brother ;;plantuml ; diagrams for confusing people more - ;;purescript ; javascript, but functional + purescript ; javascript, but functional python ; beautiful is better than ugly ;;qt ; the 'cutest' gui framework ever - ;;racket ; a DSL for DSLs - ;;rest ; Emacs as a REST client - ;;rst ; ReST in peace + racket ; a DSL for DSLs + rest ; Emacs as a REST client + rst ; ReST in peace ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() - ;;scala ; java, but good - ;;scheme ; a fully conniving family of lisps + scala ; java, but good + scheme ; a fully conniving family of lisps sh ; she sells {ba,z,fi}sh shells on the C xor ;;solidity ; do you need a blockchain? No. ;;swift ; who asked for emoji variables? @@ -176,4 +175,6 @@ :config ;;literate - (default +bindings +smartparens)) + (default +bindings +smartparens) + + :os macos) diff --git a/doom/packages.el b/doom/packages.el index 26532fb..b59fd0a 100644 --- a/doom/packages.el +++ b/doom/packages.el @@ -58,6 +58,12 @@ (package! org-noter) ;; `org-bullets' replacement (package! org-superstar) +(package! ox-reveal) +;(package! ox-ssh) +(package! ox-tufte) +(package! ox-hugo) +(package! org-transclusion + :recipe (:host github :repo "nobiot/org-transclusion")) ;; Bibtex stuff (package! ebib) @@ -65,6 +71,16 @@ ;; Haskell stuff (package! ormolu) +(package! direnv) +(package! yaml-mode) + +(package! erc-hl-nicks) +(package! alert) +(package! znc) + +(package! elfeed) +(package! elfeed-org) + ;; Misc dependencies (package! hungry-delete) (package! vagrant-tramp) diff --git a/isync/.mbsyncrc b/isync/.mbsyncrc index 189fd5e..c85c1f4 100644 --- a/isync/.mbsyncrc +++ b/isync/.mbsyncrc @@ -29,21 +29,19 @@ Path ~/.mail/mailbox/ Inbox ~/.mail/mailbox/Inbox Channel imperial -Master :imperial-remote: -Slave :imperial-local: -Patterns "Sent Items" Archive1 "Deleted Items" INBOX Drafts +Far :imperial-remote: +Near :imperial-local: +Patterns "Sent Items" Archive "Deleted Items" INBOX Drafts Create Both SyncState * -MaxMessages 100 ExpireUnread no Expunge Both Channel mailbox -Master :mailbox-remote: -Slave :mailbox-local: +Far :mailbox-remote: +Near :mailbox-local: Patterns * Create Both SyncState * -MaxMessages 100 ExpireUnread no Expunge Both diff --git a/macos/skhd/skhdrc b/macos/skhd/skhdrc index 6a0d5c9..ae712b8 100644 --- a/macos/skhd/skhdrc +++ b/macos/skhd/skhdrc @@ -107,9 +107,6 @@ shift + cmd - n : yabai -m space --create && \ yabai -m space --focus "${index}" # fast focus desktop -alt - c : yabai -m space --focus recent -alt - x : yabai -m space --focus next -alt - z : yabai -m space --focus prev alt - 1 : yabai -m space --focus 1 alt - 2 : yabai -m space --focus 2 alt - 3 : yabai -m space --focus 3 @@ -160,10 +157,10 @@ shift + alt - r : yabai -m window --resize bottom:0:20 shift + alt - s : yabai -m window --resize right:20:0 # decrease window size -shift + cmd - r : yabai -m window --resize bottom:0:-20 -shift + cmd - w : yabai -m window --resize top:0:20 -shift + cmd - a : yabai -m window --resize left:20:0 -shift + cmd - s : yabai -m window --resize right:-20:0 +# shift + cmd - r : yabai -m window --resize bottom:0:-20 +# shift + cmd - w : yabai -m window --resize top:0:20 +# shift + cmd - a : yabai -m window --resize left:20:0 +# shift + cmd - s : yabai -m window --resize right:-20:0 # set insertion point in focused container ctrl + alt - n : yabai -m window --insert west @@ -176,7 +173,7 @@ alt - d : yabai -m window --toggle zoom-parent alt - f : yabai -m window --toggle zoom-fullscreen # toggle window split type -alt - m : yabai -m window --toggle split +shift + alt - m : yabai -m window --toggle split # float / unfloat window and center on screen alt - t : yabai -m window --toggle float;\ diff --git a/macos/yabai/yabairc b/macos/yabai/yabairc index a509658..4c5fa56 100755 --- a/macos/yabai/yabairc +++ b/macos/yabai/yabairc @@ -13,5 +13,8 @@ yabai -m config left_padding 5 yabai -m config right_padding 5 yabai -m config window_gap 5 +yabai -m config --space 2 layout float + yabai -m rule --add app=Emacs manage=on +yabai -m rule --add app=zathura manage=on yabai -m rule --add app="System Preferences" manage=off diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index a91f370..b39822f 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -1,9 +1,8 @@ set -g default-terminal "screen-256color" - -set -g status-bg green +set -g status-bg magenta set -g status-fg white +set -g status-position top unbind C-b set -g prefix C-o - -set -g default-shell /bin/zsh +bind C-o send-prefix diff --git a/zsh/.zsh/export.zsh b/zsh/.zsh/export.zsh index a978e4b..2de4b93 100644 --- a/zsh/.zsh/export.zsh +++ b/zsh/.zsh/export.zsh @@ -1,9 +1,10 @@ os=$(uname -s) -. $HOME/.nix-profile/etc/profile.d/nix.sh - [ -n "$SSH_CLIENT" ] && export MINIMAL_USER_CHAR="$(hostname)" +. $HOME/.nix-profile/etc/profile.d/nix.sh +export NIX_IGNORE_SYMLINK_STORE=1 + export GITHUB_HOME=$HOME/Projects export FZF_DEFAULT_COMMAND='fd --type file --hidden --no-ignore' export ALTERNATE_EDITOR="emacs -nw -Q" @@ -24,7 +25,7 @@ if [ $os = "Darwin" ]; then prepend_path "/Library/TeX/texbin" prepend_path "/usr/local/opt/bison/bin" - append_path "${HOME}/Library/Python/3.8/bin" + append_path "${HOME}/Library/Python/3.9/bin" fi prepend_path "/usr/local/bin" @@ -33,11 +34,14 @@ prepend_path "${HOME}/.yarn/bin" prepend_path "${HOME}/.cargo/bin" prepend_path "${HOME}/.cabal/bin" prepend_path "${HOME}/.local/bin" +# prepend_path "/usr/local/opt/llvm/bin" prepend_path "/mnt/data/tools/panda/bambu-9.7-dev/bin" append_path "/opt/Xilinx/Vivado/2019.1/bin" append_path "/opt/intelFPGA_lite/18.1/quartus/bin" +append_path "$HOME/projects/vericert/bin" +append_path "/opt/bin" export PATH @@ -27,9 +27,11 @@ setopt HIST_FIND_NO_DUPS #if [ -d ~/.cache/wal ]; then (cat ~/.cache/wal/sequences &) fi +export MINIMAL_MAGIC_ENTER=no + # Sourcing everything -if [ -e /usr/share/fzf/key-bindings.zsh ]; then source /usr/share/fzf/key-bindings.zsh; fi -if [ -e /usr/share/fzf/completion.zsh ]; then source /usr/share/fzf/completion.zsh; fi +#if [ -e /usr/share/fzf/key-bindings.zsh ]; then source /usr/share/fzf/key-bindings.zsh; fi +#if [ -e /usr/share/fzf/completion.zsh ]; then source /usr/share/fzf/completion.zsh; fi if [ -e $HOME/.zsh/export.zsh ]; then source $HOME/.zsh/export.zsh; fi if [ -e $HOME/.zsh/minimal.zsh ]; then source $HOME/.zsh/minimal.zsh; fi if [ -e $HOME/.zsh/function.zsh ]; then source $HOME/.zsh/function.zsh; fi |