Commit 156552334436

Vincent Demeester <vincent@sbr.pm>
2025-04-18 01:57:04
tools/emacs: experimenting with keybindings…
Removing general.el Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent a51fc4f
tools/emacs/config/config-completion.el
@@ -48,27 +48,28 @@
   ("M-s M-y" . consult-yank-pop)
   ("M-s M-s" . consult-outline)
   :config
-  (general-leader
-    "y"  #'(consult-yank-pop :which-key "Clipboard history")
-    "b"  '(:ignore t :which-key "buffer")
-    "bb" #'(consult-buffer :which-key "switch buffer")
-    "bd" #'(kill-current-buffer :which-key "kill buffer")
-    "bD" #'((lambda ()(interactive)(kill-current-buffer)(tab-close)) :wk "Kill buffer and tab")
-    "bn" #'(next-buffer :which-key "next buffer")
-    "bp" #'(previous-buffer :which-key "previous buffer")
-    "s"  '(:ignore t :which-key "search")
-    "sg" #'(consult-grep :which-key "Consult grep in current directory")
-    "sR" #'(consult-ripgrep :which-key "Consult ripgrep in current directory")
-    "sr" '(:ignore t :which-key "rg.el")'
-    "srp" #'(rg-project :which-key "rg.el in current project")
-    "srs" #'(rg-dwim :which-key "rg.el Do What I Mean")
-    "sh"  #'(Info-goto-emacs-command-node :wk "Search help")
-    "sc"  #'(consult-mode-command :wk "Mode Command")
-    "s/"  #'(consult-isearch-history :wk "Consult Isearch history")
-    "g"  '(:ignore t :which-key "go")
-    "gu" #'(ffap-next-url :which-key "next url")
-    "gd" #'(xref-find-definitions :which-key "find definition")
-    "gD" #'(xref-find-definitions-other-window :which-key "find definition (other window)")))
+  ;; (general-leader
+  ;;   "y"  #'(consult-yank-pop :which-key "Clipboard history")
+  ;;   "b"  '(:ignore t :which-key "buffer")
+  ;;   "bb" #'(consult-buffer :which-key "switch buffer")
+  ;;   "bd" #'(kill-current-buffer :which-key "kill buffer")
+  ;;   "bD" #'((lambda ()(interactive)(kill-current-buffer)(tab-close)) :wk "Kill buffer and tab")
+  ;;   "bn" #'(next-buffer :which-key "next buffer")
+  ;;   "bp" #'(previous-buffer :which-key "previous buffer")
+  ;;   "s"  '(:ignore t :which-key "search")
+  ;;   "sg" #'(consult-grep :which-key "Consult grep in current directory")
+  ;;   "sR" #'(consult-ripgrep :which-key "Consult ripgrep in current directory")
+  ;;   "sr" '(:ignore t :which-key "rg.el")'
+  ;;   "srp" #'(rg-project :which-key "rg.el in current project")
+  ;;   "srs" #'(rg-dwim :which-key "rg.el Do What I Mean")
+  ;;   "sh"  #'(Info-goto-emacs-command-node :wk "Search help")
+  ;;   "sc"  #'(consult-mode-command :wk "Mode Command")
+  ;;   "s/"  #'(consult-isearch-history :wk "Consult Isearch history")
+  ;;   "g"  '(:ignore t :which-key "go")
+  ;;   "gu" #'(ffap-next-url :which-key "next url")
+  ;;   "gd" #'(xref-find-definitions :which-key "find definition")
+  ;;   "gD" #'(xref-find-definitions-other-window :which-key "find definition (other window)"))
+  )
 
 (use-package consult-imenu
   :after (consult)
tools/emacs/config/config-keybindings.el
@@ -10,32 +10,51 @@
 ;; See https://www.masteringemacs.org/article/text-expansion-hippie-expand
 (global-set-key [remap dabbrev-expand] 'hippie-expand)
 
-;; TODO add general configuration here
-(use-package general
-  :config
+(use-package vde-simple
+  :demand t
+  :preface
   (dolist (key '("C-M-<SPC>" "M-<SPC>"))
     (global-unset-key (kbd key)))
-  (general-create-definer general-leader :prefix "M-<SPC>")
-  (general-def "C-M-<SPC>" 'cycle-spacing)
+  :bind
+  (("M-<SPC> e" . dired-jump)
+   ("M-<SPC> x" . execute-extended-command)
+   ("M-<SPC> :" . eval-expression)
+   ("M-<SPC> <SPC>" . (lambda()(interactive)
+			(let ((consult-buffer-filter))
+			  (add-to-list 'consult-buffer-filter "\\*")
+			  (call-interactively 'consult-buffer))))
+   ("M-<SPC> f f" . project-find-file)
+   ("M-<SPC> f o" . ffap)
+   ("M-<SPC> f q" . read-only-mode)
+   ("M-<SPC> f r" . consult-recent-file)
+   ("M-<SPC> q q" . save-buffers-kill-terminal)))
 
-  (general-leader
-    "z"   #'(repeat :which-key "Repeat")
-    "u"   #'(universal-argument :which-key "Universal argument")
-    "e"   #'(dired-jump :which-key "Dired")
-    "x"   #'(execute-extended-command :which-key "M-x")
-    "f"   '(:ignore t :which-key "File")
-    "SPC" #'((lambda()(interactive)
-               (let ((consult-buffer-filter))
-                 (add-to-list 'consult-buffer-filter "\\*")
-                 (call-interactively 'consult-buffer))) :wk "Switch to Buffer")
-    ":"   #'(eval-expression :wk "Eval expression")
-    "ff"  #'(project-find-file :which-key "Find in Project")
-    "fo"  #'(ffap :which-key "Find with context")
-    "fq"  #'(read-only-mode :which-key "Toggle Read Only")
-    "fr"  #'(consult-recent-file :which-key "Recent File")
-    "q"   #'(:ignore t :wk "Quit")
-    "qq"  #'(save-buffers-kill-terminal :wk "Quit Emacs")
-   ))
+;; TODO add general configuration here
+;; (use-package general
+;;   :config
+;;   (dolist (key '("C-M-<SPC>" "M-<SPC>"))
+;;     (global-unset-key (kbd key)))
+;;   (general-create-definer general-leader :prefix "M-<SPC>")
+;;   (general-def "C-M-<SPC>" 'cycle-spacing)
+;; 
+;;   (general-leader
+;;     "z"   #'(repeat :which-key "Repeat")
+;;     "u"   #'(universal-argument :which-key "Universal argument")
+;;     "e"   #'(dired-jump :which-key "Dired")
+;;     "x"   #'(execute-extended-command :which-key "M-x")
+;;     "f"   '(:ignore t :which-key "File")
+;;     "SPC" #'((lambda()(interactive)
+;;                (let ((consult-buffer-filter))
+;;                  (add-to-list 'consult-buffer-filter "\\*")
+;;                  (call-interactively 'consult-buffer))) :wk "Switch to Buffer")
+;;     ":"   #'(eval-expression :wk "Eval expression")
+;;     "ff"  #'(project-find-file :which-key "Find in Project")
+;;     "fo"  #'(ffap :which-key "Find with context")
+;;     "fq"  #'(read-only-mode :which-key "Toggle Read Only")
+;;     "fr"  #'(consult-recent-file :which-key "Recent File")
+;;     "q"   #'(:ignore t :wk "Quit")
+;;     "qq"  #'(save-buffers-kill-terminal :wk "Quit Emacs")
+;;    ))
 
 ;; 
 (provide 'config-keybindings)
tools/emacs/config/config-llm.el
@@ -157,14 +157,13 @@ Here is the result of `git diff --cached`:")
         ("C-c C-k" . gptel-abort)
         ("C-c C-m" . gptel-menu)
         ("C-c C-c" . gptel-send))
-  :general
-  (general-leader
-    "o"   '(:ignore t :wk "GPTel")
-    "o o" '(gptel :wk "Start GPTel")
-    "o m" '(gptel-menu :wk "GPTel menu"))
   :custom
   (gptel-default-mode #'markdown-mode)
   :config
+  ;; (general-leader
+  ;;   "o"   '(:ignore t :wk "GPTel")
+  ;;   "o o" '(gptel :wk "Start GPTel")
+  ;;   "o m" '(gptel-menu :wk "GPTel menu"))
   (require 'gptel-curl)
   (require 'gptel-gemini)
   (require 'gptel-ollama)
@@ -253,18 +252,19 @@ Here is the result of `git diff --cached`:")
 
 (use-package gptel-context
   :after gptel
-  :general
-  (general-leader
-    "o c" '(:ignore t :which-key "GPTel Context")
-    "o c a" 'gptel-context-add
-    "o c r" 'gptel-context-remove
-    "o c s" '(lambda ()
-               (interactive)
-               (gptel-context-remove-all nil)
-               (unless (use-region-p)
-                 (mark-defun))
-               (gptel-context-add)
-               (my-switch-to-gptel-buffer))))
+  :config
+  ;; (general-leader
+  ;;   "o c" '(:ignore t :which-key "GPTel Context")
+  ;;   "o c a" 'gptel-context-add
+  ;;   "o c r" 'gptel-context-remove
+  ;;   "o c s" '(lambda ()
+  ;;              (interactive)
+  ;;              (gptel-context-remove-all nil)
+  ;;              (unless (use-region-p)
+  ;;                (mark-defun))
+  ;;              (gptel-context-add)
+  ;;              (my-switch-to-gptel-buffer)))
+  )
 
 (defun my-switch-to-gptel-buffer (&optional arg)
   "Switch to the most recent buffer with gptel-mode enabled or start it."
tools/emacs/config/config-navigating.el
@@ -116,7 +116,6 @@
               ("i" . Man-goto-section)
               ("g" . Man-update-manpage)))
 
-(use-package bookmark+)
 (use-package bookmark)
 (use-package casual-bookmarks
   :bind (:map bookmark-bmenu-mode-map
tools/emacs/config/config-projects.el
@@ -46,19 +46,20 @@
     (interactive)
     (magit-status (vde-project--project-current)))
 
-  (general-leader
-    "p"  '(:ignore :which-key "Project")
-    "pp"  #'(project-switch-project :which-key "Switch to Project")
-    "ps"  #'(project-search :which-key "Grep in Project")
-    "pf"  #'(project-find-file :which-key "Find in Project")
-    "pd"  #'(project-dired :which-key "Dired in Project")
-    "pc"  #'(project-compile :which-key "Compile in Project")
-    "pb"  #'(project-switch-to-buffer :which-key "Switch to Project Buffer")
-    "pk"  #'(project-kill-buffers :which-key "Kill Project Buffers")
-    "ps"  #'(vde/project-vterm :which-key "Start a vterm in Project")
-    "pe"  #'(project-eshell :which-key "Start a eshell in Project")
-    "pE"  #'(vde/project-eat :which-key "Start a eat term in Project")
-    "px"  #'(vde/project-run-in-vterm :which-key "Execute command in vterm in Project")))
+  ;; (general-leader
+  ;;   "p"  '(:ignore :which-key "Project")
+  ;;   "pp"  #'(project-switch-project :which-key "Switch to Project")
+  ;;   "ps"  #'(project-search :which-key "Grep in Project")
+  ;;   "pf"  #'(project-find-file :which-key "Find in Project")
+  ;;   "pd"  #'(project-dired :which-key "Dired in Project")
+  ;;   "pc"  #'(project-compile :which-key "Compile in Project")
+  ;;   "pb"  #'(project-switch-to-buffer :which-key "Switch to Project Buffer")
+  ;;   "pk"  #'(project-kill-buffers :which-key "Kill Project Buffers")
+  ;;   "ps"  #'(vde/project-vterm :which-key "Start a vterm in Project")
+  ;;   "pe"  #'(project-eshell :which-key "Start a eshell in Project")
+  ;;   "pE"  #'(vde/project-eat :which-key "Start a eat term in Project")
+  ;;   "px"  #'(vde/project-run-in-vterm :which-key "Execute command in vterm in Project"))
+  )
 
 (use-package conner
   :bind (("C-x p C" . conner-run-project-command))
tools/emacs/config/programming-config.el
@@ -45,8 +45,9 @@
   :bind
   ("M-s M-d" . consult-flymake)
   :config
-  (general-leader
-    "sd" #'(consult-flymake :which-key "Flymake diagnostics")))
+  ;; (general-leader
+  ;;   "sd" #'(consult-flymake :which-key "Flymake diagnostics"))
+  )
 
 (use-package flymake-yamllint
   :after yaml-ts-mode
tools/emacs/lisp/vde-simple.el
@@ -0,0 +1,24 @@
+;;; vde-simple --- Common functions for my configuration -*- lexical-binding: t -*-
+
+;; Copyright (C) 2025 Vincent Demeester
+;; Author: Vincent Demeester <vincent@sbr.pm>
+
+;; This file is NOT part of GNU Emacs.
+;;; Commentary:
+;;
+;; Simple and useful function for a lot of things.
+;;
+;;; Code:
+
+(defvar vde-simple-override-mode-map (make-sparse-keymap)
+  "Key map of `vde-simple-override-mode'.
+Enable that mode to have its key bindings to take effect over those of the major mode.")
+
+(define-minor-mode vde-simple-override-mode
+  "Enable the `vde-simple-override-mode-map'."
+  :init-value nil
+  :global t
+  :keymap vde-simple-override-mode-map)
+
+(provide 'vde-simple)
+;;; vde-simple.el ends here
tools/emacs/init.el
@@ -248,10 +248,10 @@ The DWIM behaviour of this command is as follows:
 ;; Refactor this completely. Reduce to the minimum.
 (unless noninteractive
   (require '00-clean) ;; Maybe refactor no-littering
+  (require 'config-keybindings)
   (require 'config-editing)
   (require 'config-files)
   (require 'config-misc)
-  (require 'config-keybindings)
   (require 'config-appearance)
   (require 'config-buffers)
   (require 'config-compile)