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.el~337
1 files changed, 337 insertions, 0 deletions
diff --git a/emacs/.config/emacs-kj/init.el~ b/emacs/.config/emacs-kj/init.el~
new file mode 100644
index 0000000..93668a0
--- /dev/null
+++ b/emacs/.config/emacs-kj/init.el~
@@ -0,0 +1,337 @@
+;;; -*- lexical-binding: t; -*-
+(setq straight-check-for-modifications 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))
+
+(defalias 'yes-or-no-p 'y-or-n-p)
+
+(straight-use-package 'use-package)
+(use-package straight
+ :custom (straight-use-package-by-default t))
+
+(set-frame-font "Iosevka-18")
+
+;; Modus theme setup.
+(use-package emacs
+ :init
+ ;; Add all your customizations prior to loading the themes
+ (setq modus-themes-region '(bg-only))
+ :config
+ ;; Load the theme of your choice:
+ (load-theme 'modus-operandi) ;; OR (load-theme 'modus-vivendi)
+ :bind ("<f5>" . modus-themes-toggle))
+
+(when window-system
+ (tool-bar-mode -1)
+ (scroll-bar-mode -1)
+ (tooltip-mode -1)
+ (menu-bar-mode -1))
+
+(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))
+ )
+
+(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)) ;; dvorak moment
+ )
+
+(use-package selectrum
+ :init
+ (selectrum-mode +1))
+
+(define-key key-translation-map "\C-u" "\C-x")
+(define-key key-translation-map "\C-x" "\C-u")
+
+(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\\)\\*"
+ nil
+ (window-parameters (mode-line-format . none)))))
+
+(use-package embark-consult
+ :ensure t
+ :after (embark consult)
+ :demand t
+ :hook (embark-mode-hook . consult-preview-at-point-mode))
+
+;; For editing grep buffers.
+(use-package wgrep)
+
+;; For recent files.
+(recentf-mode 1)
+(run-at-time nil (* 5 60) 'recentf-save-list)
+
+(use-package projectile
+ :init
+ (projectile-global-mode))
+
+;; 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" . 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" . consult-history) ;; orig. next-matching-history-element
+ ("M-r" . 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
+
+ ;; Optionally configure preview. The default value
+ ;; is 'any, such that any key triggers the preview.
+ ;; (setq consult-preview-key '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-+")
+
+ ;; 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
+ :ensure t
+ :custom
+ (completion-styles '(orderless basic))
+ (completion-category-overrides '((file (styles basic partial-completion)))))
+
+(use-package which-key
+ :init
+ (which-key-mode))
+
+(use-package magit)
+(use-package org)
+
+(defun meow-setup ()
+ (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)
+ '("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)
+ '("<" . 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)))
+
+(use-package meow
+ :bind
+ :config
+ (meow-setup)
+ (meow-global-mode 1)
+ (setq meow-use-clipboard t)
+ (add-to-list 'meow-keypad-start-keys '(?u . ?x))
+ (add-to-list 'meow-keypad-start-keys '(?x . ?u))
+ (define-key meow-insert-state-keymap "\C-[" #'meow-insert-exit)
+ )