Use catppuccin theme and enable light/dark toggle

This commit is contained in:
Peter Tillemans 2025-01-19 13:59:42 +01:00
parent 201af79a42
commit ec1bc84a26

416
init.org
View file

@ -219,7 +219,7 @@ Needs to load early so the ~:general~ keyword is available for ~use-package~.
*** Reload dir local variables *** Reload dir local variables
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun pti-reload-dir-locals-for-current-buffer () (defun snm-reload-dir-locals-for-current-buffer ()
"Reload dir locals for the current buffer." "Reload dir locals for the current buffer."
(interactive) (interactive)
(let ((enable-local-variables :all)) (let ((enable-local-variables :all))
@ -227,7 +227,7 @@ Needs to load early so the ~:general~ keyword is available for ~use-package~.
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
: pti-reload-dir-locals-for-current-buffer : snm-reload-dir-locals-for-current-buffer
** Get latest version of a github released project ** Get latest version of a github released project
@ -239,7 +239,7 @@ metadata and get the version number from the JSON.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(require 'url) (require 'url)
(defun pti-latest-github-release (repo) (defun snm-latest-github-release (repo)
"Return the latest version of the releases for REPO. "Return the latest version of the releases for REPO.
The repo should be in the form of `owner/repo'." The repo should be in the form of `owner/repo'."
@ -251,10 +251,10 @@ metadata and get the version number from the JSON.
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
: pti-latest-github-release : snm-latest-github-release
#+BEGIN_SRC emacs-lisp :tangle no :results value #+BEGIN_SRC emacs-lisp :tangle no :results value
(pti-latest-github-release "plantuml/plantuml") (snm-latest-github-release "plantuml/plantuml")
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
@ -401,7 +401,7 @@ up, which a totally different can of worms). A function
(height . 25) (height . 25)
(minibuffer . t) (minibuffer . t)
(menu-bar-lines . t) (menu-bar-lines . t)
(window-system . x)))) )))
#+END_SRC #+END_SRC
@ -695,80 +695,61 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
** Evil Vim Keybindings ** Evil Vim Keybindings
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; load evil
(use-package evil
:ensure t ;; install the evil package if not installed
:init ;; tweak evil's configuration before loading it
(setq evil-search-module 'evil-search)
(setq evil-ex-complete-emacs-commands nil)
(setq evil-vsplit-window-right t)
(setq evil-split-window-below t)
(setq evil-shift-round nil)
(setq evil-want-C-u-scroll nil)
:config
(evil-mode)
;; set leader keys
(evil-set-leader nil (kbd "C-SPC"))
(evil-set-leader 'normal (kbd "SPC"))
(evil-set-leader 'normal "," t) ;; set localleader
;; make vc commands available via leader key (setq snm-enable-evil nil)
(evil-define-key 'normal 'global
(kbd "<leader>v") vc-prefix-map) (if snm-enable-evil
(keymap-global-set "C-c v" vc-prefix-map) ;; load evil
;; make project commands available via leader key (use-package evil
(evil-define-key 'normal 'global :ensure t ;; install the evil package if not installed
(kbd "<leader>p") project-prefix-map) :init ;; tweak evil's configuration before loading it
(keymap-global-set "C-c p" project-prefix-map) (setq evil-search-module 'evil-search)
(setq evil-ex-complete-emacs-commands nil)
(evil-define-key 'normal 'global (setq evil-vsplit-window-right t)
(kbd "<leader>ff") #'find-file (setq evil-split-window-below t)
(kbd "<leader>fo") #'recentf (setq evil-shift-round nil)
(kbd "<leader>fr") #'revert-buffer (setq evil-want-C-u-scroll nil)
(kbd "<leader>fd") #'diff-buffer-with-file) :config
(keymap-global-set "C-c f f" #'find-file) (evil-mode)
(keymap-global-set "C-c f o" #'recentf) ;; set leader keys
(keymap-global-set "C-c f r" #'revert-buffer) (evil-set-leader nil (kbd "C-SPC"))
(keymap-global-set "C-c f d" #'diff-buffer-with-file) (evil-set-leader 'normal (kbd "SPC"))
) (evil-set-leader 'normal "," t) ;; set localleader
;; make vc commands available via leader key
(evil-define-key 'normal 'global
(kbd "<leader>v") vc-prefix-map)
(keymap-global-set "C-c v" vc-prefix-map)
;; make project commands available via leader key
(evil-define-key 'normal 'global
(kbd "<leader>p") project-prefix-map)
(keymap-global-set "C-c p" project-prefix-map)
(evil-define-key 'normal 'global
(kbd "<leader>ff") #'find-file
(kbd "<leader>fo") #'recentf
(kbd "<leader>fr") #'revert-buffer
(kbd "<leader>fd") #'diff-buffer-with-file)
(keymap-global-set "C-c f f" #'find-file)
(keymap-global-set "C-c f o" #'recentf)
(keymap-global-set "C-c f r" #'revert-buffer)
(keymap-global-set "C-c f d" #'diff-buffer-with-file)
))
#+END_SRC #+END_SRC
** Load Evil Collection for comprehensive evil support ** Load Evil Collection for comprehensive evil support
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package evil-collection (if snm-enable-evil
:ensure t ;; load evil-collection
:after evil (use-package evil-collection
:init :ensure t
(evil-collection-init)) :after evil
:init
(evil-collection-init)))
#+END_SRC #+END_SRC
** Harpoon configuration
#+BEGIN_SRC emacs-lisp :tangle no
(use-package harpoon
:ensure t
:init
(setq pti-harpoon-map (make-sparse-keymap))
(keymap-set pti-harpoon-map (kbd "h") 'harpoon-toggle-quick-menu)
(keymap-set pti-harpoon-map (kbd "a") 'harpoon-add-file)
(keymap-set pti-harpoon-map (kbd "f") 'harpoon-toggle-file)
(keymap-set pti-harpoon-map (kbd "j") 'harpoon-go-to-1)
(keymap-set pti-harpoon-map (kbd "k") 'harpoon-go-to-2)
(keymap-set pti-harpoon-map (kbd "l") 'harpoon-go-to-3)
(keymap-set pti-harpoon-map (kbd ";") 'harpoon-go-to-4)
(keymap-set pti-harpoon-map (kbd "h") 'harpoon-toggle-quick-menu)
:bind
(("<leader>h" . 'pti-harpoon-map)
("C-c h" . 'pti-harpoon-map)))
#+END_SRC
#+RESULTS:
: [nil 26284 54919 318035 nil elpaca-process-queues nil nil 339000 nil]
** User Interface ** User Interface
*** Display startup time *** Display startup time
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -785,19 +766,19 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
;; Font configuration ;; Font configuration
;; ;;
(defun pti-find-installed-font (fonts) (defun snm-find-installed-font (fonts)
"Find the first font in FONTS which is installed on this system." "Find the first font in FONTS which is installed on this system."
(seq-find (seq-find
(lambda (f) (find-font (font-spec :family f))) (lambda (f) (find-font (font-spec :family f)))
fonts)) fonts))
(defun pti-configure-fonts (&optional frame) (defun snm-configure-fonts (&optional frame)
"Set configuration of fonts based on display size. "Set configuration of fonts based on display size.
The FRAME argument makes it possible to set the fonts for new frames by The FRAME argument makes it possible to set the fonts for new frames by
adding this function to `after-make-frame-functions' which must have adding this function to `after-make-frame-functions' which must have
this argument." this argument."
(defvar pti-font-size (defvar snm-font-size
(if (> (display-pixel-height) 1600) 22 14)) (if (> (display-pixel-height) 1600) 22 14))
;; set startup and default fontsets to make org-bullet work ;; set startup and default fontsets to make org-bullet work
@ -808,11 +789,11 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
(setq fontaine-presets (setq fontaine-presets
`((t `((t
:default-family ,(pti-find-installed-font :default-family ,(snm-find-installed-font
'("FiraCode NF" "FiraCode Nerd Font")) '("FiraCode NF" "FiraCode Nerd Font"))
:default-weight regular :default-weight regular
:default-height ,pti-font-size :default-height ,snm-font-size
:variable-pitch-family ,(pti-find-installed-font :variable-pitch-family ,(snm-find-installed-font
'("Lato" "Literation Sans" "FiraCode NF Propo" "FiraCode Nerd Font Propo" "DejaVu Sans")) '("Lato" "Literation Sans" "FiraCode NF Propo" "FiraCode Nerd Font Propo" "DejaVu Sans"))
:variable-pitch-height 1.33 :variable-pitch-height 1.33
:bold-weight heavy :bold-weight heavy
@ -834,8 +815,8 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
:if (display-graphic-p) :if (display-graphic-p)
:demand t :demand t
:config (progn :config (progn
(pti-configure-fonts) (snm-configure-fonts)
(add-hook 'after-make-frame-functions #'pti-configure-fonts))) (add-hook 'after-make-frame-functions #'snm-configure-fonts)))
#+END_SRC #+END_SRC
*** Update configuration of each created frame *** Update configuration of each created frame
@ -850,54 +831,66 @@ screen.
;; remove chrome from the frames ;; remove chrome from the frames
;; also support client frames ;; also support client frames
;; ;;
(defun pti-display-tweaks (&optional frame) (defun snm-display-tweaks (&optional frame)
"Configure a newly created FRAME." "Configure a newly created FRAME."
(interactive) (interactive)
(menu-bar-mode -1) (menu-bar-mode 1)
(tool-bar-mode -1) (tool-bar-mode -1)
(scroll-bar-mode -1)) (scroll-bar-mode -1))
(add-hook 'after-make-frame-functions #'pti-display-tweaks) (add-hook 'after-make-frame-functions #'snm-display-tweaks)
;; run it in the current frame, because the hooks have already fired ;; run it in the current frame, because the hooks have already fired
(pti-display-tweaks) (snm-display-tweaks)
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
*** Set Theme *** Set Theme
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; Set theme ;; Set theme
(use-package catppuccin-theme (use-package catppuccin-theme
:ensure t :ensure t
:demand t) :demand t
(use-package modus-themes :config
:ensure t (setq catppuccin-flavor 'mocha)
:demand t (load-theme 'catppuccin t)
:custom (defun catppuccin-toggle ()
(modus-themes-italic-constructs t) (interactive)
(modus-themes-bold-constructs t) (setq catppuccin-flavor (if (eq catppuccin-flavor 'mocha) 'latte 'mocha))
(modus-themes-mixed-fonts t "enable mixed fonts in org and markdown et al.") (catppuccin-reload)
(message (format "Cattpuccin Flavor set to %s" catppuccin-flavor)))
:bind
(("<f5>" . #'catppuccin-toggle)))
(modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted)) (use-package modus-themes :tangle no
:ensure t
:demand t
:custom
(modus-themes-italic-constructs t)
(modus-themes-bold-constructs t)
(modus-themes-mixed-fonts t "enable mixed fonts in org and markdown et al.")
(modus-themes-completions '((matches . (extrabold background intense)) (modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted))
(selection . (semibold accented intense))))
(modus-themes-org-blocks 'tinted-background)
(modus-themes-mixed-fonts t)
(modus-themes-headings '((1 . (monochrome extrabold background overline variable-pitch 1.6)) (modus-themes-completions '((matches . (extrabold background intense))
(2 . (monochrome bold overline 1.4)) (selection . (semibold accented intense))))
(3 . (monochrome semibold overline 1.3)) (modus-themes-org-blocks 'tinted-background)
(4 . (monochrome 1.2)) (modus-themes-mixed-fonts t)
(5 . (monochrome 1.1))
(agenda-date . (semilight 1.5)) (modus-themes-headings '((1 . (monochrome extrabold background overline variable-pitch 1.6))
(agenda-structure . (variable-pitch light 1.9)) (2 . (monochrome bold overline 1.4))
(t . (monochrome light)))) (3 . (monochrome semibold overline 1.3))
:config (4 . (monochrome 1.2))
(load-theme 'modus-operandi-tinted :no-confirm) (5 . (monochrome 1.1))
:bind (agenda-date . (semilight 1.5))
(("<f5>" . #'modus-themes-toggle))) (agenda-structure . (variable-pitch light 1.9))
(t . (monochrome light))))
:config
(load-theme 'modus-operandi-tinted :no-confirm)
:bind
(("<f5>" . #'modus-themes-toggle)))
#+END_SRC #+END_SRC
There is a keybinding on *<F5>* to toggle between light and dark mode. There is a keybinding on *<F5>* to toggle between light and dark mode.
@ -1212,11 +1205,18 @@ behind it.
:general :general
(:states 'normal (:states 'normal
"<leader> j j" #'avy-goto-char-timer "<leader> j j" #'avy-goto-char-timer
"<leader> j w" #'avy-goto-word-0)) "<leader> j w" #'avy-goto-word-0)
: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 #+END_SRC
#+RESULTS: #+RESULTS:
: [nil 26457 28589 796769 nil elpaca-process-queues nil nil 977000 nil] : [nil 26507 37720 141708 nil elpaca-process-queues nil nil 278000 nil]
Avy is supported by evil and setup in the *evil-integration* package. Avy is supported by evil and setup in the *evil-integration* package.
@ -1238,21 +1238,33 @@ Avy is supported by evil and setup in the *evil-integration* package.
;; configure eglot-mode ;; configure eglot-mode
(use-package eglot (use-package eglot
:config :config
(evil-define-key 'normal eglot-mode-map (if snm-enable-evil
(kbd "<leader>c a") 'eglot-code-actions (evil-define-key 'normal eglot-mode-map
(kbd "<leader>c d") 'eglot-find-declaration (kbd "<leader>c a") 'eglot-code-actions
(kbd "<leader>c i") 'eglot-find-implementation (kbd "<leader>c d") 'eglot-find-declaration
(kbd "<leader>c k") 'eglot-find-typeDefinition (kbd "<leader>c i") 'eglot-find-implementation
(kbd "<leader>c f") 'eglot-format (kbd "<leader>c k") 'eglot-find-typeDefinition
(kbd "<leader>c F") 'eglot-format-buffer (kbd "<leader>c f") 'eglot-format
(kbd "<leader>c r") 'eglot-rename (kbd "<leader>c F") 'eglot-format-buffer
(kbd "<leader>c Q") 'eglot-shutdown (kbd "<leader>c r") 'eglot-rename
(kbd "<leader>c q") 'eglot-reconnect (kbd "<leader>c Q") 'eglot-shutdown
(kbd "<leader>c n") 'flymake-goto-next-error (kbd "<leader>c q") 'eglot-reconnect
(kbd "<leader>c p") 'flymake-goto-prev-error (kbd "<leader>c n") 'flymake-goto-next-error
(kbd "]d") #'flymake-goto-next-error (kbd "<leader>c p") 'flymake-goto-prev-error
(kbd "[d") #'flymake-goto-prev-error (kbd "]d") #'flymake-goto-next-error
) (kbd "[d") #'flymake-goto-prev-error)
(progn
(keymap-set eglot-mode-map "C-c c a" #'eglot-code-actions)
(keymap-set eglot-mode-map "C-c c d" #'eglot-find-declaration)
(keymap-set eglot-mode-map "C-c c i" #'eglot-find-implementation)
(keymap-set eglot-mode-map "C-c c k" #'eglot-find-typeDefinition)
(keymap-set eglot-mode-map "C-c c f" #'eglot-format)
(keymap-set eglot-mode-map "C-c c F" #'eglot-format-buffer)
(keymap-set eglot-mode-map "C-c c r" #'eglot-rename)
(keymap-set eglot-mode-map "C-c c Q" #'eglot-shutdown)
(keymap-set eglot-mode-map "C-c c q" #'eglot-reconnect)
(keymap-set eglot-mode-map "C-c c n" #'flymake-goto-next-error)
(keymap-set eglot-mode-map "C-c c p" #'flymake-goto-prev-error)))
;; Shutdown server when last managed buffer is killed ;; Shutdown server when last managed buffer is killed
(setq eglot-autoshutdown t) (setq eglot-autoshutdown t)
@ -1278,13 +1290,14 @@ Avy is supported by evil and setup in the *evil-integration* package.
*** Flymake Support *** Flymake Support
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun pti-flymake-evil-keybindings () (defun snm-flymake-evil-keybindings ()
"Map flymake error navigation to easier key sequences." "Map flymake error navigation to easier key sequences."
(evil-define-key 'normal flymake-mode-map (evil-define-key 'normal flymake-mode-map
(kbd "]d") #'flymake-goto-next-error (kbd "]d") #'flymake-goto-next-error
(kbd "[d") #'flymake-goto-prev-error)) (kbd "[d") #'flymake-goto-prev-error))
(add-hook 'flymake-mode-hook #'pti-flymake-evil-keybindings) (if snm-enable-evil
(add-hook 'flymake-mode-hook #'snm-flymake-evil-keybindings))
#+END_SRC #+END_SRC
@ -1543,10 +1556,11 @@ see also [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter
lisp-mode-hook lisp-mode-hook
scheme-mode-hook)) scheme-mode-hook))
(add-hook mode #'enable-paredit-mode))) (add-hook mode #'enable-paredit-mode)))
(use-package enhanced-evil-paredit (if snm-enable-evil
:ensure (enhanced-evil-paredit :host github :repo "jamescherti/enhanced-evil-paredit.el" :wait t) (use-package enhanced-evil-paredit
:config :ensure (enhanced-evil-paredit :host github :repo "jamescherti/enhanced-evil-paredit.el" :wait t)
(add-hook 'paredit-mode-hook #'enhanced-evil-paredit-mode)) :config
(add-hook 'paredit-mode-hook #'enhanced-evil-paredit-mode)))
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
@ -1702,10 +1716,20 @@ Configure Geiser and Scheme
:ensure nil :ensure nil
:commands (scheme-mode) :commands (scheme-mode)
:hook (scheme-mode . geiser-mode)) :hook (scheme-mode . geiser-mode))
(use-package geiser-guile
:ensure t
:after geiser)
(use-package geiser-chicken
:ensure t
:after geiser)
(use-package geiser-racket
:ensure t
:after geiser)
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
| geiser-mode | enable-paredit-mode | geiser-mode--maybe-activate | : [nil 26508 11537 881112 nil elpaca-process-queues nil nil 113000 nil]
**** GUIX support **** GUIX support
@ -1786,7 +1810,7 @@ inside emacs."
(mapcar #'(lambda (x) (mapcar #'(lambda (x)
(slynk::close-connection (slynk::close-connection
x nil nil)) x nil nil))
slynk::*connections*) -evil slynk::*connections*)
(dolist (thread (remove (dolist (thread (remove
(slynk-backend::current-thread) (slynk-backend::current-thread)
(slynk-backend::all-threads))) (slynk-backend::all-threads)))
@ -1815,14 +1839,19 @@ This function has to be called in the *sly-inferior-lisp*
(setq (setq
terraform-indent-level 2 terraform-indent-level 2
terraform-format-on-save t) terraform-format-on-save t)
(evil-define-key 'normal terraform-mode-map (if snm-enable-evil
(kbd "<leader>c k") #'terraform-open-doc (evil-define-key 'normal terraform-mode-map
(kbd "<leader>c f") #'terraform-format (kbd "<leader>c k") #'terraform-open-doc
(kbd "<leader>c F") #'terraform-format-buffer (kbd "<leader>c f") #'terraform-format
(kbd "<leader>c n") 'flymake-goto-next-error (kbd "<leader>c F") #'terraform-format-buffer
(kbd "<leader>c p") 'flymake-goto-prev-error (kbd "<leader>c n") 'flymake-goto-next-error
(kbd "]d") #'flymake-goto-next-error (kbd "<leader>c p") 'flymake-goto-prev-error
(kbd "[d") #'flymake-goto-prev-error)) (kbd "]d") #'flymake-goto-next-error
(kbd "[d") #'flymake-goto-prev-error)
(progn
(keymap-set terraform-mode-map "C-c c k" #'terraform-open-doc)
(keymap-set terraform-mode-map "C-c c f" #'terraform-format)
(keymap-set terraform-mode-map "C-c c F" #'terraform-format-buffer))))
#+END_SRC #+END_SRC
Map the keymap consistently to the eglot mappings. Map the keymap consistently to the eglot mappings.
@ -1845,25 +1874,25 @@ Map the keymap consistently to the eglot mappings.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; install DAP servers ;; install DAP servers
(setq pti-vscode-js-debug-dir (file-name-concat user-emacs-directory "dape/vscode-js-debug")) (setq snm-vscode-js-debug-dir (file-name-concat user-emacs-directory "dape/vscode-js-debug"))
(defun pti-install-vscode-js-debug () (defun snm-install-vscode-js-debug ()
"Run installation procedure to install JS debugging support." "Run installation procedure to install JS debugging support."
(interactive) (interactive)
(mkdir pti-vscode-js-debug-dir t) (mkdir snm-vscode-js-debug-dir t)
(let ((default-directory (expand-file-name pti-vscode-js-debug-dir))) (let ((default-directory (expand-file-name snm-vscode-js-debug-dir)))
(vc-git-clone "https://github.com/microsoft/vscode-js-debug.git" "." nil) (vc-git-clone "https://github.com/microsoft/vscode-js-debug.git" "." nil)
(report-time-since-load "git repository created") (report-time-since-load "git repository created")
(call-process "npm" nil "*pti-install*" t "install") (call-process "npm" nil "*snm-install*" t "install")
(report-time-since-load "npm dependencies installed") (report-time-since-load "npm dependencies installed")
(call-process "npx" nil "*pti-install*" t "gulp" "dapDebugServer") (call-process "npx" nil "*snm-install*" t "gulp" "dapDebugServer")
(report-time-since-load "vscode-js-debug installed"))) (report-time-since-load "vscode-js-debug installed")))
(setq pti-codelldb-dir (file-name-concat user-emacs-directory "dape/codelldb")) (setq snm-codelldb-dir (file-name-concat user-emacs-directory "dape/codelldb"))
(defun pti-install-codelldb () (defun snm-install-codelldb ()
"Install Vadimcn.Vscode-Lldb DAP server for C/C++/RUST." "Install Vadimcn.Vscode-Lldb DAP server for C/C++/RUST."
(interactive) (interactive)
(let* ((default-directory pti-codelldb-dir) (let* ((default-directory snm-codelldb-dir)
(arch (car (split-string system-configuration "-" nil nil))) (arch (car (split-string system-configuration "-" nil nil)))
(os (pcase system-type (os (pcase system-type
('windows-nt "windows") ('windows-nt "windows")
@ -1875,7 +1904,7 @@ Map the keymap consistently to the eglot mappings.
(mkdir default-directory t) (mkdir default-directory t)
(url-copy-file release-url "codelldb.zip" t) (url-copy-file release-url "codelldb.zip" t)
(report-time-since-load "codelldb archive downloaded") (report-time-since-load "codelldb archive downloaded")
(call-process "unzip" nil "*pti-install*" t "codelldb.zip") (call-process "unzip" nil "*snm-install*" t "codelldb.zip")
(report-time-since-load "codelldb installed") (report-time-since-load "codelldb installed")
)) ))
@ -1888,21 +1917,17 @@ Map the keymap consistently to the eglot mappings.
;; (setq dape-repl-use-shorthand t) ;; (setq dape-repl-use-shorthand t)
;; By default dape uses gdb keybinding prefix ;; By default dape uses gdb keybinding prefix
;; (setq dape-key-prefix "<space>d") (if snm-enable-evil
(evil-define-key 'normal 'global (kbd "<leader>d") dape-global-map) (evil-define-key 'normal 'global (kbd "<leader>d") dape-global-map))
;; Kill compile buffer on build success
;; (add-hook 'dape-compile-compile-hooks 'kill-buffer)
;; Projectile users ;; Projectile users
;; (setq dape-cwd-fn 'projectile-project-root))
(add-to-list 'dape-configs (add-to-list 'dape-configs
`(vscode-js-node `(vscode-js-node
modes (js-mode js-ts-mode typescript-mode typescript-ts-mode) modes (js-mode js-ts-mode typescript-mode typescript-ts-mode)
host "localhost" host "localhost"
port 8123 port 8123
command "node" command "node"
command-cwd ,(file-name-concat pti-vscode-js-debug-dir "dist") command-cwd ,(file-name-concat snm-vscode-js-debug-dir "dist")
command-args ("src/dapDebugServer.js" "8123") command-args ("src/dapDebugServer.js" "8123")
:type "pwa-node" :type "pwa-node"
:request "launch" :request "launch"
@ -1935,7 +1960,7 @@ Map the keymap consistently to the eglot mappings.
;; Replace vadimcn.vscode-lldb with the vsix directory you just extracted ;; Replace vadimcn.vscode-lldb with the vsix directory you just extracted
command ,(expand-file-name command ,(expand-file-name
(file-name-concat (file-name-concat
pti-codelldb-dir snm-codelldb-dir
(concat "extension/adapter/codelldb" (concat "extension/adapter/codelldb"
(if (eq system-type 'windows-nt) (if (eq system-type 'windows-nt)
".exe" ".exe"
@ -1975,9 +2000,7 @@ Map the keymap consistently to the eglot mappings.
:ensure (copilot :host github :repo "zerolfx/copilot.el" :ensure (copilot :host github :repo "zerolfx/copilot.el"
:branch "main" :branch "main"
:files ("dist" "*.el")) :files ("dist" "*.el"))
:bind :bind ("C-S-y" . copilot-accept-completion)
(:map evil-insert-state-map
("C-S-y" . copilot-accept-completion))
:config :config
(add-to-list 'copilot-indentation-alist '(scheme-mode . 2)) (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 '(emacs-lisp-mode . 2))
@ -1991,13 +2014,41 @@ Map the keymap consistently to the eglot mappings.
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
: [nil 26500 6758 925534 nil elpaca-process-queues nil nil 360000 nil] : [nil 26506 39443 528692 nil elpaca-process-queues nil nil 667000 nil]
*** TODO move scheme configuration to the scheme section *** TODO move scheme configuration to the scheme section
or leave it here but move it to config, whatever makes most sense at or leave it here but move it to config, whatever makes most sense at
the moment. the moment.
** 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" <your-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" <your-gemini-api-key>)
;;
;; Optional: Set a key binding for the transient menu
(global-set-key (kbd "C-c a") 'aider-transient-menu))
#+END_SRC
#+RESULTS:
: [nil 26507 57728 13169 nil elpaca-process-queues nil nil 655000 nil]
** Gitlab Support ** Gitlab Support
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -2042,7 +2093,7 @@ templates to be generated. By default it uses
** Org Mode ** Org Mode
*** Mixed Pitch Support by Default in Org *** Mixed Pitch Support by Default in Org
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun pti-org-mode-config () (defun snm-org-mode-config ()
"Set options for better writing in org buffers." "Set options for better writing in org buffers."
(mixed-pitch-mode) (mixed-pitch-mode)
(visual-line-mode) (visual-line-mode)
@ -2122,17 +2173,17 @@ Requires nothing special, other than *plantuml.jar* archive installed.
The following code block depends on [[*Get latest version of a github released project][Get latest version of a github The following code block depends on [[*Get latest version of a github released project][Get latest version of a github
released project]] utility function. This block will check if there is a released project]] utility function. This block will check if there is a
plantuml.jar in the emacs config directory and if not download the plantuml.jar in the emacs config directory and if not download the
latest version from github. The `pti-download-latest-plantuml` is made latest version from github. The `snm-download-latest-plantuml` is made
interactive to manually install the latest version if needed. interactive to manually install the latest version if needed.
#+BEGIN_SRC emacs-lisp :lexical t #+BEGIN_SRC emacs-lisp :lexical t
(defun pti-download-latest-plantuml () (defun snm-download-latest-plantuml ()
"Download the latest version of PlantUML. "Download the latest version of PlantUML.
This function is interactive to make it easy to upgrade to This function is interactive to make it easy to upgrade to
the latest, current version with `M-x pti-download-latest-plantuml'." the latest, current version with `M-x snm-download-latest-plantuml'."
(interactive) (interactive)
(let* ((version (pti-latest-github-release "plantuml/plantuml")) (let* ((version (snm-latest-github-release "plantuml/plantuml"))
(url (format (url (format
"https://github.com/plantuml/plantuml/releases/download/%s/plantuml-%s.jar" "https://github.com/plantuml/plantuml/releases/download/%s/plantuml-%s.jar"
version (substring version 1)))) version (substring version 1))))
@ -2144,7 +2195,7 @@ interactive to manually install the latest version if needed.
(let ((plantuml-jar (concat user-emacs-directory "plantuml.jar"))) (let ((plantuml-jar (concat user-emacs-directory "plantuml.jar")))
(if (not (file-exists-p plantuml-jar)) (if (not (file-exists-p plantuml-jar))
(pti-download-latest-plantuml)) (snm-download-latest-plantuml))
(setq org-plantuml-jar-path plantuml-jar)) (setq org-plantuml-jar-path plantuml-jar))
#+END_SRC #+END_SRC
@ -2379,14 +2430,15 @@ exporter manual.]]
Better keybinding for evil mode from [[https://github.com/Somelauw/evil-org-mode][the evil-org github repo]]. Better keybinding for evil mode from [[https://github.com/Somelauw/evil-org-mode][the evil-org github repo]].
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package evil-org (if snm-enable-evil
:ensure t (use-package evil-org
:after org :ensure t
:hook :after org
(org-mode . evil-org-mode) :hook
:config (org-mode . evil-org-mode)
(require 'evil-org-agenda) :config
(evil-org-agenda-set-keys)) (require 'evil-org-agenda)
(evil-org-agenda-set-keys)))
#+END_SRC #+END_SRC
Here is a snapshot of the keybindings dd <2024-07-30 Tue>. Here is a snapshot of the keybindings dd <2024-07-30 Tue>.
@ -2735,7 +2787,7 @@ We can add a list of queries
+org-capture-projects-file "~/Nextcloud/org/projects.org") +org-capture-projects-file "~/Nextcloud/org/projects.org")
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages) (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
:hook ( :hook (
(org-mode . pti-org-mode-config) (org-mode . snm-org-mode-config)
(org-mode . org-indent-mode) (org-mode . org-indent-mode)
) )
:bind ( :bind (
@ -3019,7 +3071,7 @@ enough value but I just removed it, so it'll have to wait a bit.
CLOCK: [2024-08-15 Thu 13:47]--[2024-08-16 Fri 00:57] => 11:10 CLOCK: [2024-08-15 Thu 13:47]--[2024-08-16 Fri 00:57] => 11:10
:END: :END:
see [[https://github.com/gicrisf/ox-zola][ox-zola]] for exporting org-mode to zola markdown. see [[https://github.com/gicrisf/ox-zola][ox-zola]] for exporting org-mode to zola markdown.
* Final Words * Final Words
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp