From 80936a2ca09153463ef4ea9c3a976d87679f55b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Sun, 27 Oct 2024 17:07:04 -0700 Subject: emacs: mv hydra.el and global bindings to package rul-bindings --- .emacs.d/init.el | 13 +------ .emacs.d/rul-emacs.org | 16 +------- .emacs.d/rul-init.d/fonts.el | 30 --------------- .emacs.d/rul-init.d/hydra.el | 48 ------------------------ .emacs.d/rul-lisp/packages/rul-bindings.el | 59 ++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 105 deletions(-) delete mode 100644 .emacs.d/rul-init.d/fonts.el delete mode 100644 .emacs.d/rul-init.d/hydra.el create mode 100644 .emacs.d/rul-lisp/packages/rul-bindings.el diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d595255..f4aaa45 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -18,17 +18,6 @@ ;; Do not persist customizations (setq custom-file (make-temp-file "emacs-custom-")) -;; Global keybindings -(global-set-key (kbd "C-c R") 'revert-buffer) -(global-set-key (kbd "C-c w") 'whitespace-cleanup) - -(defun help/insert-em-dash () - "Inserts an EM-DASH (not a HYPEN, not an N-DASH)" - (interactive) - (insert "—")) - -(global-set-key (kbd "C--") #'help/insert-em-dash) - (setq fill-column 79) ; Wrap lines (setq mouse-yank-at-point t) ; Do not follow mouse curors when mouse-yanking @@ -70,6 +59,7 @@ (dolist (path '("~/.emacs.d/rul-lisp/config" "~/.emacs.d/rul-lisp/packages")) (add-to-list 'load-path path)) +(require 'rul-bindings) (require 'rul-completion) (require 'rul-fm) (require 'rul-fonts) @@ -83,7 +73,6 @@ (require 'rul-write) ;; Init parts (will be deprecated in favor of packages) -(load-file "~/.emacs.d/rul-init.d/hydra.el") (load-file "~/.emacs.d/rul-init.d/ibuffer.el") (load-file "~/.emacs.d/rul-init.d/imenu.el") (load-file "~/.emacs.d/rul-init.d/magit.el") diff --git a/.emacs.d/rul-emacs.org b/.emacs.d/rul-emacs.org index 9e5fec4..186aace 100644 --- a/.emacs.d/rul-emacs.org +++ b/.emacs.d/rul-emacs.org @@ -119,21 +119,7 @@ Configurations that need persisting will be added to =custom-set-variables= and ;; Do not persist customizations (setq custom-file (make-temp-file "emacs-custom-")) #+end_src -** Global keybindings -This section defines keybindings common across all modes. -#+begin_src emacs-lisp :tangle "init.el" -;; Global keybindings -(global-set-key (kbd "C-c R") 'revert-buffer) -(global-set-key (kbd "C-c w") 'whitespace-cleanup) - -(defun help/insert-em-dash () - "Inserts an EM-DASH (not a HYPEN, not an N-DASH)" - (interactive) - (insert "—")) - -(global-set-key (kbd "C--") #'help/insert-em-dash) -#+end_src ** Editor interface General configurations related to text editing across all modes. @@ -189,6 +175,7 @@ Now, I simply start it from Emacs itself. This approach works well for me. (dolist (path '("~/.emacs.d/rul-lisp/config" "~/.emacs.d/rul-lisp/packages")) (add-to-list 'load-path path)) +(require 'rul-bindings) (require 'rul-completion) (require 'rul-fm) (require 'rul-fonts) @@ -202,7 +189,6 @@ Now, I simply start it from Emacs itself. This approach works well for me. (require 'rul-write) ;; Init parts (will be deprecated in favor of packages) -(load-file "~/.emacs.d/rul-init.d/hydra.el") (load-file "~/.emacs.d/rul-init.d/ibuffer.el") (load-file "~/.emacs.d/rul-init.d/imenu.el") (load-file "~/.emacs.d/rul-init.d/magit.el") diff --git a/.emacs.d/rul-init.d/fonts.el b/.emacs.d/rul-init.d/fonts.el deleted file mode 100644 index a7cb255..0000000 --- a/.emacs.d/rul-init.d/fonts.el +++ /dev/null @@ -1,30 +0,0 @@ -(use-package fontaine - :ensure t - :config - (setq fontaine-presets - '((tiny - :default-height 100) - (small - :default-height 120) - (medium - :default-height 140) - (large - :default-weight semilight - :default-height 180 - :bold-weight extrabold) - (presentation - :default-weight semilight - :default-height 200 - :bold-weight extrabold) - (jumbo - :default-weight semilight - :default-height 230 - :bold-weight extrabold) - (t - :default-family "Iosevka" - :default-weight regular - :default-height 140 - :variable-pitch-family "Iosevka Aile"))) - - ;; Set desired style from `fontaine-presets' - (fontaine-set-preset 'medium)) diff --git a/.emacs.d/rul-init.d/hydra.el b/.emacs.d/rul-init.d/hydra.el deleted file mode 100644 index 525162e..0000000 --- a/.emacs.d/rul-init.d/hydra.el +++ /dev/null @@ -1,48 +0,0 @@ -(use-package hydra - :ensure t - :defer 1) - -;; tab-bar -(defhydra hydra-tab-bar (:color amaranth) - "Tab Bar Operations" - ("t" tab-new "Create a new tab" :column "Creation" :exit t) - ("d" dired-other-tab "Open Dired in another tab") - ("f" find-file-other-tab "Find file in another tab") - ("x" tab-close "Close current tab") - ("m" tab-move "Move current tab" :column "Management") - ("r" tab-rename "Rename Tab") - ("" tab-bar-select-tab-by-name "Select tab by name" :column "Navigation") - ("l" tab-next "Next Tab") - ("j" tab-previous "Previous Tab") - ("q" nil "Exit" :exit t)) - -(global-set-key (kbd "C-x t") 'hydra-tab-bar/body) - -;; Zoom -(defhydra hydra-zoom () - "zoom" - ("g" text-scale-increase "in") - ("l" text-scale-decrease "out")) - -(global-set-key (kbd "C-c z") 'hydra-zoom/body) - -;; Go -(defhydra hydra-go () - "zoom" - ("=" gofmt :exit t) - ("c" go-coverage :exit t)) - -;; vterm -(defhydra hydra-vterm () - "zoom" - ("t" multi-vterm "Open a terminal" :exit t) - ("d" multi-vterm-dedicated-open "Dedicated" :exit t) - ("p" multi-vterm-prev "Previous terminal") - ("n" multi-vterm-next "Next terminal") - ("r" multi-vterm-rename-buffer "Rename buffer" :exit t) - ) - -(global-set-key (kbd "C-c t") 'hydra-vterm/body) - - -(global-set-key (kbd "C-c m") 'hydra-go/body) diff --git a/.emacs.d/rul-lisp/packages/rul-bindings.el b/.emacs.d/rul-lisp/packages/rul-bindings.el new file mode 100644 index 0000000..f337ee0 --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-bindings.el @@ -0,0 +1,59 @@ +;; Global keybindings +(global-set-key (kbd "C-c R") 'revert-buffer) +(global-set-key (kbd "C-c w") 'whitespace-cleanup) + +(defun help/insert-em-dash () + "Inserts an EM-DASH (not a HYPEN, not an N-DASH)" + (interactive) + (insert "—")) + +(global-set-key (kbd "C--") #'help/insert-em-dash) + +(use-package hydra + :ensure t + :defer 1) + +;; tab-bar +(defhydra hydra-tab-bar (:color amaranth) + "Tab Bar Operations" + ("t" tab-new "Create a new tab" :column "Creation" :exit t) + ("d" dired-other-tab "Open Dired in another tab") + ("f" find-file-other-tab "Find file in another tab") + ("x" tab-close "Close current tab") + ("m" tab-move "Move current tab" :column "Management") + ("r" tab-rename "Rename Tab") + ("" tab-bar-select-tab-by-name "Select tab by name" :column "Navigation") + ("l" tab-next "Next Tab") + ("j" tab-previous "Previous Tab") + ("q" nil "Exit" :exit t)) + +(global-set-key (kbd "C-x t") 'hydra-tab-bar/body) + +;; Zoom +(defhydra hydra-zoom () + "zoom" + ("g" text-scale-increase "in") + ("l" text-scale-decrease "out")) + +(global-set-key (kbd "C-c z") 'hydra-zoom/body) + +;; Go +(defhydra hydra-go () + "zoom" + ("=" gofmt :exit t) + ("c" go-coverage :exit t)) + +;; vterm +(defhydra hydra-vterm () + "zoom" + ("t" multi-vterm "Open a terminal" :exit t) + ("d" multi-vterm-dedicated-open "Dedicated" :exit t) + ("p" multi-vterm-prev "Previous terminal") + ("n" multi-vterm-next "Next terminal") + ("r" multi-vterm-rename-buffer "Rename buffer" :exit t) + ) + +(global-set-key (kbd "C-c t") 'hydra-vterm/body) +(global-set-key (kbd "C-c m") 'hydra-go/body) + +(provide 'rul-bindings) -- cgit v1.2.3