diff options
Diffstat (limited to 'org')
-rwxr-xr-x | org/emacs.org | 460 |
1 files changed, 215 insertions, 245 deletions
diff --git a/org/emacs.org b/org/emacs.org index 10ebc67..e3cbf14 100755 --- a/org/emacs.org +++ b/org/emacs.org @@ -392,210 +392,6 @@ Hook with ~dired-mode~ ;; (setq eshell-prompt-function 'apollo-eshell-prompt) ;; (setq eshell-highlight-prompt t) #+end_src -* Custom -** Random functions -#+begin_src emacs-lisp - (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\"> - p </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-update-class () - (exwm-workspace-rename-buffer exwm-class-name)) - - (defun eshell-new() - "Open a new instance of eshell." - (interactive) - (eshell 'N)) - - (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"))) - - (defun create-keimenografos () - "create a scratch buffer" - (interactive) - (switch-to-buffer (get-buffer-create "*Keimenografos*")) - (text-mode)) -#+end_src -** Keybindings -#+begin_src emacs-lisp - (define-key dired-mode-map "b" 'dired-up-directory) - - (global-set-key (kbd "<escape>") 'keyboard-escape-quit) - - (global-set-key (kbd "C-=") 'text-scale-increase) - (global-set-key (kbd "C--") 'text-scale-decrease) - (global-set-key (kbd "C-k") 'copy-region-as-kill) - - ;; Pass - (global-set-key (kbd "C-c p i") 'password-store-insert) - (global-set-key (kbd "C-c p e") 'password-store-edit) - - - - (define-prefix-command 'thanos/applications-map) - (define-key thanos/applications-map (kbd "q") 'chatgpt-query) - (define-key thanos/applications-map (kbd "m") 'mu4e) - (define-key thanos/applications-map (kbd "t") 'counsel-load-theme) - (define-key thanos/applications-map (kbd "f") 'elfeed) - (global-set-key (kbd "C-c a") 'thanos/applications-map) - - (define-prefix-command 'Morfi) - (define-key thanos/applications-map (kbd "c") 'Morfi) - (define-key Morfi (kbd "t") 'create-keimenografos) - - - (defvar thanos/vterm-map (make-sparse-keymap)) - (define-prefix-command 'thanos/vterm-map) - (define-key global-map (kbd "C-c v") 'thanos/vterm-map) - (define-key thanos/vterm-map (kbd "n") 'multi-vterm-next) - (define-key thanos/vterm-map (kbd "p") 'multi-vterm-prev) - (define-key thanos/vterm-map (kbd "d") 'multi-vterm-dedicated-open) - (define-key thanos/vterm-map (kbd "o") 'multi-vterm) -#+end_src -*** General -#+begin_src emacs-lisp - - ;; my general's leader key! - (defconst general-key "C-c g") - - (general-create-definer general-does - :prefix general-key) - - ;; Basic functions - (general-define-key - "C-d" 'kill-region - "C-k" 'copy-region-as-kill - "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 - "e" 'eshell - "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-does - :keymaps 'eshell-mode-map - "n" 'eshell-new) - - (general-does - :keymaps 'org-mode-map - "3" 'org-insert-image-size-300) -#+end_src -** ChatGPT -#+begin_src emacs-lisp - (setq openai-key (password-store-get "chatgpt/api2")) -#+end_src * Org-mode Configuration ** org-make-toc #+begin_src emacs-lisp @@ -1036,46 +832,220 @@ Hook with ~dired-mode~ #+end_src -* ERC +* Misc +** Random functions +#+begin_src emacs-lisp + (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\"> + p </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-update-class () + (exwm-workspace-rename-buffer exwm-class-name)) + + (defun eshell-new() + "Open a new instance of eshell." + (interactive) + (eshell 'N)) + + (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"))) + + (defun create-keimenografos () + "create a scratch buffer" + (interactive) + (switch-to-buffer (get-buffer-create "*Keimenografos*")) + (text-mode)) +#+end_src +** Keybindings +#+begin_src emacs-lisp + (define-key dired-mode-map "b" 'dired-up-directory) + + (global-set-key (kbd "<escape>") 'keyboard-escape-quit) + + (global-set-key (kbd "C-=") 'text-scale-increase) + (global-set-key (kbd "C--") 'text-scale-decrease) + (global-set-key (kbd "C-k") 'copy-region-as-kill) + + ;; Pass + (global-set-key (kbd "C-c p i") 'password-store-insert) + (global-set-key (kbd "C-c p e") 'password-store-edit) + + + + (define-prefix-command 'thanos/applications-map) + (define-key thanos/applications-map (kbd "q") 'chatgpt-query) + (define-key thanos/applications-map (kbd "m") 'mu4e) + (define-key thanos/applications-map (kbd "t") 'counsel-load-theme) + (define-key thanos/applications-map (kbd "f") 'elfeed) + (global-set-key (kbd "C-c a") 'thanos/applications-map) + + (define-prefix-command 'Morfi) + (define-key thanos/applications-map (kbd "c") 'Morfi) + (define-key Morfi (kbd "t") 'create-keimenografos) + + + (defvar thanos/vterm-map (make-sparse-keymap)) + (define-prefix-command 'thanos/vterm-map) + (define-key global-map (kbd "C-c v") 'thanos/vterm-map) + (define-key thanos/vterm-map (kbd "n") 'multi-vterm-next) + (define-key thanos/vterm-map (kbd "p") 'multi-vterm-prev) + (define-key thanos/vterm-map (kbd "d") 'multi-vterm-dedicated-open) + (define-key thanos/vterm-map (kbd "o") 'multi-vterm) +#+end_src +*** General +#+begin_src emacs-lisp + + ;; my general's leader key! + (defconst general-key "C-c g") + + (general-create-definer general-does + :prefix general-key) + + ;; Basic functions + (general-define-key + "C-d" 'kill-region + "C-k" 'copy-region-as-kill + "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 + "e" 'eshell + "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-does + :keymaps 'eshell-mode-map + "n" 'eshell-new) + + (general-does + :keymaps 'org-mode-map + "3" 'org-insert-image-size-300) +#+end_src +** ChatGPT +#+begin_src emacs-lisp + (if is-hermes + (setq openai-key (password-store-get "chatgpt/api2")) + (setq openai-key (password-store-get "chatgpt/api"))) +#+end_src +** Circe #+begin_src emacs-lisp - (add-to-list 'load-path "~/dotfiles/.emacs.d/lisp/") - (require 'erc-sasl) - ;; Add SASL server to list of SASL servers (start a new list, if it did not exist) - (add-to-list 'erc-sasl-server-regexp-list "irc\\.libera\\.chat") - - ;; Redefine/Override the erc-login() function from the erc package, so that - ;; it now uses SASL - (defun erc-login () - "Perform user authentication at the IRC server. (PATCHED)" - (erc-log (format "login: nick: %s, user: %s %s %s :%s" - (erc-current-nick) - (user-login-name) - (or erc-system-name (system-name)) - erc-session-server - erc-session-user-full-name)) - (if erc-session-password - (erc-server-send (format "PASS %s" erc-session-password)) - (message "Logging in without password")) - (when (and (featurep 'erc-sasl) (erc-sasl-use-sasl-p)) - (erc-server-send "CAP REQ :sasl")) - (erc-server-send (format "NICK %s" (erc-current-nick))) - (erc-server-send - (format "USER %s %s %s :%s" - ;; hacked - S.B. - (if erc-anonymous-login erc-email-userid (user-login-name)) - "0" "*" - erc-session-user-full-name)) - (erc-update-mode-line)) - - (erc-tls :server "irc.libera.chat" :port 6697 :nick "thanos_apollo" - :full-name "thanos_apollo" - :password (password-store-get "liberachat/thanos_apollo")) - - ;; (defun erc-connect () - ;; (interactive) - ;; (erc-tls :server "irc.libera.chat" :port 6697 :nick "thanos" - ;; :full-name "thanos_apollo" - ;; :password (password-store-get "liberachat/thanos_apollo"))) - - ;; ;; + (setq circe-network-options + `(("Libera Chat" + :host "irc.libera.chat" :port 6697 :tls t + :nick "thanosapollo" + :sasl-username "thanos_apollo" + :channels ("#emacs" "#emacs-circe") + :sasl-password ,(password-store-get "liberachat/thanos_apollo") + ))) #+end_src |