diff options
author | Thanos Apollo <[email protected]> | 2023-04-23 12:28:08 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-04-23 12:28:08 +0300 |
commit | 6e69d475eba6fa8ab86e92dd12664e12bdbc86ee (patch) | |
tree | b95e02f61d4001f2152598d49424ea7a95ceb444 /.emacs.d/init.el | |
parent | 2ea7c0ebf40edb1717eb482e26abb9ae6912a145 (diff) |
emacs: Add circe configuration, restracture custom as misc heading
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r-- | .emacs.d/init.el | 438 |
1 files changed, 204 insertions, 234 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 68e6213..8d43d53 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -350,200 +350,6 @@ Contains the list of packages that need to be installed.") ;; (setq eshell-prompt-function 'apollo-eshell-prompt) ;; (setq eshell-highlight-prompt t) -(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)) - -(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) - -;; 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) - -(setq openai-key (password-store-get "chatgpt/api2")) - (add-hook 'org-mode-hook 'org-make-toc-mode) (defun apollo/org-theme-dracula () @@ -930,43 +736,207 @@ Contains the list of packages that need to be installed.") (setq message-send-mail-function 'smtpmail-send-it smtpmail-stream-type 'ssl)) -(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"))) - -;; ;; +(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)) + +(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) + +;; 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) + +(if is-hermes + (setq openai-key (password-store-get "chatgpt/api2")) + (setq openai-key (password-store-get "chatgpt/api"))) + +(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") + ))) |