From 19efec2007aba973b236f1ebef3392e2f76e24ca Mon Sep 17 00:00:00 2001 From: Peter Tillemans Date: Mon, 17 Feb 2025 01:53:31 +0100 Subject: [PATCH] refactor AI support in separate section --- init.org | 889 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 455 insertions(+), 434 deletions(-) diff --git a/init.org b/init.org index 8405aa8..471f20d 100644 --- a/init.org +++ b/init.org @@ -1030,299 +1030,6 @@ Enables and configures Yasnippet, a template system for Emacs: #+RESULTS: : [nil 26481 25510 926111 nil elpaca-process-queues nil nil 690000 nil] -** Enable LLM access with Ellama -Configures access to language models using Ellama. I don't know -whether to put it under writing, comms or programming as it is equally -/useful(?)/ for either activity. So I promoted it to an Editor feature. - -#+BEGIN_SRC emacs-lisp - (use-package llm :ensure t) -#+END_SRC - -#+RESULTS: -: [nil 26497 15516 337719 nil elpaca-process-queues nil nil 495000 nil] - -#+RESULTS:g - -#+BEGIN_SRC emacs-lisp - (use-package ellama - :ensure t - :defer t - :requires (llm) - :config - (message "Ellama loaded") - (keymap-global-set "C-c e" 'ellama-transient-main-menu) - :custom - (ellama-language "English") - (ellama-sessions-directory (expand-file-name "~/Nextcloud/ellama-sessions")) - (ellama-providers - '(("openai" . (progn - (require 'llm-openai) - (make-llm-openai - :key (auth-source-pass-get 'secret "snamellit/openai-api-key") - :chat-model "gpt-4o")))) - )) -#+END_SRC - -#+RESULTS: -: [nil 26497 19957 511863 nil elpaca-process-queues nil nil 742000 nil] - - -It seems the *gpt-4o* model provides better responses. - -I should investigate local models more. - -*** Use Gemini with ellama - -This is mostly for those who want to use Google Cloud specifically, most users should use Gemini instead, which is easier to set up. - -You can set up with make-llm-vertex, with the following parameters: - - -| paramter | description | -|------------------+-------------------------------------------------------------------------------------------------------------------------| -| | | -| :project | Your project number from Google Cloud that has Vertex API enabled. | -| :chat-model | A model name from the list of Vertex's model names. This is optional, and will default to a reasonable model. | -| :embedding-model | A model name from the list of Vertex's embedding model names. This is optional, and will default to a reasonable model. | - -In addition to the provider, which you may want multiple of (for example, to charge against different projects), there are customizable variables: - - - llm-vertex-gcloud-binary: The binary to use for generating the API key. - - llm-vertex-gcloud-region: The gcloud region to use. It's good to set this to a region near where you are for best latency. Defaults to "us-central1". - - If you haven't already, you must run the following command before using this: - - -#+BEGIN_SRC shell :tangle no -gcloud beta services identity create --service=aiplatform.googleapis.com --project=PROJECT_ID -#+END_SRC - - -However this is not for the Gemini Code Assistant. It is unclear how -to use that backend. Gemini Code Assistant is part of the Google Cloud -Tools. -** Dired Configuration -Enables an alternative file navigation behavior in Dired, Emacs' directory editor: -#+BEGIN_SRC emacs-lisp - (put 'dired-find-alternate-file 'disabled nil) -#+END_SRC -** Use Magit for version control -#+BEGIN_SRC emacs-lisp - ;; default to magit for version control - (use-package magit - :ensure t - :commands (magit-status) - :bind - (("C-x p v" . magit-status) - (" p v" . magit-status))) - -#+END_SRC -** Better EDiff support -#+BEGIN_SRC emacs-lisp - ;; better ediff setting suggested by cwebber - (use-package ediff - :commands (ediff ediff-files ediff3 ediff-files3) - :config - (setq - ediff-window-setup-function 'ediff-setup-windows-plain - ediff-split-window-function 'split-window-horizontally)) -#+END_SRC - -#+RESULTS: -: t - -** Replace normal Buffer Support with IBuffer - -Configure ibuffer support with project contexts, courtesy of crafted -emacs - -#+BEGIN_SRC emacs-lisp - ;;; enhance ibuffer with ibuffer-project if it is available. - (defun snm-ide-enhance-ibuffer-with-ibuffer-project () - "Set up integration for `ibuffer' with `ibuffer-project'." - (setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups)) - (unless (eq ibuffer-sorting-mode 'project-file-relative) - (ibuffer-do-sort-by-project-file-relative))) - - (use-package ibuffer-project - :ensure t - :hook - (ibuffer-mode . snm-ide-enhance-ibuffer-with-ibuffer-project) - :bind (("C-x C-b" . #'ibuffer))) -#+END_SRC -** Enable EditorConfig Standard Support -#+BEGIN_SRC emacs-lisp - ;;; load editorconfig support - (use-package editorconfig - :hook - (prog-mode . (lambda() (editorconfig-mode 1)))) -#+END_SRC - -#+RESULTS: -| editorconfig-mode | - -** Enable Direnv Integration - -Direnv is the key to have isolated project folders which maintain their own bubble to support whatever is done in that folder. -- set environment variables -- run prep scripts or start services -- load nix or guix profiles to provide support applications - -Emacs' direnv module gives first class support to Emacs projects so they use the right tools for the project. - -#+BEGIN_SRC emacs-lisp - ;; enable direnv mode - (use-package direnv - :ensure t - :config - (direnv-mode)) -#+END_SRC - -This enables direnv globally. - -** Configure Embark - -#+BEGIN_SRC emacs-lisp - (use-package embark - :ensure t - :bind - (("C-." . embark-act) - ("C-;" . embark-dwim) - ("C-h B" . embark-bindings)) - :config - (setq prefix-help-command #'embark-prefix-help-command)) - - ;; Consult users will also want the embark-consult package. - (use-package embark-consult - :ensure t ; only need to install it, embark loads it after consult if found - :hook - (embark-collect-mode . consult-preview-at-point-mode)) - -#+END_SRC - -#+RESULTS: -: [nil 26502 58499 164859 nil elpaca-process-queues nil nil 179000 nil] - -** Configure Helpful - -#+BEGIN_SRC emacs-lisp - (use-package helpful - :ensure t - :bind ( - ( " " . #'helpful-command) - ( " " . #'helpful-callable) - ( " " . #'helpful-key) - ( " " . #'helpful-symbol) - ( " " . #'helpful-variable) - ( "C-h F" . #'helpful-function))) -#+END_SRC - -#+RESULTS: -: [nil 26432 30485 62583 nil elpaca-process-queues nil nil 114000 nil] - -** Enable breadcrumbs - -Show breadcrumbs in the header line to keep context of the file being -worked on. See the [[https://github.com/joaotavora/breadcrumb][breadcrumb repo]] for more details. - -#+BEGIN_SRC emacs-lisp - (use-package breadcrumb - :ensure t - :init - (breadcrumb-mode)) -#+END_SRC - -#+RESULTS: -: [nil 26432 31533 350342 nil elpaca-process-queues nil nil 899000 nil] - -** Enable Avy jumping - -Avy mode replace ace-jump mode with a lot of functionality hidden - -see [[https://karthinks.com/software/avy-can-do-anything/][Avy can Do Anything]] article by the author on the design philosophy -behind it. - -#+BEGIN_SRC emacs-lisp - (use-package avy - :ensure t - :commands (avy-goto-char - avy-goto-char-2 - avy-goto-char-2-above - avy-goto-char-2-below - avy-goto-char-in-line - avy-goto-char-timer - avy-goto-line - avy-goto-line-above - avy-goto-line-below - avy-goto-subword-0 - avy-goto-subword-1 - avy-goto-symbol-1 - avy-goto-symbol-1-above - avy-goto-symbol-1-below - avy-goto-word-0 - avy-goto-word-1 - avy-goto-word-1-above - avy-goto-word-1-below - avy-goto-word-or-subword-1) - :bind - (("C-:" . avy-goto-char-timer) - ("M-g w" . avy-goto-word-0) - ("M-g f" . avy-goto-line)) - :config - (avy-setup-default) ;; setup C-' to jump with isearch - ) -#+END_SRC - -#+RESULTS: -: [nil 26507 37720 141708 nil elpaca-process-queues nil nil 278000 nil] - -Avy is supported by evil and setup in the *evil-integration* package. - -#+RESULTS: - -** Ace Window Configuration - -#+BEGIN_SRC emacs-lisp - (use-package ace-window - :ensure t - :bind - ("C-x o" . ace-window) - :config - (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)) - (setq aw-dispatch-always t)) -#+END_SRC - -#+RESULTS: -: [nil 26523 35809 462186 nil elpaca-process-queues nil nil 958000 nil] - -** Command Log Mode - -surprising sequence of events happened. Command Log Mode is a package -that records all the commands that are executed in the buffer and -provides a way to replay them. - -#+BEGIN_SRC emacs-lisp - (use-package command-log-mode - :ensure t - :commands (command-log-mode)) -#+END_SRC - -#+RESULTS: -: [nil 26503 37477 396927 nil elpaca-process-queues nil nil 128000 nil] - -** Abbrev Files - -#+BEGIN_SRC emacs-lisp - (use-package abbrev - :ensure nil - :config - (setq abbrev-file-name (expand-file-name "abbrev_defs" user-emacs-directory)) - (setq save-abbrevs 'silently) - (if (file-exists-p abbrev-file-name) - (quietly-read-abbrev-file))) -#+END_SRC - * Programming #+BEGIN_SRC emacs-lisp @@ -2110,152 +1817,11 @@ Map the keymap consistently to the eglot mappings. #+RESULTS: -** Copilot Support - -#+BEGIN_SRC emacs-lisp -(report-time-since-load "Programming - Copilot Support") -#+END_SRC - -#+BEGIN_SRC emacs-lisp :tangle yes - (use-package copilot - :ensure (copilot :host github :repo "zerolfx/copilot.el" - :branch "main" - :files ("dist" "*.el")) - :bind ("C-S-y" . copilot-accept-completion) - :config - (add-to-list 'copilot-indentation-alist '(scheme-mode . 2)) - (add-to-list 'copilot-indentation-alist '(emacs-lisp-mode . 2)) - (add-to-list 'copilot-indentation-alist '(lisp-mode . 2)) - :custom - (copilot-indent-offset-warning-disabled t "Disable indent offset warning" ) - - :hook - (prog-mode . copilot-mode) - (org-mode . copilot-mode)) -#+END_SRC - -#+RESULTS: -: [nil 26506 39443 528692 nil elpaca-process-queues nil nil 667000 nil] *** TODO move scheme configuration to the scheme section or leave it here but move it to config, whatever makes most sense at the moment. - -** SuperMaven Support - -There is a lot of positive hubbub around [[https://github.com/crazywolf132/supermaven.el][SuperMaven]]. - -#+BEGIN_SRC emacs-lisp :tangle no - (use-package supermaven - :ensure (supermaven :host github :repo "crazywolf132/supermaven.el" - :branch "main") - :init - (setq supermaven-ignore-filetypes '("org" "txt")) - (setq supermaven-disable-inline-completion nil) - (setq supermaven-keymaps - '((accept-suggestion . "TAB") - (clear-suggestion . "C-]") - (accept-word . "C-j"))) - (setq supermaven-log-level 'debug) - :hook (prog-mode . supermaven-mode)) -#+END_SRC - -#+RESULTS: -: [nil 26528 36711 407251 nil elpaca-process-queues nil nil 656000 nil] - - -<2025-01-28 Tue> Tried it out but did not work. I got following -errors : - - -#+BEGIN_SRC fundamental -[2025-01-28 14:47:15] [INFO] Supermaven process started successfully -[2025-01-28 14:47:17] [INFO] Stopping Supermaven process... -[2025-01-28 14:47:17] [INFO] Supermaven process killed - -[2025-01-28 14:47:17] [INFO] Supermaven process started successfully -[2025-01-28 14:47:19] [INFO] Stopping Supermaven process... -[2025-01-28 14:47:19] [INFO] Supermaven process killed - -[2025-01-28 14:47:19] [INFO] Supermaven process started successfully -[2025-01-28 14:47:21] [INFO] Stopping Supermaven process... -[2025-01-28 14:47:21] [INFO] Supermaven process killed - -[2025-01-28 14:47:21] [INFO] Supermaven process started successfully -[2025-01-28 14:47:21] [INFO] Stopping Supermaven process... -[2025-01-28 14:47:21] [INFO] Supermaven process killed - -[2025-01-28 14:47:21] [INFO] Supermaven process started successfully -[2025-01-28 14:47:21] [INFO] Supermaven process started successfully -[2025-01-28 14:47:22] [INFO] Supermaven process hangup -#+END_SRC - -In a separate terminal I see the pid change every 2 seconds. It seems -to work fine in vscode. +Not tested in neovim yet+. It works just fine -in Neovim. - -Supermaven requires company support at the moment. There is a [[https://github.com/crazywolf132/supermaven.el/issues/12][Feature -Request open]] to add corfu support. - -** Gemini Code Completion - -#+BEGIN_SRC emacs-lisp - (use-package google-gemini - :ensure (google-gemini - :host github - :repo "emacs-openai/google-gemini") - :config - (setq google-gemini-key (auth-source-pass-get 'secret "snamellit/gemini-api-key")) - ) -#+END_SRC - -#+RESULTS: -: [nil 26528 34920 363895 nil elpaca-process-queues nil nil 695000 nil] - -#+BEGIN_SRC emacs-lisp - (use-package gemini-code-completion - :ensure (gemini-code-completion - :host github - :repo "shishimaru/gemini-code-completion.el" - :files ("*.el")) - :bind - ("C-c g" . gemini-code-completion) - ) -#+END_SRC - -#+RESULTS: -: [nil 26528 34424 382719 nil elpaca-process-queues nil nil 536000 nil] - - -** Aider Support - -Aider is a package which works as a pair programming partner to -generate code. - -#+BEGIN_SRC emacs-lisp - (setq anthropic-api-key (auth-source-pass-get 'secret "snamellit/anthropic-api-key")) - (use-package aider - :ensure (:host github :repo "tninja/aider.el" :files ("aider.el")) - :config - ;; Use claude-3-5-sonnet cause it is best in aider benchmark - ;;(setq aider-args '("--model" "anthropic/claude-3-5-sonnet-20241022")) - ;;(setenv "ANTHROPIC_API_KEY" anthropic-api-key) - ;; Or use chatgpt model since it is most well known - ;; (setq aider-args '("--model" "gpt-4o-mini")) - ;; (setenv "OPENAI_API_KEY" ) - ;; Or use gemini v2 model since it is very good and free - (setq aider-args '("--model" "gemini/gemini-exp-1206")) - (setenv "GEMINI_API_KEY" google-gemini-key) - ;; - ;; Optional: Set a key binding for the transient menu - (global-set-key (kbd "C-c a") 'aider-transient-menu)) -#+END_SRC - -#+RESULTS: -: [nil 26528 35167 709869 nil elpaca-process-queues nil nil 408000 nil] - - ** Gitlab Support #+BEGIN_SRC emacs-lisp @@ -3031,6 +2597,461 @@ We can add a list of queries **** TODO explain what denote-dired-mode-in-directories does. +* AI Support + +** AI Provider API keys + +As many tools require API keys, I better define them once and reuse +them in the configuration of the individual tools. + +#+BEGIN_SRC emacs-lisp + (setq openai-api-key (auth-source-pass-get 'secret "snamellit/anthropic-api-key")) + (setq anthropic-api-key (auth-source-pass-get 'secret "snamellit/anthropic-api-key")) + (setq gemini-api-key (auth-source-pass-get 'secret "snamellit/gemini-api-key")) + +#+END_SRC + +#+RESULTS: +: AIzaSyBAkk0xHNkIBxCzkfvbOgYVb-B6BguWVUI + +** Enable LLM access with Ellama +Configures access to language models using Ellama. I don't know +whether to put it under writing, comms or programming as it is equally +/useful(?)/ for either activity. So I promoted it to an Editor feature. + +#+BEGIN_SRC emacs-lisp + (use-package llm :ensure t) +#+END_SRC + +#+RESULTS: +: [nil 26497 15516 337719 nil elpaca-process-queues nil nil 495000 nil] + +#+RESULTS:g + +#+BEGIN_SRC emacs-lisp + (use-package ellama + :ensure t + :defer t + :requires (llm) + :config + (message "Ellama loaded") + (keymap-global-set "C-c e" 'ellama-transient-main-menu) + :custom + (ellama-language "English") + (ellama-sessions-directory (expand-file-name "~/Nextcloud/ellama-sessions")) + (ellama-providers + '(("openai" . (progn + (require 'llm-openai) + (make-llm-openai + :key openai-api-key + :chat-model "gpt-4o")))) + )) +#+END_SRC + +#+RESULTS: +: [nil 26497 19957 511863 nil elpaca-process-queues nil nil 742000 nil] + + +It seems the *gpt-4o* model provides better responses. + +I should investigate local models more. + +*** Use Gemini with ellama + +This is mostly for those who want to use Google Cloud specifically, most users should use Gemini instead, which is easier to set up. + +You can set up with make-llm-vertex, with the following parameters: + + +| paramter | description | +|------------------+-------------------------------------------------------------------------------------------------------------------------| +| | | +| :project | Your project number from Google Cloud that has Vertex API enabled. | +| :chat-model | A model name from the list of Vertex's model names. This is optional, and will default to a reasonable model. | +| :embedding-model | A model name from the list of Vertex's embedding model names. This is optional, and will default to a reasonable model. | + +In addition to the provider, which you may want multiple of (for example, to charge against different projects), there are customizable variables: + + - llm-vertex-gcloud-binary: The binary to use for generating the API key. + - llm-vertex-gcloud-region: The gcloud region to use. It's good to set this to a region near where you are for best latency. Defaults to "us-central1". + + If you haven't already, you must run the following command before using this: + + +#+BEGIN_SRC shell :tangle no +gcloud beta services identity create --service=aiplatform.googleapis.com --project=PROJECT_ID +#+END_SRC + + +However this is not for the Gemini Code Assistant. It is unclear how +to use that backend. Gemini Code Assistant is part of the Google Cloud +Tools. +** Copilot Support + +#+BEGIN_SRC emacs-lisp +(report-time-since-load "Programming - Copilot Support") +#+END_SRC + +#+BEGIN_SRC emacs-lisp :tangle yes + (use-package copilot + :ensure (copilot :host github :repo "zerolfx/copilot.el" + :branch "main" + :files ("dist" "*.el")) + :bind ("C-S-y" . copilot-accept-completion) + :config + (add-to-list 'copilot-indentation-alist '(scheme-mode . 2)) + (add-to-list 'copilot-indentation-alist '(emacs-lisp-mode . 2)) + (add-to-list 'copilot-indentation-alist '(lisp-mode . 2)) + :custom + (copilot-indent-offset-warning-disabled t "Disable indent offset warning" ) + + :hook + (prog-mode . copilot-mode) + (org-mode . copilot-mode)) +#+END_SRC + +#+RESULTS: +: [nil 26506 39443 528692 nil elpaca-process-queues nil nil 667000 nil] + +** SuperMaven Support + +There is a lot of positive hubbub around [[https://github.com/crazywolf132/supermaven.el][SuperMaven]]. + +#+BEGIN_SRC emacs-lisp :tangle no + (use-package supermaven + :ensure (supermaven :host github :repo "crazywolf132/supermaven.el" + :branch "main") + :init + (setq supermaven-ignore-filetypes '("org" "txt")) + (setq supermaven-disable-inline-completion nil) + (setq supermaven-keymaps + '((accept-suggestion . "TAB") + (clear-suggestion . "C-]") + (accept-word . "C-j"))) + (setq supermaven-log-level 'debug) + :hook (prog-mode . supermaven-mode)) +#+END_SRC + +#+RESULTS: +: [nil 26528 36711 407251 nil elpaca-process-queues nil nil 656000 nil] + + +<2025-01-28 Tue> Tried it out but did not work. I got following +errors : + + +#+BEGIN_SRC fundamental +[2025-01-28 14:47:15] [INFO] Supermaven process started successfully +[2025-01-28 14:47:17] [INFO] Stopping Supermaven process... +[2025-01-28 14:47:17] [INFO] Supermaven process killed + +[2025-01-28 14:47:17] [INFO] Supermaven process started successfully +[2025-01-28 14:47:19] [INFO] Stopping Supermaven process... +[2025-01-28 14:47:19] [INFO] Supermaven process killed + +[2025-01-28 14:47:19] [INFO] Supermaven process started successfully +[2025-01-28 14:47:21] [INFO] Stopping Supermaven process... +[2025-01-28 14:47:21] [INFO] Supermaven process killed + +[2025-01-28 14:47:21] [INFO] Supermaven process started successfully +[2025-01-28 14:47:21] [INFO] Stopping Supermaven process... +[2025-01-28 14:47:21] [INFO] Supermaven process killed + +[2025-01-28 14:47:21] [INFO] Supermaven process started successfully +[2025-01-28 14:47:21] [INFO] Supermaven process started successfully +[2025-01-28 14:47:22] [INFO] Supermaven process hangup +#+END_SRC + +In a separate terminal I see the pid change every 2 seconds. It seems +to work fine in vscode. +Not tested in neovim yet+. It works just fine +in Neovim. + +Supermaven requires company support at the moment. There is a [[https://github.com/crazywolf132/supermaven.el/issues/12][Feature +Request open]] to add corfu support. + +** Gemini Code Completion + +#+BEGIN_SRC emacs-lisp + (use-package google-gemini + :ensure (google-gemini + :host github + :repo "emacs-openai/google-gemini") + :config + (setq google-gemini-key gemini-api-key) + ) +#+END_SRC + +#+RESULTS: +: [nil 26546 33151 856622 nil elpaca-process-queues nil nil 426000 nil] + +#+BEGIN_SRC emacs-lisp + (use-package gemini-code-completion + :ensure (gemini-code-completion + :host github + :repo "shishimaru/gemini-code-completion.el" + :files ("*.el")) + :bind + ("C-c g" . gemini-code-completion) + :config + ;;https://github.com/shishimaru/gemini-code-completion.el/issues/13 + (setq gemini-code-completion-min-number-of-candidates 1) + (setq gemini-code-completion-disable-completion-keybinding t) + ) +#+END_SRC + +#+RESULTS: +: [nil 26525 26586 616591 nil elpaca-process-queues nil nil 615000 nil] + +** Aider Support + +Aider is a package which works as a pair programming partner to +generate code. + +#+BEGIN_SRC emacs-lisp + (use-package aider + :ensure (:host github :repo "tninja/aider.el" :files ("aider.el")) + :config + ;; Use claude-3-5-sonnet cause it is best in aider benchmark + ;;(setq aider-args '("--model" "anthropic/claude-3-5-sonnet-20241022")) + ;;(setenv "ANTHROPIC_API_KEY" anthropic-api-key) + ;; Or use chatgpt model since it is most well known + ;; (setq aider-args '("--model" "gpt-4o-mini")) + ;; (setenv "OPENAI_API_KEY" ) + ;; Or use gemini v2 model since it is very good and free + (setq aider-args '("--model" "gemini/gemini-exp-1206")) + (setenv "GEMINI_API_KEY" google-gemini-key) + ;; + ;; Optional: Set a key binding for the transient menu + :bind + (" a" . aider-transient-menu) + ) +#+END_SRC + +#+RESULTS: +: [nil 26528 35167 709869 nil elpaca-process-queues nil nil 408000 nil] + + +** Dired Configuration +Enables an alternative file navigation behavior in Dired, Emacs' directory editor: +#+BEGIN_SRC emacs-lisp + (put 'dired-find-alternate-file 'disabled nil) +#+END_SRC +** Use Magit for version control +#+BEGIN_SRC emacs-lisp + ;; default to magit for version control + (use-package magit + :ensure t + :commands (magit-status) + :bind + (("C-x p v" . magit-status) + (" p v" . magit-status))) + +#+END_SRC +** Better EDiff support +#+BEGIN_SRC emacs-lisp + ;; better ediff setting suggested by cwebber + (use-package ediff + :commands (ediff ediff-files ediff3 ediff-files3) + :config + (setq + ediff-window-setup-function 'ediff-setup-windows-plain + ediff-split-window-function 'split-window-horizontally)) +#+END_SRC + +#+RESULTS: +: t + +** Replace normal Buffer Support with IBuffer + +Configure ibuffer support with project contexts, courtesy of crafted +emacs + +#+BEGIN_SRC emacs-lisp + ;;; enhance ibuffer with ibuffer-project if it is available. + (defun snm-ide-enhance-ibuffer-with-ibuffer-project () + "Set up integration for `ibuffer' with `ibuffer-project'." + (setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups)) + (unless (eq ibuffer-sorting-mode 'project-file-relative) + (ibuffer-do-sort-by-project-file-relative))) + + (use-package ibuffer-project + :ensure t + :hook + (ibuffer-mode . snm-ide-enhance-ibuffer-with-ibuffer-project) + :bind (("C-x C-b" . #'ibuffer))) +#+END_SRC +** Enable EditorConfig Standard Support +#+BEGIN_SRC emacs-lisp + ;;; load editorconfig support + (use-package editorconfig + :hook + (prog-mode . (lambda() (editorconfig-mode 1)))) +#+END_SRC + +#+RESULTS: +| editorconfig-mode | + +** Enable Direnv Integration + +Direnv is the key to have isolated project folders which maintain their own bubble to support whatever is done in that folder. +- set environment variables +- run prep scripts or start services +- load nix or guix profiles to provide support applications + +Emacs' direnv module gives first class support to Emacs projects so they use the right tools for the project. + +#+BEGIN_SRC emacs-lisp + ;; enable direnv mode + (use-package direnv + :ensure t + :config + (direnv-mode)) +#+END_SRC + +This enables direnv globally. + +** Configure Embark + +#+BEGIN_SRC emacs-lisp + (use-package embark + :ensure t + :bind + (("C-." . embark-act) + ("C-;" . embark-dwim) + ("C-h B" . embark-bindings)) + :config + (setq prefix-help-command #'embark-prefix-help-command)) + + ;; Consult users will also want the embark-consult package. + (use-package embark-consult + :ensure t ; only need to install it, embark loads it after consult if found + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + +#+END_SRC + +#+RESULTS: +: [nil 26502 58499 164859 nil elpaca-process-queues nil nil 179000 nil] + +** Configure Helpful + +#+BEGIN_SRC emacs-lisp + (use-package helpful + :ensure t + :bind ( + ( " " . #'helpful-command) + ( " " . #'helpful-callable) + ( " " . #'helpful-key) + ( " " . #'helpful-symbol) + ( " " . #'helpful-variable) + ( "C-h F" . #'helpful-function))) +#+END_SRC + +#+RESULTS: +: [nil 26432 30485 62583 nil elpaca-process-queues nil nil 114000 nil] + +** Enable breadcrumbs + +Show breadcrumbs in the header line to keep context of the file being +worked on. See the [[https://github.com/joaotavora/breadcrumb][breadcrumb repo]] for more details. + +#+BEGIN_SRC emacs-lisp + (use-package breadcrumb + :ensure t + :init + (breadcrumb-mode)) +#+END_SRC + +#+RESULTS: +: [nil 26432 31533 350342 nil elpaca-process-queues nil nil 899000 nil] + +** Enable Avy jumping + +Avy mode replace ace-jump mode with a lot of functionality hidden + +see [[https://karthinks.com/software/avy-can-do-anything/][Avy can Do Anything]] article by the author on the design philosophy +behind it. + +#+BEGIN_SRC emacs-lisp + (use-package avy + :ensure t + :commands (avy-goto-char + avy-goto-char-2 + avy-goto-char-2-above + avy-goto-char-2-below + avy-goto-char-in-line + avy-goto-char-timer + avy-goto-line + avy-goto-line-above + avy-goto-line-below + avy-goto-subword-0 + avy-goto-subword-1 + avy-goto-symbol-1 + avy-goto-symbol-1-above + avy-goto-symbol-1-below + avy-goto-word-0 + avy-goto-word-1 + avy-goto-word-1-above + avy-goto-word-1-below + avy-goto-word-or-subword-1) + :bind + (("C-:" . avy-goto-char-timer) + ("M-g w" . avy-goto-word-0) + ("M-g f" . avy-goto-line)) + :config + (avy-setup-default) ;; setup C-' to jump with isearch + ) +#+END_SRC + +#+RESULTS: +: [nil 26507 37720 141708 nil elpaca-process-queues nil nil 278000 nil] + +Avy is supported by evil and setup in the *evil-integration* package. + +#+RESULTS: + +** Ace Window Configuration + +#+BEGIN_SRC emacs-lisp + (use-package ace-window + :ensure t + :bind + ("C-x o" . ace-window) + :config + (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)) + (setq aw-dispatch-always t)) +#+END_SRC + +#+RESULTS: +: [nil 26523 35809 462186 nil elpaca-process-queues nil nil 958000 nil] + +** Command Log Mode + +surprising sequence of events happened. Command Log Mode is a package +that records all the commands that are executed in the buffer and +provides a way to replay them. + +#+BEGIN_SRC emacs-lisp + (use-package command-log-mode + :ensure t + :commands (command-log-mode)) +#+END_SRC + +#+RESULTS: +: [nil 26503 37477 396927 nil elpaca-process-queues nil nil 128000 nil] + +** Abbrev Files + +#+BEGIN_SRC emacs-lisp + (use-package abbrev + :ensure nil + :config + (setq abbrev-file-name (expand-file-name "abbrev_defs" user-emacs-directory)) + (setq save-abbrevs 'silently) + (if (file-exists-p abbrev-file-name) + (quietly-read-abbrev-file))) +#+END_SRC + * Communication and Interwebs #+BEGIN_SRC emacs-lisp