diff options
Diffstat (limited to '.emacs.d/snippets')
-rw-r--r-- | .emacs.d/snippets/all-the-icons-dired.el | 104 | ||||
-rw-r--r-- | .emacs.d/snippets/apollo-eshell.el | 23 | ||||
-rw-r--r-- | .emacs.d/snippets/email-module.el | 68 | ||||
-rw-r--r-- | .emacs.d/snippets/functions.el | 130 | ||||
-rw-r--r-- | .emacs.d/snippets/keys.el | 98 | ||||
-rw-r--r-- | .emacs.d/snippets/org-config.el | 160 |
6 files changed, 0 insertions, 583 deletions
diff --git a/.emacs.d/snippets/all-the-icons-dired.el b/.emacs.d/snippets/all-the-icons-dired.el deleted file mode 100644 index d2a8763..0000000 --- a/.emacs.d/snippets/all-the-icons-dired.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; all-the-icons-dired.el --- Shows icons for each file in dired mode -*- lexical-binding: t; -*- -;customized from https://github.com/jtbm37/all-the-icons-dired -;;; Code: - -(require 'cl-lib) -(require 'dired) - - -(defface all-the-icons-dired-dir-face - '((((background dark)) :foreground "white") - (((background light)) :foreground "black")) - "Face for the directory icon" - :group 'all-the-icons-faces) - -(defcustom all-the-icons-dired-v-adjust 0.01 - "The default vertical adjustment of the icon in the dired buffer." - :group 'all-the-icons - :type 'number) - -(defvar all-the-icons-dired-mode) - -(defun all-the-icons-dired--add-overlay (pos string) - "Add overlay to display STRING at POS." - (let ((ov (make-overlay (1- pos) pos))) - (overlay-put ov 'all-the-icons-dired-overlay t) - (overlay-put ov 'after-string string))) - -(defun all-the-icons-dired--overlays-in (beg end) - "Get all all-the-icons-dired overlays between BEG to END." - (cl-remove-if-not - (lambda (ov) - (overlay-get ov 'all-the-icons-dired-overlay)) - (overlays-in beg end))) - -(defun all-the-icons-dired--overlays-at (pos) - "Get all-the-icons-dired overlays at POS." - (apply #'all-the-icons-dired--overlays-in `(,pos ,pos))) - -(defun all-the-icons-dired--remove-all-overlays () - "Remove all `all-the-icons-dired' overlays." - (save-restriction - (widen) - (mapc #'delete-overlay - (all-the-icons-dired--overlays-in (point-min) (point-max))))) - -(defun all-the-icons-dired--refresh () - "Display the icons of files in a dired buffer." - (all-the-icons-dired--remove-all-overlays) - (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (when (dired-move-to-filename nil) - (let ((file (dired-get-filename 'relative 'noerror))) - (when file - (let ((icon (if (file-directory-p file) - (all-the-icons-icon-for-dir file - :face 'all-the-icons-dired-dir-face - :v-adjust all-the-icons-dired-v-adjust) - (all-the-icons-icon-for-file file :v-adjust all-the-icons-dired-v-adjust)))) - (if (member file '("." "..")) - (all-the-icons-dired--add-overlay (point) " \t") - (all-the-icons-dired--add-overlay (point) (concat icon "\t"))))))) - (forward-line 1)))) - -(defun all-the-icons-dired--refresh-advice (fn &rest args) - "Advice function for FN with ARGS." - (apply fn args) - (when all-the-icons-dired-mode - (all-the-icons-dired--refresh))) - -(defun all-the-icons-dired--setup () - "Setup `all-the-icons-dired'." - (when (derived-mode-p 'dired-mode) - (setq-local tab-width 1) - (advice-add 'dired-readin :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-revert :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-internal-do-deletions :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-insert-subdir :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-do-kill-lines :around #'all-the-icons-dired--refresh-advice) - (with-eval-after-load 'dired-narrow - (advice-add 'dired-narrow--internal :around #'all-the-icons-dired--refresh-advice)) - (all-the-icons-dired--refresh))) - -(defun all-the-icons-dired--teardown () - "Functions used as advice when redisplaying buffer." - (advice-remove 'dired-readin #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-revert #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-internal-do-deletions #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-narrow--internal #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-insert-subdir #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-do-kill-lines #'all-the-icons-dired--refresh-advice) - (all-the-icons-dired--remove-all-overlays)) - -;;;###autoload -(define-minor-mode all-the-icons-dired-mode - "Display all-the-icons icon for each files in a dired buffer." - :lighter " all-the-icons-dired-mode" - (when (and (derived-mode-p 'dired-mode) (display-graphic-p)) - (if all-the-icons-dired-mode - (all-the-icons-dired--setup) - (all-the-icons-dired--teardown)))) - -(provide 'all-the-icons-dired) -;;; all-the-icons-dired.el ends here diff --git a/.emacs.d/snippets/apollo-eshell.el b/.emacs.d/snippets/apollo-eshell.el deleted file mode 100644 index aba141d..0000000 --- a/.emacs.d/snippets/apollo-eshell.el +++ /dev/null @@ -1,23 +0,0 @@ - -(defun with-face (str &rest face-plist) - (propertize str 'face face-plist)) - -(defun apollo-eshell-prompt () - (let ((winter-blue "#3F3B6C") - (white-summer "#E5E5CB") - (green-night "#03C988") - (orange-summer "#FFB100") - (green-summer "#A3BB98") - (summer-sea "#2192FF") - (black "#000000")) - (concat - (with-face (concat "[" user-login-name) :foreground orange-summer :background black) - (with-face "@" :foreground orange-summer :background black) - (with-face (concat system-name "]\n") :foreground orange-summer :background black) - (with-face (concat "|" (eshell/pwd) ) :foreground "#F0E9D2" :background winter-blue) - (with-face (format-time-string " | %H:%M" (current-time)) :background winter-blue :foreground "#888") - (with-face "\n -> ")))) - -(setq eshell-prompt-function 'apollo-eshell-prompt) -(setq eshell-highlight-prompt t) - diff --git a/.emacs.d/snippets/email-module.el b/.emacs.d/snippets/email-module.el deleted file mode 100644 index 494bd7b..0000000 --- a/.emacs.d/snippets/email-module.el +++ /dev/null @@ -1,68 +0,0 @@ - - -(when (equal system-type 'darwin) - (use-package mu4e - :load-path "/opt/homebrew/share/emacs/site-lisp/mu/mu4e/")) - -(require 'mu4e) - -(setq mu4e-update-interval (* 10 60)) -(setq mu4e-get-mail-command "mbsync -a") -(setq mu4e-maildir-list "~/Mail/Inbox") - -(defun set-mu4e-context (context-name full-name mail-address signature server) - "Return a mu4e context named CONTEXT-NAME with :match-func matching - folder name CONTEXT-NAME in Maildir. The context's `user-mail-address', - `user-full-name' and `mu4e-compose-signature'`smtpmail-smpt-server' is set to MAIL-ADDRESS - FULL-NAME SIGNATURE and SERVER respectively. - Special folders are set to context specific folders." - (let ((dir-name (concat "/" context-name))) - (make-mu4e-context - :name context-name - ;; we match based on the maildir of the message - :match-func - `(lambda (msg) - (when msg - (string-match-p - ,(concat "^" dir-name) - (mu4e-message-field msg :maildir)))) - :vars - `((user-mail-address . ,mail-address) - (user-full-name . ,full-name) - (mu4e-sent-folder . ,(concat dir-name "/Sent")) - (mu4e-drafts-folder . ,(concat dir-name "/Drafts")) - (mu4e-trash-folder . ,(concat dir-name "/Trash")) - (mu4e-trash-folder . ,(concat dir-name "/Starred")) - (mu4e-refile-folder . ,(concat dir-name "/Archive")) - (smtpmail-smtp-service . ,465) - (smtpmail-smtp-server . ,server) - (mu4e-compose-signature . ,signature))))) -;;Fixing duplicate UID errors when using mbsync and mu4e -(setq mu4e-change-filenames-when-moving t) - -(setq mu4e-maildir-shortcuts - '(("/Fastmail/Inbox" . ?i) - ("/Fastmail/Sent" . ?s) - ;; ("/Gmail/Trash" . ?t) - ;; ("/Gmail/Drafts" . ?d) - ;; ("/Gmail/[Gmail]/All Mail" . ?a - )) - -(setq mu4e-contexts - `(, (set-mu4e-context - "Fastmail" "Thanos Apollo" - "[email protected]" "Thanos\nhttps://thanosapollo.com/public" - "smtp.fastmail.com"))) - -;; (setq smtpmail-smtp-service 465 -;; smtpmail-stream-type 'ssl -;; smtpmail-smtp-server "smtp.fastmail.com") - - - -(setq message-send-mail-function 'smtpmail-send-it - smtpmail-stream-type 'ssl) - -(provide 'email-module) -;;; email-module.el ends here - diff --git a/.emacs.d/snippets/functions.el b/.emacs.d/snippets/functions.el deleted file mode 100644 index 97156f6..0000000 --- a/.emacs.d/snippets/functions.el +++ /dev/null @@ -1,130 +0,0 @@ -;;; package --- Summary -;;; Commentary: -;;; Random functions for my daily use. -;;; Code: - - -(defun apollo/html-boostrap-boilerplate () - "Insert html boilerplate with boostrap link." - (interactive) - (insert -"<!DOCTYPE html> -<html lang=\"en\"> - <head> - <meta charset=\"UTF-8\"> - <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> - <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"> - <title>My Title</title> - <link rel=\"stylesheet\" href=\"./style.css\"> - <link href=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi\" crossorigin=\"anonymous\"> - </head> - <body> - <main> - <h1>Starting point</h1> - </main> - <script src=\"index.js\"></script> - </body> -</html>" )) - - -(defun apollo/center-buffer () - "Centers/Uncenters selected buffer" - (interactive) - (if visual-fill-column-center-text - (setq visual-fill-column-center-text nil) - (setq visual-fill-column-center-text t)) - (visual-fill-column-mode 1) - (message "General's task completed!")) - - -(defun apollo/rofi-switch-window () - "Navigate X11 buffers using rofi." - (interactive) - (start-process-shell-command - "rofi" nil "rofi -show window")) - -(defun apollo/run-in-background (command) - "Run COMMAND in the background." - (let ((command-parts (split-string command "[ ]+"))) - (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) - -(defun rofi () - "Run Rofi." - (interactive) - (apollo/run-in-background "rofi -show drun")) - -(defun apollo/volume-increase () - "Increase Volume." - (interactive) - (start-process-shell-command - "amixer" nil "amixer sset Master 5%+")) - -(defun apollo/volume-decrease () - "Decrease Volume." - (interactive) - (start-process-shell-command - "amixer" nil "amixer sset Master 5%-")) - -(defun apollo/restore-wallpaper () - "Set NAME as wallpaper." - (interactive) - (start-process-shell-command - "feh" nil "feh --bg-scale ~/dotfiles/wallpaper.png")) - -(defun apollo/emacs-keys () - "Swap caps with ctrl." - (interactive) - (start-process-shell-command - "setxkbmap" nil "setxkbmap us -option ctrl:swapcaps")) - -(defun apollo/greek-keyboard () - "Swap caps with ctrl." - (interactive) - (start-process-shell-command - "setxkbmap" nil "setxkbmap gr")) - -(defun apollo/exwm-init-hook () - "Do this upon start." - (display-battery-mode 0) ;;Change to 1 to display battery - - (setq display-time-day-and-date t) - (display-time-mode 1) - - ;;Launch apps that will run in the background -;; (apollo/run-in-background "blueman-applet") - (apollo/run-in-background "picom") -;; (apollo/run-in-background "nm-applet") - (apollo/emacs-keys) - (apollo/set-wallpaper) - (start-polybar) - ) - -(defun apollo/exwm-update-class () - (exwm-workspace-rename-buffer exwm-class-name)) - -(defun eshell-new() - "Open a new instance of eshell." - (interactive) - (eshell 'N)) - -(defun make-mini-buffer () - (interactive) - (split-window-below 40) - (other-window 1)) - -(defun make-mini-geiser () - (interactive) - (split-window-below 60) - (geiser nil)) - -(defun start-polybar () - "Check which system is running, start polybar accordingly." - (interactive) - (if (string= (system-name) "fsociety") - (start-process-shell-command - "polybar" nil "polybar main & polybar second") - (start-process-shell-command - "polybar" nil "polybar main"))) -;;; my-functions.el ends here. - - diff --git a/.emacs.d/snippets/keys.el b/.emacs.d/snippets/keys.el deleted file mode 100644 index 0d88af6..0000000 --- a/.emacs.d/snippets/keys.el +++ /dev/null @@ -1,98 +0,0 @@ -;; init-keys.el -;;; Code: -(require 'multi-vterm) -(require 'vterm) -(require 'general) -(require 'pdf-tools) -(require 'hydra) - -;; my general's leader key! -(defconst general-key "C-c g") - -(define-prefix-command 'window-control-map) -(global-set-key (kbd "C-w") 'window-control-map) - -(general-create-definer general-does - :prefix general-key) - -(defhydra hydra-zoom (global-map "s-z") - "zoom" - ("=" text-scale-increase "in") - ("-" text-scale-decrease "out")) - - - -;; Basic functions -(general-define-key - "C-d" 'kill-region - "C-k" 'copy-region-as-kill - "C-c v" 'multi-vterm-next - "C-x 9" 'make-mini-buffer - "C-c l e" 'apollo/emacs-keys - ;;Change keyboard layouts/language - "C-c l g" 'apollo/greek-keyboard - "C-κ" 'apollo/emacs-keys - "C-x C-b" 'ibuffer) - - - -;; My Generals does: -(general-does - "t" 'counsel-load-theme - "l" 'display-line-numbers-mode - "v" 'multi-vterm-next - "e" 'eshell - "i" 'circe - "c" 'apollo/center-buffer - "m" 'mu4e - "f" 'elfeed) - -;;pdf-tools -(general-define-key - :keymaps 'pdf-view-mode-map - "C-c d" 'pdf-view-midnight-minor-mode - "C-s" 'isearch-forward - "C-o" 'pdf-isearch-occur) - - - -;;vterm -(general-does - :keymaps 'vterm-mode-map - "n" 'multi-vterm-next - "o" 'multi-vterm - "p" 'multi-vterm-prev) - -(general-define-key - :keymaps 'vterm-mode-map - "C-c v n" 'multi-vterm-next - "C-c v p" 'multi-vterm-prev - "C-c v o" 'multi-vterm) - -;;eshell -(general-does - :keymaps 'eshell-mode-map - "n" 'eshell-new) -;;org -(general-does - :keymaps 'org-mode-map - "3" 'org-insert-image-size-300) -;;pdf-tools - -;;Add pdf-isearch-minor-mode hook, otherwise isearch will be buggy -;;Darkmode hook, cause I don't want color or light in my life, I'm a vampire. -(add-hook 'pdf-view-mode-hook 'pdf-isearch-minor-mode) -(add-hook 'pdf-view-mode-hook 'pdf-view-midnight-minor-mode) - -(general-define-key - :keymaps 'pdf-view-mode-map - "C-c d" 'pdf-view-midnight-minor-mode - "C-s" 'isearch-forward - "C-o" 'pdf-isearch-occur) - -;;scheme -(general-does - :keymaps 'scheme-mode-map - "g" 'make-mini-geiser) - -;;init-keys ends here diff --git a/.emacs.d/snippets/org-config.el b/.emacs.d/snippets/org-config.el deleted file mode 100644 index 6e73844..0000000 --- a/.emacs.d/snippets/org-config.el +++ /dev/null @@ -1,160 +0,0 @@ -(require 'org) -(require 'org-agenda) -(require 'org-superstar) -(require 'org-tempo) - -(defun apollo/org-mode-setup () - (setq evil-auto-indent nil) - (apollo/org-theme-dracula)) - -(add-hook 'org-mode-hook 'apollo/org-mode-setup) -(add-hook 'org-mode-hook 'org-superstar-mode) -(add-hook 'org-mode-hook 'flyspell-mode) - -(setq org-directory "~/org/" - org-agenda-files '("~/org/agenda.org") - org-default-notes-file (expand-file-name "notes.org" org-directory) - org-ellipsis " ▼ " - org-log-done 'time - org-hide-emphasis-markers nil ;;change to t to hide emphasis markers - org-table-convert-region-max-lines 20000 - org-agenda-start-log-mode t - org-log-done 'time - org-log-into-drawer t - org-indent-mode t - org-todo-keywords ;; This overwrites the default Doom org-todo-keywords - '((sequence - "TODO(t)" ;; A task that is ready to be tackled - "BLOG(b)" ;; Blog writing assignments - "GYM(g)" ;; Things to accomplish at the gym - "WAIT(w)" ;; Something is holding up this task - "|" ;; The pipe necessary to separate "active" states and "inactive" states - "DONE(d)" ;; Task has been completed - "CANCELLED(c)" )) - org-superstar-headline-bullets-list '("◉" "●" "○" "●" "○" "●" "◆") - org-superstar-itembullet-alist '((?+ . ?➤) (?- . ?✦))) ;; changes +/- symbols in item lists) - -;; Use either org-bullets or org-superstar -;; (use-package org-bullets -;; :after org -;; :hook (org-mode . org-bullets-mode) -;; :custom -;; (org-bullets-bullet-list '("●" "○" "●" "○" "●" "●" ))) - -;; Org Themes -(defun apollo/org-theme-none () - "Enable Darkone theme for Org headers." - (interactive) - (dolist - (face - '((org-level-1 1.60) - (org-level-2 1.55) - (org-level-3 1.40) - (org-level-4 1.20) - (org-level-5 1.20) - (org-level-6 1.20) - (org-level-7 1.10) - (org-level-8 1.00))))) -(defun my-org-faces () - (set-face-attribute 'org-todo nil :height 0.8) - (set-face-attribute 'org-level-1 nil :height 1.70 :weight bold) - (set-face-attribute 'org-level-2 nil :height 1.50)) -(defun apollo/org-theme-darkone () - "Enable Darkone theme for Org headers." - (interactive) - (dolist - (face - '((org-level-1 1.70 "#51afef" bold) - (org-level-2 1.55 "#7FBCD2" bold) - (org-level-3 1.40 "#da8548" bold) - (org-level-4 1.20 "#da8548" semi-bold) - (org-level-5 1.20 "#5699af" normal) - (org-level-6 1.20 "#a9a1e1" normal) - (org-level-7 1.10 "#46d9ff" normal) - (org-level-8 1.00 "#ff6c6b" normal))) - (set-face-attribute (nth 0 face) nil - :font "Jetbrains Mono" - :weight (nth 3 face) - :height (nth 1 face) - :foreground (nth 2 face))) - (set-face-attribute 'org-table nil - :font "Jetbrains Mono" - :weight 'normal - :height 1.0 - :foreground "#A66CFF")) - -(defun apollo/org-theme-dracula () - "Enable Dracula theme for Org headers." - (interactive) - (dolist - (face - '((org-level-1 1.7 "#8be9fd" ultra-bold) - (org-level-2 1.6 "#bd93f9" extra-bold) - (org-level-3 1.5 "#50fa7b" bold) - (org-level-4 1.4 "#ff79c6" semi-bold) - (org-level-5 1.3 "#9aedfe" normal) - (org-level-6 1.2 "#caa9fa" normal) - (org-level-7 1.1 "#5af78e" normal) - (org-level-8 1.0 "#ff92d0" normal))) - (set-face-attribute (nth 0 face) nil - :font "JetBrains Mono" - :weight (nth 3 face) - :height (nth 1 face) - :foreground (nth 2 face))) - (set-face-attribute 'org-table nil - :font "JetBrains Mono" - :weight 'normal - :height 1.0 - :foreground "#bfafdf")) - -(defun apollo/org-mode-visual () - (interactive) - (setq visual-fill-column-width 100 - visual-fill-column-center-text t) - (visual-fill-column-mode 1)) -(defun apollo/org-mode-visual-undo () - (interactive) - (setq visual-fill-column-width 2000 - visual-fill-column-center-text nil) - (visual-fill-column-mode 1)) - -(defadvice org-edit-src-code (around set-buffer-file-name activate compile) - (let ((file-name (buffer-file-name))) ;; (1) - ad-do-it ;; (2) - (setq buffer-file-name file-name))) ;; (3) - -(org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . t) - (python . t))) - -(add-to-list 'org-structure-template-alist '("sh" . "src shell")) -(add-to-list 'org-structure-template-alist '("b" . "src shell")) -(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) -(add-to-list 'org-structure-template-alist '("py" . "src python")) - -;; Automatically tangle our Emacs.org config file when we save it -(defun apollo/org-babel-tangle-config () - (when (string-equal (buffer-file-name) - (expand-file-name "~/.emacs.d/emacs.org" - "~/.config/qtile/README.org")) - ;; Dynamic scoping to the rescue - (let ((org-confirm-babel-evaluate nil)) - (org-babel-tangle)))) - -(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'apollo/org-babel-tangle-config))) - -(defun apollo/markdown-theme () - (interactive) - (dolist - (face - '(markdown-header-face-1 :height 2.0)))) - -(setq markdown-header-scaling t) - - -(use-package markdown-mode - :ensure t - :mode (".md" . gfm-mode) - :init (setq markdown-command "multimarkdown")) - |