summaryrefslogtreecommitdiff
path: root/emacs/.config/emacs-kj/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.config/emacs-kj/init.el')
-rw-r--r--emacs/.config/emacs-kj/init.el911
1 files changed, 0 insertions, 911 deletions
diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el
deleted file mode 100644
index 83a9353..0000000
--- a/emacs/.config/emacs-kj/init.el
+++ /dev/null
@@ -1,911 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-(setq package-enable-at-startup nil)
-(defvar bootstrap-version)
-(let ((bootstrap-file
- (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
- (bootstrap-version 6))
- (unless (file-exists-p bootstrap-file)
- (with-current-buffer
- (url-retrieve-synchronously
- "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
- 'silent 'inhibit-cookies)
- (goto-char (point-max))
- (eval-print-last-sexp)))
- (load bootstrap-file nil 'nomessage))
-
-(push (expand-file-name "lisp" user-emacs-directory) load-path)
-(require 'kj-lib)
-
-(setq user-full-name "KJ Orbekk"
- user-mail-address "kj@orbekk.com")
-
-(setq startup-time (current-time))
-(setq initial-scratch-message
- (format ";; Emacs startup %s.\n\n"
- (format-time-string "%F %T %z" startup-time)))
-(setq inhibit-startup-message t)
-
-(setq custom-file (expand-file-name "emacs-custom.el" user-emacs-directory))
-(load custom-file :noerror t)
-
-(defalias 'yes-or-no-p 'y-or-n-p)
-
-(straight-use-package 'use-package)
-(use-package straight
- :custom (straight-use-package-by-default t))
-
-(global-hl-line-mode 1)
-(global-auto-revert-mode 1)
-
-(setq visible-bell t
- ring-bell-function 'ignore)
-
-(use-package modus-themes)
-(use-package doom-themes)
-
-(load-theme 'modus-vivendi-tinted)
-(setq alert-default-style 'libnotify)
-
-(custom-theme-set-faces
- 'modus-vivendi-tinted
- '(avy-lead-face ((t :inherit (bold modus-themes-subtle-blue))))
- '(avy-lead-face-0 ((t :inherit (bold modus-themes-subtle-cyan))))
- '(avy-lead-face-1 ((t :inherit (bold modus-themes-subtle-green))))
- '(avy-lead-face-2 ((t :inherit (bold modus-themes-subtle-magenta)))))
-
-(use-package all-the-icons
- :if (display-graphic-p))
-(setq inhibit-compacting-font-caches t)
-(setq use-dialog-box nil)
-(setq display-time-24hr-format t)
-
-(display-battery-mode 1)
-(display-time-mode 1)
-
-(use-package doom-modeline
- :ensure t
- :init (doom-modeline-mode 1)
- :config
- (setq doom-modeline-buffer-encoding 'nondefault))
-
-(use-package emojify
- :bind
- (("C-c C-i C-e" . emojify-insert-emoji))
- :hook (after-init . global-emojify-mode)
- :config
- (emojify-set-emoji-styles '(unicode)))
-
-(setq-default show-trailing-whitespace t)
-(dolist (mode '(calendar-mode-hook
- eshell-mode-hook
- term-mode-hook
- comint-mode-hook
- completion-list-mode))
- (add-hook mode
- (defun kj/disable-trailing-whitespace ()
- (setq show-trailing-whitespace nil))))
-
-;; Deletes trailing whitespace on changed lines only.
-(use-package ws-butler
- :diminish ws-butler-mode
- :hook (prog-mode . ws-butler-mode))
-
-;; `M-x shell` settings
-(setq shell-prompt-pattern "^[^#$%>\n]*[#$%>❯] *"
- explicit-shell-file-name "zsh"
- explicit-zsh-args '("--login" "--interactive"))
-(defun kj/shell-buffer-name ()
- (concat "*shell:" default-directory "*"))
-
-(defun kj/shell-here ()
- (interactive)
- (let ((buffer
- (shell (kj/shell-buffer-name))))
- (with-current-buffer buffer
- (let* ((proc (get-buffer-process (current-buffer)))
- (sentinel (process-sentinel proc)))
- (set-process-sentinel
- proc
- `(lambda (proc signal)
- (funcall ',sentinel proc signal)
- (and (memq (process-status proc) '(exit signal))
- (buffer-live-p (process-buffer proc))
- (message "Shell died, killing buffer %s"
- (process-buffer proc))
- (kill-buffer (process-buffer proc)))))))))
-
-(use-package coterm
- :config
- (coterm-mode 1))
-
-;; Update buffer name to reflect directory.
-(advice-add 'cd :after
- (defun kj/maybe-rename-shell (&rest args)
- (and (derived-mode-p 'shell-mode)
- (rename-buffer
- (kj/shell-buffer-name)))))
-
-(use-package rainbow-delimiters
- :defer t
- :hook (prog-mode . rainbow-delimiters-mode)
- )
-
-(column-number-mode)
-(set-fringe-mode 10)
-(setq next-screen-context-lines 10)
-
-(use-package avy
- :bind
- (("C-c l" . avy-goto-char)
- ("C-c n" . avy-goto-line))
- :config
- (setq avy-keys '(?a ?o ?e ?u ?i ?d ?h ?t ?n ?s))
- (defun avy-action-embark (pt)
- (unwind-protect
- (save-excursion
- (goto-char pt)
- (embark-act))
- (select-window
- (cdr (ring-ref avy-ring 0))))
- t)
-
-(setf (alist-get ?. avy-dispatch-alist) 'avy-action-embark))
-(define-key isearch-mode-map (kbd "M-j") 'avy-isearch)
-
-(winner-mode +1)
-
-(use-package ace-window
- :bind
- (("C-c e" . ace-window))
- :config
- (setq aw-dispatch-always t)
- (setq aw-keys '(?a ?o ?e ?u ?i ?d ?h ?t ?n ?s))
- ;; Make ace window more visible
- ;; (custom-set-faces!
- ;; '(aw-leading-char-face
- ;; :foreground "white" :background "red"
- ;; :weight bold :height 2.5 :box (:line-width 10 :color "red")))
- )
-
-(defun kj/balance-main-window ()
- (balance-windows (window-main-window)))
-
-;; Prefer horizontal splits.
-(setq split-height-threshold 100)
-
-(defun kj/split-window-below ()
- (interactive)
- (split-window-below)
- (kj/balance-main-window)
- (other-window 1))
-
-(defun kj/split-window-right ()
- (interactive)
- (split-window-right)
- (kj/balance-main-window)
- (other-window 1))
-
-(global-set-key (kbd "C-x 3") #'kj/split-window-right)
-(global-set-key (kbd "C-x 2") #'kj/split-window-below)
-
-(use-package vertico
- :init
- (vertico-mode))
-
-;; Rebind C-x?
-(global-set-key (kbd "C-t") 'ctrl-x-map)
-(define-key global-map (kbd "C-t") ctl-x-map)
-;; (define-key key-translation-map "\C-t" "\C-t")
-;; (define-key key-translation-map "\C-x" "\C-t")
-
-(use-package marginalia
- :bind
- (:map minibuffer-local-map
- ("M-n" . marginalia-cycle))
- :init
- (marginalia-mode))
-
-(use-package embark
- :ensure t
-
- :bind
- (("C-." . embark-act)
- ("C-;" . embark-dwim)
- ("C-h C-b" . embark-bindings))
-
- :init
- (setq prefix-help-command #'embark-prefix-help-command)
-
- :config
-
- ;; Hide the mode line of the Embark live/completions buffers
- (add-to-list 'display-buffer-alist
- '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
- .
- (window-parameters (mode-line-format . none)))))
-
-(use-package embark-consult
- :ensure t
- :after (embark consult)
- :demand t
- :hook (embark-mode . consult-preview-at-point-mode))
-
-;; For editing grep buffers.
-(use-package wgrep)
-(use-package deadgrep
- :bind ("M-s g" . deadgrep))
-
-;; For recent files.
-(setq recentf-max-saved-items 1000)
-(setq recentf-auto-cleanup 'never)
-(defun kj/recentf-keep (file)
- (cond
- ((file-remote-p file) t)
- ((file-readable-p file))))
-(setq recentf-keep '(kj/recentf-keep))
-(setq recentf-save-file "~/.cache/emacs-recentf")
-(recentf-mode 1)
-(run-at-time nil (* 5 60) 'recentf-save-list)
-
-(setq global-mark-ring-max 500
- mark-ring-max 16)
-
-;; Example configuration for Consult
-(use-package consult
- ;; Replace bindings. Lazily loaded due by `use-package'.
- :bind (;; C-c bindings (mode-specific-map)
- ("C-c h" . kj/consult-history)
- ;;("C-c m" . consult-mode-command)
- ("C-c k" . consult-kmacro)
- ;; C-x bindings (ctl-x-map)
- ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
- ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
- ("C-x C-b" . consult-buffer) ;; orig. switch-to-buffer
- ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
- ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
- ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
- ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
- ("C-c f r" . consult-recent-file)
- ;; Custom M-# bindings for fast register access
- ("M-#" . consult-register-load)
- ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
- ("C-M-#" . consult-register)
- ;; Other custom bindings
- ("M-y" . consult-yank-pop) ;; orig. yank-pop
- ("<help> a" . consult-apropos) ;; orig. apropos-command
- ;; M-g bindings (goto-map)
- ("M-g e" . consult-compile-error)
- ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
- ("M-g g" . consult-goto-line) ;; orig. goto-line
- ("M-g M-g" . consult-goto-line) ;; orig. goto-line
- ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
- ("M-g m" . consult-mark)
- ("M-g k" . consult-global-mark)
- ("M-g i" . consult-imenu)
- ("M-g I" . consult-imenu-multi)
- ;; M-s bindings (search-map)
- ("M-s d" . consult-find)
- ("M-s D" . consult-locate)
- ;; ("M-s g" . consult-grep)
- ("M-s G" . consult-git-grep)
- ("M-s r" . consult-ripgrep)
- ("M-s l" . consult-line)
- ("M-s L" . consult-line-multi)
- ("M-s m" . consult-multi-occur)
- ("M-s k" . consult-keep-lines)
- ("M-s u" . consult-focus-lines)
- ;; Isearch integration
- ("M-s e" . consult-isearch-history)
- :map isearch-mode-map
- ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
- ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
- ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
- ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
- ;; Minibuffer history
- :map minibuffer-local-map
- ("M-s" . kj/consult-history) ;; orig. next-matching-history-element
- ("M-r" . kj/consult-history)) ;; orig. previous-matching-history-element
-
- ;; Enable automatic preview at point in the *Completions* buffer. This is
- ;; relevant when you use the default completion UI.
- ;; :hook (completion-list-mode . consult-preview-at-point-mode)
-
- ;; The :init configuration is always executed (Not lazy)
- :init
-
- ;; Optionally configure the register formatting. This improves the register
- ;; preview for `consult-register', `consult-register-load',
- ;; `consult-register-store' and the Emacs built-ins.
- (setq register-preview-delay 0.5
- register-preview-function #'consult-register-format)
-
- ;; Optionally tweak the register preview window.
- ;; This adds thin lines, sorting and hides the mode line of the window.
- (advice-add #'register-preview :override #'consult-register-window)
-
- ;; Use Consult to select xref locations with preview
- (setq xref-show-xrefs-function #'consult-xref
- xref-show-definitions-function #'consult-xref)
-
- ;; Configure other variables and modes in the :config section,
- ;; after lazily loading the package.
- :config
-
- ;; Use consult for completion.
- (setq completion-in-region-function #'consult-completion-in-region)
-
- ;; Optionally configure preview. The default value
- ;; is 'any, such that any key triggers the preview.
- (setq consult-preview-key '(:debounce 0.3 any))
- ;; (setq consult-preview-key (kbd "M-."))
- ;; (setq consult-preview-key (list (kbd "<S-down>") (kbd "<S-up>")))
- ;; For some commands and buffer sources it is useful to configure the
- ;; :preview-key on a per-command basis using the `consult-customize' macro.
- ;; (consult-customize
- ;; consult-theme
- ;; :preview-key '(:debounce 0.2 any)
- ;; consult-ripgrep consult-git-grep consult-grep
- ;; consult-bookmark consult-recent-file consult-xref
- ;; consult--source-bookmark consult--source-recent-file
- ;; consult--source-project-recent-file
- ;; :preview-key (kbd "M-."))
-
- ;; Optionally configure the narrowing key.
- ;; Both < and C-+ work reasonably well.
- (setq consult-narrow-key "<") ;; (kbd "C-+")
-
- (setq consult-ripgrep-args
- "rg --null --line-buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --with-filename --line-number --search-zip --hidden")
-
- ;; Optionally make narrowing help available in the minibuffer.
- ;; You may want to use `embark-prefix-help-command' or which-key instead.
- ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
-
- ;; By default `consult-project-function' uses `project-root' from project.el.
- ;; Optionally configure a different project root function.
- ;; There are multiple reasonable alternatives to chose from.
- ;;;; 1. project.el (the default)
- ;;(setq consult-project-function #'consult--default-project-function)
- ;;;; 2. projectile.el (projectile-project-root)
- (autoload 'projectile-project-root "projectile")
- (setq consult-project-function (lambda (_) (projectile-project-root)))
- ;;;; 3. vc.el (vc-root-dir)
- ;; (setq consult-project-function (lambda (_) (vc-root-dir)))
- ;;;; 4. locate-dominating-file
- ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git")))
- )
-
-(use-package orderless
- :init
- (setq completion-styles '(orderless basic)
- completion-category-defaults nil
- completion-category-overrides '((file (styles partial-completion)))))
-
-(use-package which-key
- :init
- (which-key-mode))
-
-;; This is needed to fix an issue with magit transient dependencies.
-(use-package transient)
-(use-package magit)
-
-(use-package mixed-pitch
- :hook
- (text-mode . mixed-pitch-mode)
- (org-mode . mixed-pitch-mode)
- )
-
-(when (string= (system-name) "fedora")
- (setenv "SSH_AUTH_SOCK" (s-trim (shell-command-to-string "gpgconf --list-dirs agent-ssh-socket"))))
-
-(setq kj/font-height
- (cond ((string= (system-name) "fedora") 100)
- (t 150)))
-
-(custom-set-faces
- `(variable-pitch ((t (:family "Noto Serif" :height ,kj/font-height))))
- `(default ((t (:family "Iosevka" :height ,kj/font-height)))))
-
-;; (unless (equal system-name "minideck")
-;; (set-face-attribute 'fixed-pitch nil :font "Iosevka" :height 150)
-;; (set-face-attribute 'variable-pitch nil :font "Noto Serif"))
-
-;;; Compilation settings
-(setq compilation-ask-about-save nil)
-(setq compilation-scroll-output 'first-error)
-;; Allow longer output in compilation buffer.
-(add-to-list 'compilation-filter-hook #'comint-truncate-buffer)
-(setq comint-buffer-maximum-size 10000)
-
-(use-package ob-async)
-
-(use-package direnv
- :config
- (setq direnv-always-show-summary nil)
- (direnv-mode))
-
-(use-package projectile
- :ensure t
- :init
- (projectile-mode +1)
- :bind (:map projectile-mode-map
- ("C-x p" . projectile-command-map)))
-
-(use-package emacs
- :init
- (setq ediff-diff-options "-w" ; turn off whitespace checking
- ediff-split-window-function #'split-window-horizontally
- ediff-window-setup-function #'ediff-setup-windows-plain))
-
-(use-package anzu
- :config
- (global-anzu-mode +1)
- (global-set-key [remap query-replace] 'anzu-query-replace)
- (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp))
-
-(defun meow-setup ()
- (setq meow-replace-state-name-list
- '((normal . "N")
- (motion . "M")
- (keypad . "🖩")
- (insert . "I")
- (beacon . "📻")))
- (setq meow-cheatsheet-layout meow-cheatsheet-layout-dvorak)
- (meow-leader-define-key
- '("1" . meow-digit-argument)
- '("2" . meow-digit-argument)
- '("3" . meow-digit-argument)
- '("4" . meow-digit-argument)
- '("5" . meow-digit-argument)
- '("6" . meow-digit-argument)
- '("7" . meow-digit-argument)
- '("8" . meow-digit-argument)
- '("9" . meow-digit-argument)
- '("0" . meow-digit-argument)
- '("/" . meow-keypad-describe-key)
- '("?" . meow-cheatsheet)
- '("b" . consult-buffer)
- ;;'("p" . projectile-command-map)
- )
- (meow-motion-overwrite-define-key
- ;; custom keybinding for motion state
- '("<escape>" . ignore))
- (meow-normal-define-key
- '("0" . meow-expand-0)
- '("9" . meow-expand-9)
- '("8" . meow-expand-8)
- '("7" . meow-expand-7)
- '("6" . meow-expand-6)
- '("5" . meow-expand-5)
- '("4" . meow-expand-4)
- '("3" . meow-expand-3)
- '("2" . meow-expand-2)
- '("1" . meow-expand-1)
- '("-" . negative-argument)
- '(";" . meow-reverse)
- '("," . meow-inner-of-thing)
- '("." . meow-bounds-of-thing)
- '("@" . er/expand-region)
- '("<" . meow-beginning-of-thing)
- '(">" . meow-end-of-thing)
- '("a" . meow-append)
- '("A" . meow-open-below)
- '("b" . meow-back-word)
- '("B" . meow-back-symbol)
- '("c" . meow-change)
- '("d" . meow-delete)
- '("D" . meow-backward-delete)
- '("e" . meow-line)
- '("E" . meow-goto-line)
- '("f" . meow-find)
- '("g" . meow-cancel-selection)
- '("G" . meow-grab)
- '("h" . meow-left)
- '("H" . meow-left-expand)
- '("i" . meow-insert)
- '("I" . meow-open-above)
- '("j" . meow-join)
- '("k" . meow-kill)
- '("l" . meow-till)
- '("m" . meow-mark-word)
- '("M" . meow-mark-symbol)
- '("n" . meow-next)
- '("N" . meow-next-expand)
- '("o" . meow-block)
- '("O" . meow-to-block)
- '("p" . meow-prev)
- '("P" . meow-prev-expand)
- '("q" . meow-quit)
- '("Q" . meow-goto-line)
- '("r" . meow-replace)
- '("R" . meow-swap-grab)
- '("s" . meow-search)
- '("/" . isearch-forward)
- '("?" . isearch-backward)
- '("t" . meow-right)
- '("T" . meow-right-expand)
- '("u" . meow-undo)
- '("U" . meow-undo-in-selection)
- '("v" . meow-visit)
- '("w" . meow-next-word)
- '("W" . meow-next-symbol)
- '("x" . meow-save)
- '("X" . meow-sync-grab)
- '("y" . meow-yank)
- '("z" . meow-pop-selection)
- '("P" . (lambda () (interactive) (forward-line -10)))
- '("N" . (lambda () (interactive) (forward-line 10)))
- '("'" . repeat)
- '("<escape>" . ignore))
-
- (add-hook 'git-commit-mode-hook #'meow-insert))
-
-;; (use-package meow
-;; :bind
-;; :config
-;; (meow-setup)
-;; (meow-global-mode 1)
-;; ;; (meow-setup-indicator) ; Not needed with doom-modeline.
-;; (setq meow-use-clipboard t)
-;; ;; (add-to-list 'meow-keypad-start-keys '(?t . ?x))
-;; ;; (add-to-list 'meow-keypad-start-keys '(?x . ?t))
-;; (define-key meow-insert-state-keymap "\C-[" #'meow-insert-exit)
-;; )
-
-(use-package emacs
- :hook (dired-mode . dired-omit-mode)
- :init
- (setq dired-dwim-target t ; suggest a target for moving/copying intelligently
- dired-hide-details-hide-symlink-targets nil
- ;; don't prompt to revert, just do it
- dired-auto-revert-buffer #'dired-buffer-stale-p
- ;; Always copy/delete recursively
- dired-recursive-copies 'always
- dired-recursive-deletes 'top
- ;; Ask whether destination dirs should get created when copying/removing files.
- dired-create-destination-dirs 'ask))
-
-;; (use-package dirvish
-;; :init
-;; (setq dirvish-hide-details nil)
-;; (dirvish-override-dired-mode))
-
-(use-package diredfl
- :hook (dired-mode . diredfl-mode))
-
-;; Tramp settings
-(setq tramp-use-ssh-controlmaster-options nil
- tramp-default-method "ssh")
-;; Need 'eval-after-load' of 'tramp-sh' here because nixos has a
-;; startup file that messes with this variable.
-(with-eval-after-load 'tramp-sh
- (add-to-list 'tramp-remote-path 'tramp-own-remote-path))
-
-(setq math-additional-units
- '((ZiB "1024 * EiB" "Zebibyte")
- (EiB "1024 * PiB" "Exbibyte")
- (PiB "1024 * TiB" "Pebibyte")
- (TiB "1024 * GiB" "Tebibyte")
- (GiB "1024 * MiB" "Gibibyte")
- (MiB "1024 * KiB" "Mebibyte")
- (KiB "1024 * B" "Kibibyte")
- (B nil "Byte")
- (Zib "1024 * ZiB" "Zebibit")
- (Eib "1024 * PiB" "Exbibit")
- (Pib "1024 * TiB" "Pebibit")
- (Tib "1024 * GiB" "Tebibit")
- (Gib "1024 * Mib" "Gibibit")
- (Mib "1024 * Kib" "Mebibit")
- (Kib "1024 * b" "Kibibit")
- (b "B / 8" "Bit")))
-
-
-;; Low menu delay.
-(setq which-key-idle-delay .5)
-
-;; Replace values in an alist from a list of replacements.
-;;
-;; Example:
-;; (kj/assq-replace '((:a . 1)) '((:a . 2)))
-(defun kj/assq-replace (replacements alist)
- (let ((replace1 (lambda (aelem alist)
- (cons aelem (assq-delete-all (car aelem) alist)))))
- (if replacements
- (kj/assq-replace (cdr replacements)
- (funcall replace1 (car replacements) alist))
- alist)))
-
-
-(use-package idle-highlight-mode
- :config
- (setq idle-highlight-idle-time 0.2)
- (set-face-attribute 'idle-highlight nil :inherit 'underline)
- :hook ((prog-mode text-mode) . idle-highlight-mode))
-
-(defun kj/smartparens-config ()
- (require 'smartparens-config)
- (bind-keys :map smartparens-mode-map
- ("C-M-a" . sp-beginning-of-sexp)
- ("C-M-e" . sp-end-of-sexp)
-
- ("C-<down>" . sp-down-sexp)
- ("C-<up>" . sp-up-sexp)
- ("M-<down>" . sp-backward-down-sexp)
- ("M-<up>" . sp-backward-up-sexp)
-
- ("C-M-f" . sp-forward-sexp)
- ("C-M-b" . sp-backward-sexp)
-
- ("C-M-n" . sp-next-sexp)
- ("C-M-p" . sp-previous-sexp)
-
- ("C-S-f" . sp-forward-symbol)
- ("C-S-b" . sp-backward-symbol)
-
- ("C-<right>" . sp-forward-slurp-sexp)
- ("M-<right>" . sp-forward-barf-sexp)
- ("C-<left>" . sp-backward-slurp-sexp)
- ("M-<left>" . sp-backward-barf-sexp)
-
- ("C-M-t" . sp-transpose-sexp)
- ("C-M-k" . sp-kill-sexp)
- ("C-k" . sp-kill-hybrid-sexp)
- ("C-M-w" . sp-copy-sexp)
- ("C-M-d" . delete-sexp)
-
- ("M-<backspace>" . backward-kill-word)
- ("C-<backspace>" . sp-backward-kill-word)
- ([remap sp-backward-kill-word] . backward-kill-word)
-
- ("M-[" . sp-backward-unwrap-sexp)
- ("M-]" . sp-unwrap-sexp)
-
- ("C-x C-t" . sp-transpose-hybrid-sexp)
-
- ("C-c (" . wrap-with-parens)
- ("C-c [" . wrap-with-brackets)
- ("C-c {" . wrap-with-braces)
- ("C-c '" . wrap-with-single-quotes)
- ("C-c \"" . wrap-with-double-quotes)
- ("C-c _" . wrap-with-underscores)
- ("C-c `" . wrap-with-back-quotes)
-
- ("M-k" . sp-raise-sexp)
- ("M-S" . sp-split-sexp)
- ("M-I" . sp-splice-sexp))
- )
-
-(use-package smartparens
- :init
- (kj/smartparens-config)
- :hook ((prog-mode lisp-mode) . smartparens-strict-mode)
- )
-
-;; (use-package paredit
-;; :hook ((lisp-mode emacs-lisp-mode) . paredit-mode)
-;; :bind (:map paredit-mode-map
-;; ("M-k" . paredit-raise-sexp)
-;; ("M-I" . paredit-splice-sexp))
-;; :hook (paredit-mode
-;; . (lambda ()
-;; (unbind-key "M-r" paredit-mode-map)
-;; (unbind-key "M-s" paredit-mode-map))))
-
-(define-key isearch-mode-map (kbd "C-RET")
- #'isearch-exit-other-end)
-;; Why does C-RET not always work?
-(define-key isearch-mode-map (kbd "C-<return>")
- #'isearch-exit-other-end)
-(defun isearch-exit-other-end ()
- "Exit isearch, at the opposite end of the string."
- (interactive)
- (isearch-exit)
- (goto-char isearch-other-end))
-(define-key isearch-mode-map (kbd "M-z")
- #'kj/isearch-zap)
-(defun kj/isearch-zap ()
- "Zap to beginning of search"
- (interactive)
- (isearch-exit)
- (goto-char isearch-other-end)
- (kill-region (region-beginning) (region-end)))
-
-(setq case-fold-search t)
-(setq case-replace t)
-
-(use-package expand-region
- :bind (("C-@" . #'er/expand-region)))
-
-(use-package multiple-cursors)
-
-(use-package ace-mc
- :bind (:map kj/leader-map
- ("h" . ace-mc-add-multiple-cursors)
- ("M-h" . ace-mc-add-single-cursor)))
-
-;; Disable VC over tramp.
-;;(setq-default vc-handled-backends nil)
-(defun kj/vc-off-if-remote ()
- (if (file-remote-p (buffer-file-name))
- (setq-local vc-handled-backends nil)))
-(add-hook 'find-file-hook 'kj/vc-off-if-remote)
-
-(use-package selected
- :demand t
- :diminish selected-minor-mode
- :bind (:map selected-keymap
- ("[" . align-code)
- ("f" . fill-region)
- ("U" . unfill-region)
- ("d" . downcase-region)
- ("r" . reverse-region)
- ("S" . sort-lines))
- :config
- (selected-global-mode 1))
-
-(setq kj/some-lines 6)
-(defun kj/forward-some-lines ()
- (interactive)
- (forward-line kj/some-lines))
-(defun kj/previous-some-lines ()
- (interactive)
- (previous-line kj/some-lines))
-
-;; Repeat commands (e.g., C-x o o o)
-(repeat-mode 1)
-
-;; Disable the built-in repeat-mode hinting
-;;(setq repeat-echo-function #'ignore)
-
-;; Spawn or hide a which-key popup
-;; (advice-add 'repeat-post-hook :after
-;; (defun repeat-help--which-key-popup ()
-;; (if-let ((cmd (or this-command real-this-command))
-;; (keymap (or repeat-map
-;; (repeat--command-property 'repeat-map))))
-;; (run-at-time
-;; 0 nil
-;; (lambda ()
-;; (which-key--create-buffer-and-show
-;; nil (symbol-value keymap))))
-;; (which-key--hide-popup))))
-
-;; Calendar settings.
-(setq calendar-week-start-day 1)
-;; Show calendar week numbers.
-(copy-face font-lock-constant-face 'calendar-iso-week-face)
-(set-face-attribute 'calendar-iso-week-face nil
- :height 0.7)
-(setq calendar-intermonth-text
- '(propertize
- (format "%2d"
- (car
- (calendar-iso-from-absolute
- (calendar-absolute-from-gregorian (list month day year)))))
- 'font-lock-face 'calendar-iso-week-face))
-
-;; (setq ispell-local-dictionary "en_US")
-;; (add-hook 'text-mode-hook flyspell-mode)
-;; (add-hook 'prog-mode-hook flyspell-prog-mode)
-
-;; Enabled commands
-(put 'narrow-to-region 'disabled nil)
-(put 'downcase-region 'disabled nil)
-(put 'upcase-region 'disabled nil)
-
-(defun kj/modules (module-directory)
- (cl-loop for path in (f-files module-directory)
- if (string-match "\\([^/]*\\).el" path)
- collect (intern (match-string 1 path))))
-
-(dolist (module (kj/modules
- (expand-file-name "lisp" user-emacs-directory)))
- (require module))
-
-(use-package embark
- :config
-
- ;; Experimental
- (defun find-file-keeping-default-directory (filename)
- (let ((dir default-directory))
- (with-current-buffer (find-file filename)
- (setq default-directory dir))))
- (define-key embark-file-map "@" 'find-file-keeping-default-directory))
-
-;; Restore gc.
-(setq gc-cons-threshold (* 16 1024 1024))
-
-;; (use-package devil
-;; :config
-;; (global-devil-mode))
-
-;;; Email settings
-(setq message-kill-buffer-on-exit t) ;; After sending a message.
-
-(let ((google-config-file
- (expand-file-name "google.el" user-emacs-directory)))
- (when (file-exists-p google-config-file)
- (load-file google-config-file)))
-
-;; Special symbols
-(use-package emacs
- :defer 1
- :config
- (defvar kj/iso-transl-char-map
- '(
- ;; fractions that emacs doesn't include
- ("1/3" . [?⅓])
- ("1/5" . [?⅕])
- ("1/6" . [?⅙])
- ("1/7" . [?⅐])
- ("1/8" . [?⅛])
- ("1/9" . [?⅑])
- ("1/10" . [?⅒])
- ("2/3" . [?⅔])
- ("2/5" . [?⅖])
- ("3/5" . [?⅗])
- ("3/8" . [?⅜])
- ("4/5" . [?⅘])
- ("5/6" . [?⅚])
- ("5/8" . [?⅝])
- ("7/8" . [?⅞])
- ;; add the emojis I commonly use
- (":c" . [?✅])
- (":u" . [?👍])
- (":d" . [?👎])
- (":w" . [?🖐])
- ;; card suits
- ("c" . [?♣])
- ("h" . [?♥])
- ("d" . [?♦])
- ("s" . [?♠])))
- (require 'iso-transl)
- (iso-transl-define-keys kj/iso-transl-char-map)
- :init
- (require 'iso-transl))
-
-(use-package pcre2el)
-(use-package pdf-tools)
-
-(defvar kj/help-modes '(helpful-mode
- help-mode
- shortdoc-mode
- Man-mode
- woman-mode
- Info-mode))
-
-(defun kj/buffer-help-p (buf act)
- "BUF is a help buffer, ignore ACT."
- (member (buffer-local-value 'major-mode (get-buffer buf)) kj/help-modes))
-
-(add-to-list 'display-buffer-alist
- `(kj/help-modes ;predicate
- (display-buffer-reuse-window
- display-buffer-reuse-mode-window) ;functions to try
- (mode . ,kj/help-modes)
- (inhibit-same-window . nil)))
-
-(use-package helpful
- :bind
- (([remap describe-key] . 'helpful-key)
- ([remap describe-variable] . 'helpful-variable)
- ([remap describe-symbol] . 'helpful-symbol)
- ([remap describe-command] . 'helpful-command)
- ([remap describe-function] . 'helpful-callable)))
-
-;;; Picking a specific eglot action.
-;; (defun my-replace-with-deduced-type (beg)
-;; (interactive "*d")
-;; (eglot-server-capable-or-lose :codeActionProvider)
-;; (let* ((server (eglot--current-server-or-lose))
-;; (action-title "Replace with deduced type")
-;; (available-actions (eglot-code-actions beg))
-;; (action (seq-find (lambda (a)
-;; (equal (plist-get a :title) action-title))
-;; available-actions)))
-;; (unless action
-;; (error "Could not find '%s': %s" action-title available-actions))
-;; (eglot-execute server action)))
-
-;;(transient-insert-suffix 'magit-dispatch "J"
-;; `("k" "KJ" kj/my-test))