Created
March 14, 2022 18:57
-
-
Save escherize/4769979b158965d9f68719ae14d29af2 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
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- | |
;; Place your private configuration here! Remember, you do not need to run 'doom | |
;; sync' after modifying this file! | |
;; Some functionality uses this to identify you, e.g. GPG configuration, email | |
;; clients, file templates and snippets. | |
(setq user-full-name "John Doe" | |
user-mail-address "john@doe.com") | |
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here | |
;; are the three important ones: | |
;; | |
;; + `doom-font' | |
;; + `doom-variable-pitch-font' | |
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for | |
;; presentations or streaming. | |
;; | |
;; 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 "monospace" :size 12 :weight 'semi-light) | |
;; doom-variable-pitch-font (font-spec :family "sans" :size 13)) | |
;; 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 | |
;; `load-theme' function. This is the default: | |
(setq doom-theme 'doom-one) | |
;; If you use `org' and don't want your org files in the default location below, | |
;; change `org-directory'. It must be set before org loads! | |
(setq org-directory "~/org/") | |
;; This determines the style of line numbers in effect. If set to `nil', line | |
;; numbers are disabled. For relative line numbers, set this to `relative'. | |
(setq display-line-numbers-type t) | |
;; Here are some additional functions/macros that could help you configure Doom: | |
;; | |
;; - `load!' for loading external *.el files relative to this one | |
;; - `use-package!' for configuring packages | |
;; - `after!' for running code after a package has loaded | |
;; - `add-load-path!' for adding directories to the `load-path', relative to | |
;; this file. Emacs searches the `load-path' when you load packages with | |
;; `require' or `use-package'. | |
;; - `map!' for binding new keys | |
;; | |
;; To get information about any of these functions/macros, move the cursor over | |
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). | |
;; This will open documentation for it, including demos of how they are used. | |
;; | |
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how | |
;; they are implemented. | |
(use-package! smartparens | |
:init (map! :map smartparens-mode-map | |
"C-M-f" #'sp-forward-sexp | |
"C-M-b" #'sp-backward-sexp | |
"<M-up>" #'sp-splice-sexp-killing-backward | |
"<M-down>" #'sp-splice-sexp-killing-forward | |
"C-)" #'sp-forward-slurp-sexp | |
"C-(" #'sp-backward-slurp-sexp | |
"C-}" #'sp-forward-barf-sexp | |
"C-{" #'sp-backward-barf-sexp | |
"M-(" #'sp-wrap-round | |
"M-[" #'sp-wrap-square | |
;; "M-{" #'sp-wrap-curly | |
)) | |
(use-package! multiple-cursors | |
:init (setq mc/always-run-for-all t) | |
:config (add-to-list 'mc/unsupported-minor-modes 'lispy-mode) | |
:bind (("C-S-c" . mc/edit-lines) | |
("C-M-g" . mc/mark-all-like-this-dwim) | |
("C-c C-<" . mc/mark-all-like-this-dwim) | |
("C->" . mc/mark-next-like-this) | |
("C-M->" . mc/skip-to-next-like-this) | |
("C-<" . mc/mark-previous-like-this) | |
("C-M-<" . mc/skip-to-previous-like-this))) | |
(after! smartparens | |
(dolist (brace '("(" "{" "[")) | |
(sp-pair brace nil)) | |
(sp-pair "#{" "}") | |
(sp-pair "#(" ")") | |
(sp-pair (concat "#_(") ")") | |
(sp-pair (concat "#_[") "]") | |
(sp-pair (concat "#_{") "}") | |
(sp-pair (concat "#_#{") "}")) | |
(auto-save-visited-mode 1) | |
(smartparens-global-strict-mode 1) | |
(global-auto-revert-mode t) | |
;; inf clojure things | |
(after! clojure-mode | |
(setq clojure-toplevel-inside-comment-form t) | |
(setq clojure-indent-style 'align-arguments) | |
(setq-local fill-column 118) | |
(setq-local clojure-docstring-fill-column 118)) | |
;; ‘C-x r s <register-key>’ save to register | |
;; 'C-c C-j x <register-key' to send to repl | |
(defun cider-insert-register-contents (register) | |
(interactive (list (register-read-with-preview "From register"))) | |
(let ((form (get-register register))) | |
;; could put form into a buffer and check if its parens are | |
;; balanced | |
(if form | |
(cider-insert-in-repl form (not cider-invert-insert-eval-p)) | |
(user-error "No saved form in register")))) | |
(defun bcm/switch-to-repl-in-ns () | |
(interactive) | |
(progn | |
(inf-clojure-set-ns nil) | |
(inf-clojure-switch-to-repl))) | |
;; (use-package! inf-clojure-minor-mode | |
;; :bind (("C-c C-k" . inf-clojure-reload) | |
;; ("C-c z" . bcm/switch-to-repl-in-ns))) | |
;;load namespace: inf-clojure-reload | |
;;switch ns: inf-clojure-set-ns | |
;;switch to repl: C-c C-z | |
(defun toggle-frame-split () | |
"If the frame is split vertically, split it horizontally or vice versa. | |
Assumes that the frame is only split into two." | |
(interactive) | |
(unless (= (length (window-list)) 2) (error "Can only toggle a frame split in two")) | |
(let ((split-vertically-p (window-combined-p))) | |
(delete-window) ; closes current window | |
(if split-vertically-p | |
(split-window-horizontally) | |
(split-window-vertically)) ; gives us a split with the other window twice | |
(switch-to-buffer nil))) ; restore the original window in this part of the frame | |
(global-set-key (kbd "C-x C-|") 'toggle-frame-split) | |
(global-set-key (kbd "C-h SPC") 'helm-all-mark-rings) ;; was it "C-c h SPC" ? | |
(global-set-key (kbd "C-x r m") 'helm-bookmarks) | |
(global-set-key (kbd "C-c h x") 'helm-register) | |
(global-set-key (kbd "C-c h o") 'helm-occur) | |
(global-set-key (kbd "C-x b") 'helm-mini) | |
(global-set-key (kbd "C-h b") 'helm-resume) | |
(global-set-key (kbd "C-c v d") 'git-gutter:popup-diff) | |
(global-set-key (kbd "C-c C-n") 'lsp-format-region) | |
(setq lsp-file-watch-threshold 2000) | |
(defun date () | |
(interactive) | |
(insert (shell-command-to-string "echo -n $(date +%D__%H_%M:%S)"))) | |
(defun md () | |
(interactive) | |
(switch-to-buffer | |
(find-file-noselect "~/dv/scratch/markdown.md" nil nil nil))) | |
;; (defun jack-in-bb () | |
;; (interactive) | |
;; (cider-connect-clj (list :host "localhost" | |
;; :port 1667 | |
;; 'project-dir "~/dv/bb-things"))) | |
(defun spy! () | |
(interactive) | |
(insert " | |
(defmacro spy [x] `(let [x# ~x] (log/debug '~x \" => \" x#) x#)) | |
")) | |
(after! mermaid-mode | |
(setq mermaid-mode-map | |
(let ((map mermaid-mode-map)) | |
(define-key map (kbd "C-c C-c") nil) | |
(define-key map (kbd "C-c C-f") nil) | |
(define-key map (kbd "C-c C-b") nil) | |
(define-key map (kbd "C-c C-r") nil) | |
(define-key map (kbd "C-c C-o") nil) | |
(define-key map (kbd "C-c C-d") nil) | |
(define-key map (kbd "C-c C-d c") 'mermaid-compile) | |
(define-key map (kbd "C-c C-d c") 'mermaid-compile) | |
(define-key map (kbd "C-c C-d f") 'mermaid-compile-file) | |
(define-key map (kbd "C-c C-d b") 'mermaid-compile-buffer) | |
(define-key map (kbd "C-c C-d r") 'mermaid-compile-region) | |
(define-key map (kbd "C-c C-d o") 'mermaid-open-browser) | |
(define-key map (kbd "C-c C-d d") 'mermaid-open-doc) | |
map))) | |
(defun marker-is-point-p (marker) | |
"test if marker is current point" | |
(and (eq (marker-buffer marker) (current-buffer)) | |
(= (marker-position marker) (point)))) | |
(defun push-mark-maybe () | |
"push mark onto `global-mark-ring' if mark head or tail is not current location" | |
(if (not global-mark-ring) (error "global-mark-ring empty") | |
(unless (or (marker-is-point-p (car global-mark-ring)) | |
(marker-is-point-p (car (reverse global-mark-ring)))) | |
(push-mark)))) | |
(defun backward-global-mark () | |
"use `pop-global-mark', pushing current point if not on ring." | |
(interactive) | |
(push-mark-maybe) | |
(when (marker-is-point-p (car global-mark-ring)) | |
(call-interactively 'pop-global-mark)) | |
(call-interactively 'pop-global-mark)) | |
(defun forward-global-mark () | |
"hack `pop-global-mark' to go in reverse, pushing current point if not on ring." | |
(interactive) | |
(push-mark-maybe) | |
(setq global-mark-ring (nreverse global-mark-ring)) | |
(when (marker-is-point-p (car global-mark-ring)) | |
(call-interactively 'pop-global-mark)) | |
(call-interactively 'pop-global-mark) | |
(setq global-mark-ring (nreverse global-mark-ring))) | |
(global-set-key (kbd "s-]") (quote backward-global-mark)) | |
(global-set-key (kbd "s-[") (quote forward-global-mark)) | |
(setq ob-mermaid-cli-path "/usr/local/bin/mmdc") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment