diff options
Diffstat (limited to '.config')
-rw-r--r-- | .config/emacs/init.el | 467 |
1 files changed, 231 insertions, 236 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index c54fb98..63edd54 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -54,16 +54,27 @@ (setf auto-insert-alist '((python-mode . "python.template")) auto-insert-directory (locate-user-emacs-file "insert")) -;; Completions +;;;; Completions (add-to-list 'completion-styles 'initials t) -(setf tab-always-indent 'complete) +(setf tab-always-indent 'icomplete-force-complete) +(require 'completion-preview) + + +(define-key completion-in-region-mode-map (kbd "M-n") 'minibuffer-next-completion) +(define-key completion-in-region-mode-map (kbd "M-p") 'minibuffer-previous-completion) (setf completion-styles '(flex) completion-auto-select t completion-auto-help 'always - completion-cycle-threshold nil + completion-cycle-threshold 1 completions-format 'vertical - completions-sort 'historical) + completions-sort 'historical + completions-max-height 20) + +;; Fido +(require 'icomplete) +(fido-vertical-mode) +(define-key icomplete-fido-mode-map (kbd "TAB") #'icomplete-fido-ret) (when (> emacs-major-version 29) (global-completion-preview-mode)) @@ -71,17 +82,35 @@ ;; Search (setf search-default-mode #'char-fold-to-regexp) ;; make it easier to search Greek chars -;; xref -;; (setf xref-show-xrefs-function #'consult-xref -;; xref-show-definitions-function #'consult-xref) - ;; Set and load custom.el (setf custom-file (locate-user-emacs-file "custom.el")) (load custom-file 'noerror) +;; Imenu ;; Enable use-package support for imenu (setf use-package-enable-imenu-support t) +(require 'imenu) +(setf imenu-auto-rescan t + imenu-flatten 'prefix) + +(global-set-key (kbd "C-c m") 'imenu) + +;; Registers & Misc nav +(setf register-use-preview t) + +(global-set-key (kbd "C-x r d") 'bookmark-delete) +(global-set-key (kbd "C-x C-b") 'switch-to-prev-buffer) +(global-set-key (kbd "C-x M-b") 'ibuffer) + +(defvar-keymap thanos/search-map + "g" #'grep-find + "l" #'lgrep + "f" #'find-name-dired + "s" #'occur) + +(global-set-key (kbd "C-c s") thanos/search-map) + (setf browse-url-browser-function 'browse-url-generic browse-url-generic-program "icecat" backup-directory-alist '((".*" . "~/.Trash")) @@ -156,10 +185,13 @@ ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}"))) + + (push 'org-self-insert-command completion-preview-commands) :hook ((org-mode . (lambda () (display-line-numbers-mode -1) (flyspell-mode)))) :bind (:map org-mode-map (("C-c l" . org-store-link) ("C-c M-t" . org-todo) - ("C-c RET" . org-table-hline-and-move)))) + ("C-c RET" . org-table-hline-and-move) + ("C-M-i" . completion-at-point)))) ;; (completion-styles-alist ) ;; Export @@ -342,7 +374,7 @@ (unless (or is-phone is-uranus) (use-package modus-themes - :defer t + :ensure t :config (setf modus-themes-italic-constructs nil modus-themes-bold-constructs nil @@ -396,33 +428,6 @@ ;; Load modus (load-theme 'modus-vivendi t))) -(fido-vertical-mode) - -(use-package consult - :ensure t - :init (define-prefix-command 'thanos/search) - :bind (("C-x r d" . 'bookmark-delete) - ("C-x r C-r" . 'bookmark-rename) - ("C-x r C-j" . 'consult-register) - ("C-x r SPC" . 'consult-register-store) - ("C-x r b" . 'consult-bookmark) - ("C-c m" . 'consult-imenu) - ("C-x b" . 'consult-buffer) - ("C-x C-b" . 'switch-to-prev-buffer) - ("C-x M-b" . 'ibuffer) - ("M-y" . 'consult-yank-from-kill-ring) - ("C-M-s" . 'consult-line) - ("C-c s" . 'thanos/search) - :map thanos/search - ("f" . 'consult-find) - ("g" . 'consult-grep) - ("i" . 'consult-info) - ("l" . 'consult-locate) - ("b" . 'consult-buffer-other-window) - ("m" . 'consult-man) - :map project-prefix-map - ("b" . 'consult-project-buffer))) - (use-package which-key :ensure t :config @@ -560,7 +565,7 @@ (eshell-mode . eat-eshell-visual-command-mode))) (use-package shell - :defer t + :ensure t :bind (("C-c V" . shell) :map shell-mode-map ("C-l" . 'comint-clear-buffer)) @@ -584,14 +589,19 @@ (interactive) (eshell/clear-scrollback)) - +(defun thanos/eshell-preview-insert () + (interactive) + (completion-preview-insert) + (delete-char -1)) (use-package eshell + :ensure t :config (setf eshell-highlight-prompt t) :bind (("C-c e" . eshell) :map eshell-mode-map - ("C-l" . 'thanos/eshell-clear)) + ("C-l" . 'thanos/eshell-clear) + ("<tab>" . 'thanos/eshell-preview-insert)) :hook ((eshell-mode . (lambda () (thanos/set-eshell-aliases thanos/aliases) (display-line-numbers-mode -1))))) @@ -679,153 +689,137 @@ :config (setf dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))) -(use-package xref - :defer t - :config - (setf xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref)) - ;; My packages -(and (or is-zeus is-hermes) - (>= emacs-major-version 30) - (use-package yeetube - :init (define-prefix-command 'thanos/yeetube-map) - :vc t - :load-path "~/Dev/emacs-lisp/yeetube" - :ensure t - :config - (setf yeetube-results-limit 20 - yeetube-mpv-disable-video t - yeetube-display-thumbnails t - yeetube-play-function #'yeetube-mpv-play) - - (defun yeetube-download-videos-ffmpeg () - "Download videos using ffmpeg." - (interactive) - (let ((url "") - (name "") - (download-counter 1) - (stored-contents nil)) - ;; Read links and names until "q" is entered - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name - (read-string (format "Custom name (download counter: %d) " download-counter))) - (push (cons url name) stored-contents) - (setf download-counter (1+ download-counter)))) - ;; Process the collected links and names - (dolist (pair stored-contents) - (let ((url (car pair)) - (name (cdr pair))) - (async-shell-command - (format - "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'" - url name)))))) - - (defun yeetube-download-vimeo-videos () - "Download videos from vimeo services." - (interactive) - (let ((url "") - (name "") - (download-counter 1)) - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name - (read-string (format "Custom name (download counter: %d) " download-counter))) - (setf download-counter (1+ download-counter)) - (call-process-shell-command - (format - "yt-dlp '%s' -o '%s'" - (replace-regexp-in-string "\\.json" ".m3u8" url) name) - nil 0))))) - - :bind (("C-c y" . 'thanos/yeetube-map) - :map thanos/yeetube-map - ("s" . 'yeetube-search) - ("b" . 'yeetube-play-saved-video) - ("d" . 'yeetube-download-videos) - ("C-d" . 'yeetube-download-vimeo-videos) - ("p" . 'yeetube-mpv-toggle-pause) - ("v" . 'yeetube-mpv-toggle-video) - ("V" . 'yeetube-mpv-toggle-no-video-flag) - ("C-p" . 'yeetube-mpv-toggle-video) - ("k" . 'yeetube-remove-saved-video))) - - (use-package gnosis - :load-path "~/Dev/emacs-lisp/gnosis" - :ensure t - :init (define-prefix-command 'thanos/gnosis-map) - :config - (setf gnosis-vc-auto-push t - gnosis-mcq-display-choices nil - gnosis-image-width (and is-hermes 150) - gnosis-image-height (and is-hermes 150)) - (gnosis-modeline-mode) - (setf gnosis-custom-values '((: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" . 'gnosis-dashboard) - ("C-c c" . 'gnosis-add-note))) - - ;; Sync gnosis on startup - (gnosis-vc-pull) - - (use-package org-gnosis - :vc t - :load-path "~/Dev/emacs-lisp/org-gnosis" - :init - (define-prefix-command 'thanos/notes-map) - (define-prefix-command 'thanos/journal-map) - :config - (setf org-gnosis-dir "~/Notes" - org-gnosis-journal-template - "* Daily Notes\n\n* Goals\n+ [] Πρωινὴ Προσευχή\n+ [] Ἑσπερινή Προσευχή\n\n* Extras" - org-gnosis-show-tags t) - - (defun thanos/org-open-at-point () - "Open Org link at point in the same window, if possible." - (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) - :map thanos/journal-map - ("j" . org-gnosis-journal) - ("f" . org-gnosis-journal-find) - ("i" . org-gnosis-journal-insert) - :map org-mode-map - ("C-c C-." . org-gnosis-insert-tag) - ("C-c i" . org-id-get-create) - ("C-c C-o" . thanos/org-open-at-point))) - - (use-package pcmpl-tailscale - :vc t - :load-path "~/Dev/emacs-lisp/pcmpl-tailscale" - :ensure nil) - - (use-package greek-polytonic - :vc t - :load-path "~/Dev/emacs-lisp/greek-polytonic") - - (use-package org-present - :vc (:url "https://github.com/rlister/org-present") - :hook ((org-present-mode . (lambda () - (org-present-big) - (org-display-inline-images) - (org-present-hide-cursor) - (org-present-read-only))) - (org-present-mode-quit . (lambda () - (org-present-small) - (org-remove-inline-images) - (org-present-show-cursor) - (org-present-read-write))))) - - (use-package elfeed +(when (or is-zeus is-hermes) + (use-package yeetube + :init (define-prefix-command 'thanos/yeetube-map) + :vc t + :load-path "~/Dev/emacs-lisp/yeetube" + :ensure t + :config + (setf yeetube-results-limit 20 + yeetube-mpv-disable-video t + yeetube-display-thumbnails t + yeetube-play-function #'yeetube-mpv-play) + + (defun yeetube-download-videos-ffmpeg () + "Download videos using ffmpeg." + (interactive) + (let ((url "") + (name "") + (download-counter 1) + (stored-contents nil)) + ;; Read links and names until "q" is entered + (while (not (string= url "q")) + (setf url (read-string "Enter URL (q to quit): ")) + (unless (string= url "q") + (setf name + (read-string (format "Custom name (download counter: %d) " download-counter))) + (push (cons url name) stored-contents) + (setf download-counter (1+ download-counter)))) + ;; Process the collected links and names + (dolist (pair stored-contents) + (let ((url (car pair)) + (name (cdr pair))) + (async-shell-command + (format + "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'" + url name)))))) + + (defun yeetube-download-vimeo-videos () + "Download videos from vimeo services." + (interactive) + (let ((url "") + (name "") + (download-counter 1)) + (while (not (string= url "q")) + (setf url (read-string "Enter URL (q to quit): ")) + (unless (string= url "q") + (setf name + (read-string (format "Custom name (download counter: %d) " download-counter))) + (setf download-counter (1+ download-counter)) + (call-process-shell-command + (format + "yt-dlp '%s' -o '%s'" + (replace-regexp-in-string "\\.json" ".m3u8" url) name) + nil 0))))) + + :bind (("C-c y" . 'thanos/yeetube-map) + :map thanos/yeetube-map + ("s" . 'yeetube-search) + ("b" . 'yeetube-play-saved-video) + ("d" . 'yeetube-download-videos) + ("C-d" . 'yeetube-download-vimeo-videos) + ("p" . 'yeetube-mpv-toggle-pause) + ("v" . 'yeetube-mpv-toggle-video) + ("V" . 'yeetube-mpv-toggle-no-video-flag) + ("C-p" . 'yeetube-mpv-toggle-video) + ("k" . 'yeetube-remove-saved-video))) + + (use-package gnosis + :load-path "~/Dev/emacs-lisp/gnosis" + :ensure t + :init (define-prefix-command 'thanos/gnosis-map) + :config + (setf gnosis-vc-auto-push t + gnosis-mcq-display-choices nil + gnosis-image-width (and is-hermes 150) + gnosis-image-height (and is-hermes 150)) + (gnosis-modeline-mode) + (setf gnosis-custom-values '((: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-c g" . 'thanos/gnosis-map) + :map thanos/gnosis-map + ("a" . 'gnosis-add-note) + ("d" . 'gnosis-dashboard))) + + ;; Sync gnosis on startup + (gnosis-vc-pull) + + (use-package org-gnosis + :vc t + :load-path "~/Dev/emacs-lisp/org-gnosis" + :init + (define-prefix-command 'thanos/notes-map) + (define-prefix-command 'thanos/journal-map) + :config + (setf org-gnosis-dir "~/Notes" + org-gnosis-journal-template + "* Daily Notes\n\n* Goals\n+ [] Πρωινὴ Προσευχή\n+ [] Ἑσπερινή Προσευχή\n\n* Extras" + org-gnosis-show-tags t) + + (defun thanos/org-open-at-point () + "Open Org link at point in the same window, if possible." + (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) + :map thanos/journal-map + ("j" . org-gnosis-journal) + ("f" . org-gnosis-journal-find) + ("i" . org-gnosis-journal-insert) + :map org-mode-map + ("C-c C-." . org-gnosis-insert-tag) + ("C-c i" . org-id-get-create) + ("C-c C-o" . thanos/org-open-at-point))) + + (use-package pcmpl-tailscale + :vc t + :load-path "~/Dev/emacs-lisp/pcmpl-tailscale" + :ensure nil) + + (use-package greek-polytonic + :vc t + :ensure t + :load-path "~/Dev/emacs-lisp/greek-polytonic")) + + +(use-package elfeed :defer t :vc (:url "https://github.com/skeeto/elfeed") :config @@ -899,17 +893,17 @@ rss.xml" anna piracy) ("U" . 'elfeed-update)) :hook ((elfeed-searchacw-mode . (lambda () (display-line-numbers-mode 0))))) - (use-package transmission - :vc (:url "https://github.com/holomorph/transmission") - :defer t) +(use-package transmission + :vc (:url "https://github.com/holomorph/transmission") + :defer t) - (use-package rainbow-delimiters - :vc (:url "https://github.com/Fanael/rainbow-delimiters") - :defer t - :hook ((emacs-lisp-mode . rainbow-delimiters-mode) - (lisp-mode . rainbow-delimiters-mode) - (clojure-mode . rainbow-delimiters-mode) - (scheme-mode . rainbow-delimiters-mode)))) +(use-package rainbow-delimiters + :vc (:url "https://github.com/Fanael/rainbow-delimiters") + :ensure t + :hook ((emacs-lisp-mode . rainbow-delimiters-mode) + (lisp-mode . rainbow-delimiters-mode) + (clojure-mode . rainbow-delimiters-mode) + (scheme-mode . rainbow-delimiters-mode))) ;; AI tools (use-package gptel @@ -981,45 +975,45 @@ rss.xml" anna piracy) :map notmuch-search-mode-map ("u" . notmuch-refresh-all-buffers)) :hook ((notmuch-hello-mode . (lambda () (display-line-numbers-mode 0))) - (notmuch-search-mode . (lambda () (display-line-numbers-mode 0) (emojify-mode)))) - :custom - (setf notmuch-archive-tags '("-inbox" "-unread" "+archived") - notmuch-show-all-tags-list t - notmuch-hello-sections - '(notmuch-hello-insert-header notmuch-hello-insert-saved-searches - notmuch-hello-insert-alltags)) - - (setq notmuch-search-oldest-first nil) - - (setf notmuch-tag-formats - '(("unread" (propertize tag 'face 'notmuch-tag-unread)) - ("emacs-pm" (propertize tag 'face '((t :foreground "#ff9580")))))) - - (setf notmuch-identities '("[email protected]" "[email protected]" - "[email protected]")) - - (setf notmuch-saved-searches - `((:name "Inbox" :query "tag:inbox" :sort-order newest-first :key ,(kbd "i")) - (:name "Unread" :query "tag:unread" :sort-order newest-first :key ,(kbd "u")) - (:name "Today's message" :query "tag:inbox date:today" :sort-order newest-first - :key ,(kbd "t")) - (:name "sent" :query "tag:sent" :sort-order newest-first :key ,(kbd "s")) - (:name "drafts" :query "tag:draft" :sort-order newest-first :key ,(kbd "d")) - (:name "all mail" :query "*" :sort-order newest-first :key ,(kbd "a")))) - - ;; Update notmuch on startup - ;; (thanos/notmuch-update) - - ;; smtpmail settings - (setf smtpmail-smtp-user (password-store-get-field "mailbox/thanosapollo" "user") - smtpmail-smtp-server "smtp.mailbox.org" - smtpmail-smtp-service 465 - smtpmail-stream-type 'ssl - message-send-mail-function 'smtpmail-send-it - message-signature "Thanos Apollo ☧\nhttps://thanosapollo.org") - - ;; autosign messages - (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)) + (notmuch-search-mode . (lambda () (display-line-numbers-mode 0) (emojify-mode))))) + +(setf notmuch-archive-tags '("-inbox" "-unread" "+archived") + notmuch-show-all-tags-list t + notmuch-hello-sections + '(notmuch-hello-insert-header notmuch-hello-insert-saved-searches + notmuch-hello-insert-alltags)) + +(setq notmuch-search-oldest-first nil) + +(setf notmuch-tag-formats + '(("unread" (propertize tag 'face 'notmuch-tag-unread)) + ("emacs-pm" (propertize tag 'face '((t :foreground "#ff9580")))))) + +(setf notmuch-identities '("[email protected]" "[email protected]" + "[email protected]")) + +(setf notmuch-saved-searches + `((:name "Inbox" :query "tag:inbox" :sort-order newest-first :key ,(kbd "i")) + (:name "Unread" :query "tag:unread" :sort-order newest-first :key ,(kbd "u")) + (:name "Today's message" :query "tag:inbox date:today" :sort-order newest-first + :key ,(kbd "t")) + (:name "sent" :query "tag:sent" :sort-order newest-first :key ,(kbd "s")) + (:name "drafts" :query "tag:draft" :sort-order newest-first :key ,(kbd "d")) + (:name "all mail" :query "*" :sort-order newest-first :key ,(kbd "a")))) + +;; Update notmuch on startup +;; (thanos/notmuch-update) + +;; smtpmail settings +(setf smtpmail-smtp-user (password-store-get-field "mailbox/thanosapollo" "user") + smtpmail-smtp-server "smtp.mailbox.org" + smtpmail-smtp-service 465 + smtpmail-stream-type 'ssl + message-send-mail-function 'smtpmail-send-it + message-signature "Thanos Apollo ☧\nhttps://thanosapollo.org") + +;; autosign messages +(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime) ;; (use-package yasnippet @@ -1174,7 +1168,8 @@ Create a temporary frame to execute BODY, which will then be deleted." "Set random wallpaper." (interactive) (let ((wallpapers (directory-files "~/wallpapers" nil "^[^.].*"))) - (thanos/wallpaper-set (format "%s%s" wallpapers-dir (nth (random (length wallpapers)) wallpapers))))) + (thanos/wallpaper-set + (format "%s%s" wallpapers-dir (nth (random (length wallpapers)) wallpapers))))) (defun thanos/wallpaper-select () "Set wallpaper." |