diff options
Diffstat (limited to '.config/emacs')
-rw-r--r-- | .config/emacs/init.el | 216 |
1 files changed, 113 insertions, 103 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 139b5e5..8541850 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -45,8 +45,8 @@ (custom-set-faces (if is-hermes '(default ((t (:inherit nil :height 130 :family "Fira Mono")))) '(default ((t (:inherit nil :height 160 :family "Fira Mono"))))) - '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile")))) - '(variable-pitch ((t (:inherit t :family "Fira Mono" :height 130))))) + '(org-modern-symbol ((t (:inherit t :family "Iosevka")))) + '(italic ((t (:inherit t :family "Iosevka"))))) ;; Autoinsert (auto-insert-mode 1) @@ -432,18 +432,6 @@ (unless (file-exists-p "~/Notes") (make-directory "~/Notes")) -;; (use-package org-roam -;; :vc (:url "https://github.com/org-roam/org-roam")) - -;; (use-package org-roam-ui -;; :vc (:url "https://github.com/org-roam/org-roam-ui") -;; :after org-roam -;; :config -;; (setq org-roam-ui-sync-theme t -;; org-roam-ui-follow t -;; org-roam-ui-update-on-save t -;; org-roam-ui-open-on-start t)) - (unless (or is-phone is-uranus) (use-package modus-themes :ensure t @@ -454,12 +442,11 @@ modus-themes-variable-pitch-ui nil modus-themes-custom-auto-reload t modus-themes-disable-other-themes t - modus-themes-prompts '(italic) + modus-themes-prompts '(semibold italic) modus-themes-completions '((matches . (underline)) - (selection . (semibold italic text-also underline))) - modus-themes-org-blocks 'tinted-background) + (selection . (semibold text-also underline)))) ;; Palette overrides - (setf modus-themes-common-palette-overrides + (setf modus-vivendi-palette-overrides '((fg-line-number-active cyan-intense) ;; (bg-main "#1d2021") ;;grubox-hard ;; (bg-main "#191919") ;; 1337 @@ -477,15 +464,15 @@ (underline-err red-intense) (underline-warning yellow-faint) (underline-note cyan-faint) - ;; (string "#86B187") + (string olive) (border-mode-line-active unspecified) (border-mode-line-inactive unspecified) (bg-mode-line-active "#433F4f") ;; subtle lavender (bg-mode-line-inactive "#1D1D1D") - ;; set fg from badger theme + ;; Set fg from badger theme (fg-mode-line-active "#F6F3E8") (bg-hl-line bg-dim) - (cursor slate) + (cursor indigo) (prose-todo green-intense) (prose-done bg-term-white) (fg-prompt yellow-faint) @@ -494,7 +481,7 @@ (setf modus-themes-headings '((1 . (ultrabold 1.35)) (2 . (semibold 1.2)) - (agenda-date . (1.3)) + (agenda-date . (1.2)) (agenda-structure . (variable-pitch light 1.8)) (t . (1.15)))) ;; Load modus @@ -563,24 +550,22 @@ "Edit current commit message" (interactive) (vc-checkin nil 'git nil nil nil "") - (vc-git-log-edit-toggle-amend))) + (vc-git-log-edit-toggle-amend)) -;; (use-package corfu -;; :ensure t -;; :config -;; (global-corfu-mode) -;; (corfu-popupinfo-mode) -;; (setf corfu-auto t -;; corfu-auto-delay 0.1 -;; corfu-auto-prefix 2 -;; corfu-cycle t -;; corfu-popupinfo-delay 0.3 -;; corfu-quit-at-boundary 'separator -;; corfu-quit-no-match t -;; corfu-preselect 'first -;; corfu-preview-current t -;; corfu-echo-mode t) -;; (setf indent-tabs-mode nil)) + (defun thanos/vc-git-branch () + "Select git branch" + (let ((branch (completing-read "Select branch: " (vc-git-branches) nil t))) + branch)) + + (defun vc-git-delete-branch () + "Select & delete git branch." + (interactive) + (let ((branch (thanos/vc-git-branch))) + (vc-git-command nil 0 nil "branch" "-D" branch) + (message "Branch `%s' deleted." branch))) + :bind (:map + vc-prefix-map + ("b d" . 'vc-git-delete-branch))) (when (or is-phone is-uranus) (use-package corfu-terminal)) @@ -609,13 +594,6 @@ :config (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) -(use-package eshell-syntax-highlighting - :vc (:url "https://github.com/akreisher/eshell-syntax-highlighting") - :ensure t - :after eshell - :config - (eshell-syntax-highlighting-global-mode 1)) - (use-package flycheck :ensure t :config @@ -627,29 +605,50 @@ :config (setf eshell-visual-commands nil eat-term-name "xterm-256color") - :bind (("C-c v" . eat)) + :bind (("C-c V" . eat)) :hook ((eshell-mode . eat-eshell-mode) - (eshell-mode . eat-eshell-visual-command-mode))) + (eshell-mode . eat-eshell-visual-command-mode) + (eat-mode . (lambda () (visual-line-mode -1))))) (use-package shell :ensure t - :bind (("C-c V" . shell) + :config + (defun thanos/shell (n) + "Create or switch to a shell buffer." + (interactive "P") + (let* ((num (if n (prefix-numeric-value n) nil)) + (buf-name (if num + (format "*shell<%d>*" num) + "*shell*"))) + (shell buf-name))) + :bind (("C-c v" . thanos/shell) :map shell-mode-map ("C-l" . 'comint-clear-buffer)) :hook ((shell-mode . (lambda () (display-line-numbers-mode -1))))) (defvar thanos/aliases - '((d . dired) - (o . find-file) - (oo . find-file-other-window) - (ll . (lambda () (eshell/ls '-lha))) - (eshell/clear . eshell/clear-scrollback))) + '((ll . "ls -lah") + (clear . clear-scrollback))) (defun thanos/set-eshell-aliases (aliases) "Set ALIASES as eshell aliases." + ;; Remove aliases file + (when (and eshell-aliases-file + (file-exists-p eshell-aliases-file)) + (delete-file eshell-aliases-file)) (mapc (lambda (alias) - (defalias (car alias) (cdr alias))) - aliases)) + (let ((name (symbol-name (car alias))) + (command (cdr alias))) + (eshell/alias name + (cond + ((stringp command) command) + ((symbolp command) (symbol-name command)) + (t (error "Unsupported alias command type")))))) + aliases)) + +(defun eshell/o (file) + "Open FILE." + (find-file file)) (defun thanos/eshell-clear () "Interactive call for clear-scrollback." @@ -661,52 +660,47 @@ (completion-preview-insert) (delete-char -1)) -(use-package eshell - :ensure t +(use-package esh-mode + :ensure nil :config - (setf eshell-highlight-prompt t) + (defun eshell-git-info () + "Return a string with git info." + (when (eq (call-process "git" nil nil nil "rev-parse" "--is-inside-work-tree") 0) + (let* ((branch-raw (shell-command-to-string "git rev-parse --abbrev-ref HEAD")) + (branch (if (or (string-match-p "^fatal" branch-raw) + (string-match-p "^error" branch-raw)) + "Unknown" + (string-trim branch-raw))) + (dirty (not (string= "" (string-trim (shell-command-to-string "git status --porcelain"))))) + (dirty-info (if dirty " ✎" " ✔"))) + (concat (propertize "⎇ " 'face 'modus-themes-fg-green-warmer) + (propertize branch 'face 'modus-themes-fg-magenta-warmer) + (propertize dirty-info 'face (if dirty 'modus-themes-fg-red 'modus-themes-fg-green)))))) + + (defun eshell-prompt-multiline () + "Eshell Git prompt inspired by spaceship-prompt." + (let ((separator (propertize " | " 'face 'font-lock-comment-face)) + (hr (propertize (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'face 'font-lock-comment-face)) + (dir (propertize (format "%s" (abbreviate-file-name (eshell/pwd))) 'face 'modus-themes-fg-yellow-warmer)) + (git-info (eshell-git-info)) + (time (propertize (format-time-string "%H:%M:%S") 'face 'font-lock-comment-face)) + (sign (if (= (user-uid) 0) + (propertize "\n#" 'face 'modus-themes-fg-blue-intense) + (propertize "\nλ" 'face 'modus-themes-fg-red-warmer)))) + ;; Build prompt + (concat hr dir separator git-info separator time sign " "))) + + (setf eshell-prompt-function 'eshell-prompt-multiline + eshell-highlight-prompt nil) :bind (("C-c e" . eshell) :map eshell-mode-map ("C-l" . 'thanos/eshell-clear) - ("<tab>" . 'thanos/eshell-preview-insert)) + ("<tab>" . 'thanos/eshell-preview-insert) + ("C-M-i" . 'completion-at-point)) :hook ((eshell-mode . (lambda () (thanos/set-eshell-aliases thanos/aliases) - (display-line-numbers-mode -1))))) - -(use-package eshell-git-prompt - :vc (:url "https://github.com/xuchunyang/eshell-git-prompt") - :ensure t - :config - (defun eshell-git-prompt-multiline () - "Eshell Git prompt inspired by spaceship-prompt." - (let (separator hr dir git git-dirty time sign command) - (setq separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face)) - (setq hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face)) - (setq dir - (concat - (with-face "" 'eshell-git-prompt-directory-face) - (concat (abbreviate-file-name (eshell/pwd))))) - (setq git - (concat (with-face "⎇" 'eshell-git-prompt-exit-success-face) - (concat (eshell-git-prompt--branch-name)))) - (setq git-dirty - (when (eshell-git-prompt--branch-name) - (if (eshell-git-prompt--collect-status) - (with-face " ✎" 'eshell-git-prompt-modified-face) - (with-face " ✔" 'eshell-git-prompt-exit-success-face)))) - (setq time (with-face (format-time-string "%I:%M:%S %p") - 'eshell-git-prompt-multiline-secondary-face)) - (setq sign - (if (= (user-uid) 0) - (with-face "\n#" 'eshell-git-prompt-multiline-sign-face) - (with-face "\nλ" 'eshell-git-prompt-multiline-sign-face))) - (setq command (with-face " " 'eshell-git-prompt-multiline-command-face)) - - ;; Build prompt - (eshell-git-prompt---str-read-only - (concat hr dir separator git git-dirty separator time sign command)))) - - (eshell-git-prompt-use-theme 'multiline)) + (display-line-numbers-mode -1) + (eshell-cmpl-mode -1))))) ;; Password-store (use-package password-store @@ -722,8 +716,6 @@ ("c" . 'password-store-copy) ("s" . 'smtp-get-pass))) -;; Chat - (use-package erc :ensure t :config @@ -832,7 +824,7 @@ '((:deck "Bulgarian" (:amnesia 0.55 :proto (0 1 3))) (:deck "Unking" (:amnesia 0.45)) (:tag "vocabulary" (:amnesia 0.65 :proto (0 1 3))))) - :bind (("C-M-r" . 'thanos/gnosis-map) + :bind (("C-c SPC" . 'thanos/gnosis-map) :map thanos/gnosis-map ("a" . 'gnosis-add-note) ("d" . 'gnosis-dashboard))) @@ -841,9 +833,7 @@ (gnosis-vc-pull) (use-package org-gnosis - :vc t :load-path "~/Dev/emacs-lisp/org-gnosis" - :ensure t :init (define-prefix-command 'thanos/notes-map) (define-prefix-command 'thanos/journal-map) @@ -859,11 +849,13 @@ (interactive) (let ((org-link-frame-setup '((file . find-file)))) (org-open-at-point))) + :bind (("C-c n" . thanos/notes-map) ("C-c j" . thanos/journal-map) :map thanos/notes-map ("f" . org-gnosis-find) ("i" . org-gnosis-insert) + ("t" . org-gnosis-find-by-tag) :map thanos/journal-map ("j" . org-gnosis-journal) ("f" . org-gnosis-journal-find) @@ -873,6 +865,24 @@ ("C-c i" . org-id-get-create) ("C-c C-o" . thanos/org-open-at-point))) + (use-package org-gnosis-ui + :load-path "~/Dev/emacs-lisp/org-gnosis-ui/" + :after org-gnosis + :config + (setf org-gnosis-ui-custom-theme + '((bg . "#1e1e1e") + (bg-alt . "#282a36") + (fg . "#ffffff") + (fg-alt . "#c6daff") + (red . "#ff5f5f") + (orange . "#f1fa8c") + (yellow . "#efef00") + (green . "#44df44") + (cyan . "#00eff0") + (blue . "#338fff") + (violet . "#9099d9") ;; indigo + (magenta . "#ff66ff")))) + (use-package pcmpl-tailscale :vc t :load-path "~/Dev/emacs-lisp/pcmpl-tailscale" @@ -1158,8 +1168,8 @@ rss.xml" anna piracy) (shell-command-to-string "echo $(guix build ovmf-x86-64)/share/firmware/ovmf_x64.bin")))) (async-shell-command - (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -bios %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" - memory cores image ovmf-path (if iso (concat "-cdrom " iso) ""))))) + (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" + memory cores image (if iso (concat "-cdrom " iso) ""))))) (use-package 0x0 :ensure nil) |