From 8cb86a87a313b2b38e4e14e03f739b2acbbe3f90 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 6 Dec 2025 06:09:42 -0500 Subject: [PATCH] separate into files --- .gitignore | 5 +- elisp/appearance-settings.el | 16 ++++ elisp/blog-settings.el | 24 ++++++ elisp/exwm-settings.el | 54 ++++++++++++++ elisp/irc-settings.el | 28 +++++++ elisp/keybind-settings.el | 8 ++ elisp/laptop-settings.el | 3 + init.el | 140 ++++++++--------------------------- 8 files changed, 168 insertions(+), 110 deletions(-) create mode 100644 elisp/appearance-settings.el create mode 100644 elisp/blog-settings.el create mode 100644 elisp/exwm-settings.el create mode 100644 elisp/irc-settings.el create mode 100644 elisp/keybind-settings.el create mode 100644 elisp/laptop-settings.el diff --git a/.gitignore b/.gitignore index 178f481..bef145b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,7 @@ elpa url *.data eshell -auto-save-list \ No newline at end of file +auto-save-list +multisession +games +transient \ No newline at end of file diff --git a/elisp/appearance-settings.el b/elisp/appearance-settings.el new file mode 100644 index 0000000..c85794c --- /dev/null +++ b/elisp/appearance-settings.el @@ -0,0 +1,16 @@ +(menu-bar-mode -1) +(tool-bar-mode -1) +(display-time-mode) +(defun my-display-numbers-hook () + (display-line-numbers-mode 1) + ) +(defun my-spotlight-mode-hook () + (hl-line-mode 1) + ) +(add-hook 'prog-mode-hook 'my-display-numbers-hook) +(add-hook 'text-mode-hook 'my-display-numbers-hook) +(add-hook 'prog-mode-hook 'my-spotlight-mode-hook) +(add-hook 'text-mode-hook 'my-spotlight-mode-hook) +(add-hook 'dired-mode-hook 'my-spotlight-mode-hook) +(setq-default cursor-type 'box) +(provide 'appearance-settings) diff --git a/elisp/blog-settings.el b/elisp/blog-settings.el new file mode 100644 index 0000000..1181786 --- /dev/null +++ b/elisp/blog-settings.el @@ -0,0 +1,24 @@ +(defun open-site () (interactive)(dired "/ssh:admin@feelinblue.wiki#9051:/usr/local/www/nanachi/")) + +(defun insert-html-keybind (keybind) + (interactive "sKeybind:") + (insert "" keybind "") + ) +(defun insert-html-blogpost-tag (tag) + (interactive "sTag:") + (insert "" tag"") + ) +(defun insert-html-template () + (interactive) + (insert " + + + + + + ⬅️ Back + + +") + ) +(provide 'blog-settings) diff --git a/elisp/exwm-settings.el b/elisp/exwm-settings.el new file mode 100644 index 0000000..8539348 --- /dev/null +++ b/elisp/exwm-settings.el @@ -0,0 +1,54 @@ +(use-package exwm + :config + ;; Set the default number of workspaces + (setq exwm-workspace-number 5) + + ;; When window "class" updates, use it to set the buffer name + ;; (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) + + ;; These keys should always pass through to Emacs + (setq exwm-input-prefix-keys + '(?\C-x + ?\C-u + ?\C-h + ?\M-x + ?\M-` + ?\M-& + ?\M-: + ?\C-\M-j ;; Buffer list + ?\C-\ )) ;; Ctrl+Space + + ;; Ctrl+Q will enable the next key to be sent directly + (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + + ;; Set up global key bindings. These always work, no matter the input state! + ;; Keep in mind that changing this list after EXWM initializes has no effect. + (setq exwm-input-global-keys + `( + ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) + ([?\s-r] . exwm-reset) + + ;; Move between windows + ([s-left] . windmove-left) + ([s-right] . windmove-right) + ([s-up] . windmove-up) + ([s-down] . windmove-down) + + ;; Launch applications via shell command + ([?\s-&] . (lambda (command) + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command command nil command))) + + ;; Switch workspace + ([?\s-w] . exwm-workspace-switch) + + ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9)))) + + (exwm-wm-mode)) +(provide 'exwm-settings) diff --git a/elisp/irc-settings.el b/elisp/irc-settings.el new file mode 100644 index 0000000..5837c03 --- /dev/null +++ b/elisp/irc-settings.el @@ -0,0 +1,28 @@ +(setq circe-network-options + '(("Libera Chat" + :tls t + :tls-keylist (("/home/tate/.config/weechat/libera.pem" + "/home/tate/.config/weechat/libera.pem")) + :host "irc.libera.chat" + :sasl-external t + :nick "nanach1" + :channels ("#emacs" "##japanese" "#openbsd" "##") + ))) + +(setq circe-reduce-lurker-spam t) +(enable-circe-color-nicks) +(add-hook 'circe-chat-mode-hook 'my-circe-prompt) +(defun my-circe-prompt () + (lui-set-prompt + (concat (propertize (concat (buffer-name) ">") + 'face 'circe-prompt-face) + " "))) +(setq + lui-time-stamp-position 'left-margin + lui-time-stamp-format "%H:%M") +(add-hook 'lui-mode-hook 'my-circe-set-margin) +(defun my-circe-set-margin () + (setq left-margin-width 5)) +(setq circe-format-say "{nick:-16s} {body}") +(setq circe-format-self-say "<{nick}> {body}") +(provide 'irc-settings) diff --git a/elisp/keybind-settings.el b/elisp/keybind-settings.el new file mode 100644 index 0000000..0b7b5d0 --- /dev/null +++ b/elisp/keybind-settings.el @@ -0,0 +1,8 @@ +(keymap-global-set "C-c d" (lambda () (interactive) + (call-process-shell-command "firefox &") + )) +(keymap-global-set "C-c s" (lambda () (interactive) (term "/bin/ksh") + )) +(keymap-global-set "C-c e" 'eshell) +(keymap-global-set "C-c f" 'elfeed) +(provide 'keybind-settings) diff --git a/elisp/laptop-settings.el b/elisp/laptop-settings.el new file mode 100644 index 0000000..d24c306 --- /dev/null +++ b/elisp/laptop-settings.el @@ -0,0 +1,3 @@ +(keymap-global-set "C-c b u" (lambda () (interactive) (call-process-shell-command "xbacklight -inc 10 &"))) +(keymap-global-set "C-c b d" (lambda () (interactive) (call-process-shell-command "xbacklight -dec 10 &"))) +(provide 'laptop-settings) diff --git a/init.el b/init.el index 2a7be64..9d85850 100644 --- a/init.el +++ b/init.el @@ -1,8 +1,16 @@ -(add-to-list 'load-path "~/.emacs.d/elisp/") -;; OpenBSD KNF for C/C++ -(require 'openbsd-knf-style) -(c-add-style "OpenBSD" openbsd-knf-style) -(setq c-default-style '((c-mode . "OpenBSD"))) +(add-to-list 'load-path "~/.emacs.d/elisp") +(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. + '(default ((t (:inherit nil :extend nil :stipple nil :background "#25202a" :foreground "#cfccd2" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight regular :height 102 :width normal :foundry "xos4" :family "Screen")))) + '(line-number ((t (:inherit (shadow default) :background "gray9")))) + '(line-number-current-line ((t (:inherit line-number :foreground "dark goldenrod")))) + '(mode-line ((t (:box (:line-width (2 . 2) :color "grey75" :style released-button))))) + '(mode-line-active ((t (:inherit mode-line)))) + '(tab-bar ((t (:inherit default :background "black" :foreground "white" :box nil))))) + (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -10,7 +18,8 @@ ;; If there is more than one, they won't work right. '(blink-cursor-mode nil) '(circe-default-realname "narehate") - '(custom-enabled-themes '(inkpot)) + '(circe-default-user "narehate") + '(custom-enabled-themes nil) '(custom-safe-themes '("2422f18687980d29da5e276547171c99f1cc1b2cb4cdbec124a53e1f34143001" "058ba0ed929f801fc4077617e816797654c7775382943520875642d5507d8696" @@ -22,120 +31,33 @@ default)) '(elfeed-feeds '("https://bimshwel.com/?feed=rss2")) '(package-selected-packages - '(abyss-theme acme-theme circe dirvish elfeed evangelion-theme exwm - faff-theme inkpot-theme inverse-acme-theme mingus - pass vmd-mode)) + '(abc-mode abyss-theme acme-theme circe dirvish elfeed + evangelion-theme exwm faff-theme helm inkpot-theme + inverse-acme-theme mingus nerd-icons pass vmd-mode w3m + ytdious)) '(rmail-spool-directory "/home/tate/Mail/INBOX") '(tab-bar-mode t) '(tool-bar-mode nil) '(transient-mark-mode nil)) -(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. - '(default ((t (:inherit nil :extend nil :stipple nil :background "#1e1e27" :foreground "#cfbfad" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight regular :height 91 :width normal :foundry "SGI" :family "Comic Mono")))) - '(line-number ((t (:inherit (shadow default) :background "gray9")))) - '(line-number-current-line ((t (:inherit line-number :foreground "dark goldenrod")))) - '(mode-line ((t (:background "indian red" :foreground "white" :box nil)))) - '(mode-line-active ((t (:inherit mode-line :background "purple"))))) -;; -;; ====== Appearance ====== -;; -(menu-bar-mode -1) -(tool-bar-mode -1) -(display-time-mode) -(defun my-display-numbers-hook () - (display-line-numbers-mode 1) - ) -(defun my-spotlight-mode-hook () - (hl-line-mode 1) - ) -(add-hook 'prog-mode-hook 'my-display-numbers-hook) -(add-hook 'text-mode-hook 'my-display-numbers-hook) -(add-hook 'prog-mode-hook 'my-spotlight-mode-hook) -(add-hook 'text-mode-hook 'my-spotlight-mode-hook) -(add-hook 'dired-mode-hook 'my-spotlight-mode-hook) -(setq-default cursor-type 'box) -;; -;; ====== Keybinds ====== -;; +(require 'laptop-settings) +(require 'irc-settings) +(require 'appearance-settings) +(require 'keybind-settings) +(require 'blog-settings) +(require 'openbsd-knf-style) +(require 'exwm-settings) +(c-add-style "OpenBSD" openbsd-knf-style) +(setq c-default-style '((c-mode . "OpenBSD"))) -(keymap-global-set "C-c s" (lambda () (interactive) (term "/bin/ksh"))) -(keymap-global-set "C-c e" 'eshell) -(keymap-global-set "C-c f" 'elfeed) -;; -;; ====== Exwm ====== -;; +;; melpa -(use-package exwm - :config - ;; Set the default number of workspaces - (setq exwm-workspace-number 5) - - ;; When window "class" updates, use it to set the buffer name - ;; (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) - - ;; These keys should always pass through to Emacs - (setq exwm-input-prefix-keys - '(?\C-x - ?\C-u - ?\C-h - ?\M-x - ?\M-` - ?\M-& - ?\M-: - ?\C-\M-j ;; Buffer list - ?\C-\ )) ;; Ctrl+Space - - ;; Ctrl+Q will enable the next key to be sent directly - (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) - - ;; Set up global key bindings. These always work, no matter the input state! - ;; Keep in mind that changing this list after EXWM initializes has no effect. - (setq exwm-input-global-keys - `( - ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) - ([?\s-r] . exwm-reset) - - ;; Move between windows - ([s-left] . windmove-left) - ([s-right] . windmove-right) - ([s-up] . windmove-up) - ([s-down] . windmove-down) - - ;; Launch applications via shell command - ([?\s-&] . (lambda (command) - (interactive (list (read-shell-command "$ "))) - (start-process-shell-command command nil command))) - - ;; Switch workspace - ([?\s-w] . exwm-workspace-switch) - - ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 9)))) - - (exwm-wm-mode)) (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities` ;; and `package-pinned-packages`. Most users will not need or want to do this. ;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (package-initialize) -(setq circe-network-options - '(("Libera Chat" - :tls t - :tls-keylist (("/home/tate/.config/weechat/libera.pem" - "/home/tate/.config/weechat/libera.pem")) - :host "irc.libera.chat" - :sasl-external t - :nick "nanach1" - :channels ("#emacs") - ))) + +