397 lines of gibberish .config/doom/custom.el

;;(setq debug-on-error t)

;---------------------------------------------------------------------------------;

(setq fancy-splash-image "~/.config/doom/sparklemagic/3_3.png")

(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-shortmenu)

;---------------------------------------------------------------------------------;

(add-to-list 'load-path "/usr/share/emacs/site-lisp/exwm")

;---------------------------------------------------------------------------------;

(load-file "~/.config/doom/include/session-startup.el")

;---------------------------------------------------------------------------------;

(require 'exwm)

(require 'exwm-input)

(exwm-enable)

;---------------------------------------------------------------------------------;

;; enable clipboard in emacs

(setq select-enable-clipboard t)

;; curosr

(setq make-pointer-invisible nil)

(set-fringe-mode 15)

(custom-set-variables

;; custom-set-variables was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If There is more than one, they won't work right.

'(auth-source-save-behavior nil)

'(custom-safe-themes

'("10e5d4cc0f67ed5cafac0f4252093d2119ee8b8cb449e7053273453c1a1eb7cc" "3fe1ebb870cc8a28e69763dde7b08c0f6b7e71cc310ffc3394622e5df6e4f0da" "a9abd706a4183711ffcca0d6da3808ec0f59be0e8336868669dc3b10381afb6f" "37b6695bae243145fa2dfb41440c204cd22833c25cd1993b0f258905b9e65577" default))

'(magit-todos-insert-after '(bottom) nil nil "Changed by setter of obsolete option `magit-todos-insert-at'")

'(package-selected-packages

'(jit-spell ef-themes flycheck-grammalecte ox-gemini focus mpv exec-path-from-shell dmenu powerthesaurus dashboard-hackernews bongo volume pretty-hydra curl-to-elisp elfeed-dashboard org-pdftools ox-gemini writeroom-mode titlecase html-to-markdown cpu-sos hackernews elfeed feline image-dired+ auctex-lua flycheck-clang-tidy spaces all-the-icons-nerd-fonts wwtime exwm-x battery-notifier image+ emms adaptive-wrap vterm-toggle splitter ac-ispell spell-fu yasnippet fliptext ace-window mw-thesaurus gemini-mode elpher)))

;; flyspell-lazy flyspell-correct-popup

;; STRAIGHT_USE-PACKAGE

(straight-use-package 'vterm :defer)

(straight-use-package 'elfeed :defer)

(straight-use-package 'windresize :defer)

(straight-use-package 'flyspell :defer)

(straight-use-package 'pdf-tools :defer)

(straight-use-package 'elpher :defer)

(straight-use-package 'ace-window)

(straight-use-package 'yasnippet :defer)

(straight-use-package 'ispell :defer)

(straight-use-package 'spell-fu :spell-fu-global-mode :defer)

(straight-use-package 'org-modern :defer)

(straight-use-package 'mw-thesaurus :defer) ;; Thesaurus

;---------------------------------------------------------------------------------;

(setq sentence-end-double-space nil)

;; REMOVING AUTO INDENT.

(electric-indent-mode -1)

(use-package dtrt-indent

:straight t

:disabled t)

(use-package org-indent-mode

:straight t

:disabled t)

(setq show-trailing-whitespace t)

;---------------------------------------------------------------------------------;

(setq explicit-shell-file-name "/usr/bin/zsh")

(setq shell-file-name "zsh")

(setq explicit-zsh-args '("--login" "--interactive"))

(defun zsh-shell-mode-setup ()

(setq-local comint-process-echoes t))

(add-hook 'shell-mode-hook #'zsh-shell-mode-setup)

(add-to-list 'load-path "~/.config/doom")

;; DISPLAY MODES - THEME

;; (exwm-systemtray-mode 1)

(global-emojify-mode 1)

(require 'uniquify) ;;BUFFERS

(setq uniquify-buffer-name-style 'forward)

;; performance hacks?

(setq inhibit-compacting-font-caches t)

(setq undo-limit 4000)

(setq evil-default-cursor '("DodgerBlue1" box)

evil-normal-state-cursor '("HotPink" box)

evil-emacs-state-cursor '("HotPink" box)

evil-replace-state-cursor '("HotPink" box))

(blink-cursor-mode 1)

(global-set-key (kbd "C-c bc") 'blink-cursor-mode)

(add-hook 'dired-mode-hook 'media-thumbnail-clear-all) ;; clear all on dired start

(setq dired-listing-switches "-agho --group-directories-first"

dired-omit-files "^\\.[^.].*"

dired-omit-verbose nil

dired-hide-details-hide-symlink-targets nil

delete-by-moving-to-trash t)

;; dired styling

(use-package dired

:ensure nil ;; Dired is built into Emacs, no need to install it

:hook ((dired-mode . dired-hide-details-mode)) ;; Automatically hide details

:config

;; Check system compatibility before setting switches

(setq dired-listing-switches (if (string-match-p "gnu" system-configuration)

"-alh" ;; Use human-readable sizes for GNU `ls`

"-al")) ;; Fallback if `-h` isn't supported

;; Ensure the hook is set explicitly

(add-hook 'dired-mode-hook #'dired-hide-details-mode))

;; Colourful columns.

(use-package diredfl

:ensure t

:config

(diredfl-global-mode 1))

(map! :leader

:prefix "d"

"d" nil

:desc "dired-thumbnail-display" "t" #'media-thumbnail-dired--display)

(defun move-text-internal (arg)

(cond

((and mark-active transient-mark-mode)

(if (> (point) (mark))

(exchange-point-and-mark))

(let ((column (current-column))

(text (delete-and-extract-region (point) (mark))))

(forward-line arg)

(move-to-column column t)

(set-mark (point))

(insert text)

(exchange-point-and-mark)

(setq deactivate-mark nil)))

(t

(let ((column (current-column)))

(beginning-of-line)

(when (or (> arg 0) (not (bobp)))

(forward-line)

(when (or (< arg 0) (not (eobp)))

(transpose-lines arg)

(when (and (eval-when-compile

'(and (>= emacs-major-version 24)

(>= emacs-minor-version 3)))

(< arg 0))

(forward-line -1)))

(forward-line -1))

(move-to-column column t)))))

(defun move-text-down (arg)

"Move region (transient-mark-mode active) or current line

arg lines down."

(interactive "*p")

(move-text-internal arg))

(defun move-text-up (arg)

"Move region (transient-mark-mode active) or current line

arg lines up."

(interactive "*p")

(move-text-internal (- arg)))

(global-set-key [M-S-up] 'move-text-up)

(global-set-key [M-S-down] 'move-text-down)

(defun make-window-dedicated (arg)

"Set the current window as dedicated,

so it will not be chosen as target for other buffers.

With C-u (ARG != 1; some prefix argument)

set window as non-dedicated."

(interactive "p")

(set-window-dedicated-p nil (if (= 1 arg) t nil)))

(global-set-key (kbd "C-c mwd") 'make-window-dedicated) ;;

;; OTHER WINDOW - VSPLIT

(global-set-key (kbd "C-c oo") 'other-window) ;;

(global-set-key (kbd "C-c dw") 'evil-window-delete) ;;

;; window resize

(global-set-key (kbd "S-C-<right>") 'shrink-window-horizontally)

(global-set-key (kbd "S-C-<left>") 'enlarge-window-horizontally)

(global-set-key (kbd "S-C-<down>") 'shrink-window)

(global-set-key (kbd "S-C-<up>") 'enlarge-window)

;; control popups

(setq exwm-layout-show-all-buffers t)

(setq exwm-randr-workspace-monitor-plist

'(0 "HDMI-1" "DP-1"))

(setq exwm-floating-border-width 2)

;; popups centered

(defun exwm-center-floating-window ()

"Center floating windows on the screen."

(when exwm--floating-frame

(let* ((window (frame-root-window exwm--floating-frame))

(window-size (window-pixel-size window))

(screen-width (display-pixel-width))

(screen-height (display-pixel-height)))

(set-frame-position

exwm--floating-frame

(/ (- screen-width (car window-size)) 2)

(/ (- screen-height (cdr window-size)) 2)))))

(add-hook 'exwm-floating-setup-hook #'exwm-center-floating-window)

(defun exwm-fix-floating-window-size ()

"Ensure floating windows fit within the screen bounds."

(when exwm--floating-frame

(let* ((frame exwm--floating-frame)

(screen-width (display-pixel-width))

(screen-height (display-pixel-height))

(frame-width (frame-pixel-width frame))

(frame-height (frame-pixel-height frame)))

(when (> frame-width screen-width)

(set-frame-width frame (/ screen-width (frame-char-width)) nil 'pixelwise))

(when (> frame-height screen-height)

(set-frame-height frame (/ screen-height (frame-char-height)) nil 'pixelwise)))))

(add-hook 'exwm-floating-setup-hook #'exwm-fix-floating-window-size)

(setq exwm-manage-configurations

'((t :floating t

:float-pixel-offset '(0 . 0))))

(global-hide-mode-line-mode t)

(use-package eyebrowse

:diminish eyebrowse-mode

:config (progn

(define-key eyebrowse-mode-map (kbd "M-1") 'eyebrowse-switch-to-window-config-1)

(define-key eyebrowse-mode-map (kbd "M-2") 'eyebrowse-switch-to-window-config-2)

(define-key eyebrowse-mode-map (kbd "M-3") 'eyebrowse-switch-to-window-config-3)

(define-key eyebrowse-mode-map (kbd "M-4") 'eyebrowse-switch-to-window-config-4)

(define-key eyebrowse-mode-map (kbd "M-5") 'eyebrowse-switch-to-window-config-5)

(define-key eyebrowse-mode-map (kbd "M-6") 'eyebrowse-switch-to-window-config-6)

(define-key eyebrowse-mode-map (kbd "M-7") 'eyebrowse-switch-to-window-config-7)

(define-key eyebrowse-mode-map (kbd "M-8") 'eyebrowse-switch-to-window-config-8)

(define-key eyebrowse-mode-map (kbd "M-9") 'eyebrowse-switch-to-window-config-9)

(eyebrowse-mode t)

(setq eyebrowse-new-workspace t)))

(custom-set-faces

;; custom-set-faces was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If there is more than one, they won't work right.

)

;; DON'T CREATE BACKUP FILES OR AUTOSAVE

(setq auto-save-file-name-transforms '((".*" "~/.trash/" t)))

(setq backup-directory-alist '((".*" . "~/.trash/")))

(setq make-backup-files nil)

(setq auto-save-default nil)

(setq bookmark-default-file "~/.config/doom/bookmarks.el")

(after! doom-themes

(setq doom-themes-enable-bold t

doom-themes-enable-italic t))

(setq browse-url-browser-function 'eww-browse-url

shr-indentation 2

eww-search-prefix "https://lite.duckduckgo.com/lite?q=")

(global-set-key (kbd "C-c iww") 'eww)

(global-set-key (kbd "C-c cpu") '+default/yank-buffer-path)

(setq browse-url-browser-function 'eww-browse-url)

;; Make eww use elpher for gopher and gemini URLs

(defun emacs-init/eww-browse-url (original url &optional new-window)

"Handle gemini links."

(cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url)

(require 'elpher)

(elpher-go url))

(t (funcall original url new-window))))

(load-file "~/.config/doom/include/gemini.config.el")

(require 'elfeed-org)

(elfeed-org)

(setq rmh-elfeed-org-files (list "~/bin/sh/elfeed.org"))

(define-advice elfeed-search--header (:around (oldfun &rest args))

(if elfeed-db

(apply oldfun args)

"No database loaded yet"))

;; elfeed

(add-hook 'elfeed

(lambda ()

(set-face-font (font-spec :family "Comic Mono" :size 18))

(spell-fu--mode-disable 1)))

;; custom date

(defun elfeed-search-format-date (date)

(format-time-string "" (seconds-to-time date)))

;;(format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date)))

(add-hook 'elfeed-search 'text-mode-hook 'spell-fu--immediate-disable)

(after! elfeed

(setq elfeed-search-mode t

))

(load-file "~/.config/doom/include/point-and-click-gui-shortcuts.el")

(after! org

(setq org-fontify-quote-and-verse-blocks t

org-fontify-whole-heading-line t

org-hide-emphasis-markers t

org-hide-leading-stars nil

org-startup-indented nil

org-pretty-entities nil

org-startup-folded t

so-long-minor-mode t

flyspell-mode nil

))

(after! org

(setq org-babel-use-quick-and-dirty-noweb-expansion t))

(setq org-indent-mode-turns-off-org-adapt-indentation 1)

(map! :leader

:prefix "o"

:desc "org-fold" "f" 'org-fold-hide-sublevels)

(map! :leader

:prefix "o"

:desc "org-tangle" "b" 'org-babel-tangle)

(org-link-set-parameters

"org-protocol"

:export (lambda (path desc backend)

(cond

((eq 'html backend)

(format "<a href=\"org-protocol:%s\">%s</a>" path desc)))))

(require 'org-crypt)

(org-crypt-use-before-save-magic)

(setq org-tags-exclude-from-inheritance (quote ("crypt")))

(setq org-crypt-key nil)

;; SPELLING DICTIONARY

(global-set-key (kbd "<f3>") 'dictcc-at-point)

(global-set-key (kbd "<f4>") 'powerthesaurus-transient)

(global-set-key (kbd "C-c tc") 'titlecase-region) ;;

(global-set-key (kbd "C-c Sr") 'spell-fu-reset) ;;

(global-set-key (kbd "C-c So") 'spell-fu-mode) ;;

;; eww - shortcuts

(map! :leader

:prefix "e"

"e" nil

:desc "eww-toggle-images" "f" '+popup/raise) ; F12

(map! :leader

:prefix "e"

"e" nil

:desc "eww-toggle-images" "i" 'eww-toggle-images)

(map! :leader

:prefix "e"

"e" nil

:desc "eww-back-url" "h" 'eww-back-url)

(map! :leader

:prefix "e"

"e" nil

:desc "eww-forward-url" "l" 'eww-forward-url)

(global-set-key (kbd "<f12>") '+popup/raise) ;; DEFAULT = C-x 1.

(global-set-key (kbd "C-c bC") 'blink-cursor-mode)

(global-set-key (kbd "C-SPC") 'dmenu)

;; (map! :leader

;; :prefix "d"

;; ;; "d" nil ; disable project todos key binding

;; :desc "dmenu" "d" #'dmenu)

(global-set-key (kbd "C-c dd") '+doom-dashboard/open)

(global-set-key (kbd "C-c ielf") 'elfeed)

(global-set-key (kbd "C-c ieu") 'elfeed-update)

(global-set-key (kbd "C-c iep") 'elpher)

(global-set-key (kbd "C-c tbm") 'tab-bar-mode)

(global-set-key (kbd "C-c ts") 'org-timestamp-inactive) ;;

;; begining and end of line the right way

(global-set-key (kbd "C-c <right>") 'end-of-line)

(global-set-key (kbd "C-c <left>") 'beginning-of-line)

(global-set-key (kbd "<f7>") 'evil-window-vsplit)

(global-set-key (kbd "<f8>") 'evil-split-buffer)

(exwm-input-set-key (kbd "<XF86AudioMute>") (lambda () (interactive) (shell-command "amixer -q set Master toggle")))

(exwm-input-set-key (kbd "<XF86AudioLowerVolume>") (lambda () (interactive) (shell-command "amixer -q set Master 5%-")))

(exwm-input-set-key (kbd "<XF86AudioRaiseVolume>") (lambda () (interactive) (shell-command "amixer -q set Master 5%+")))

;;(exwm-input-set-key (kbd "<XF86AudioPlay>") (lambda () (interactive) (shell-command "playerctl play-pause")))

;;(exwm-input-set-key (kbd "<XF86AudioNext>") (lambda () (interactive) (shell-command "playerctl next")))

;;(exwm-input-set-key (kbd "<XF86AudioPrev>") (lambda () (interactive) (shell-command "playerctl previous")))

;; vterm open

(map! :leader

:prefix "t" nil

:desc "+vterm-here" "t" #'+vterm/here)

(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))

(setq nov-text-width 80)