Use catppuccin theme and enable light/dark toggle
This commit is contained in:
parent
201af79a42
commit
ec1bc84a26
1 changed files with 234 additions and 182 deletions
412
init.org
412
init.org
|
@ -219,7 +219,7 @@ Needs to load early so the ~:general~ keyword is available for ~use-package~.
|
|||
*** Reload dir local variables
|
||||
|
||||
#+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."
|
||||
(interactive)
|
||||
(let ((enable-local-variables :all))
|
||||
|
@ -227,7 +227,7 @@ Needs to load early so the ~:general~ keyword is available for ~use-package~.
|
|||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: pti-reload-dir-locals-for-current-buffer
|
||||
: snm-reload-dir-locals-for-current-buffer
|
||||
|
||||
|
||||
** 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
|
||||
(require 'url)
|
||||
(defun pti-latest-github-release (repo)
|
||||
(defun snm-latest-github-release (repo)
|
||||
"Return the latest version of the releases for 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
|
||||
|
||||
#+RESULTS:
|
||||
: pti-latest-github-release
|
||||
: snm-latest-github-release
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :tangle no :results value
|
||||
(pti-latest-github-release "plantuml/plantuml")
|
||||
(snm-latest-github-release "plantuml/plantuml")
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
@ -401,7 +401,7 @@ up, which a totally different can of worms). A function
|
|||
(height . 25)
|
||||
(minibuffer . t)
|
||||
(menu-bar-lines . t)
|
||||
(window-system . x))))
|
||||
)))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
|
@ -695,80 +695,61 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
|
|||
** Evil Vim Keybindings
|
||||
|
||||
#+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
|
||||
(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)
|
||||
(setq snm-enable-evil nil)
|
||||
|
||||
(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)
|
||||
)
|
||||
(if snm-enable-evil
|
||||
;; 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
|
||||
(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
|
||||
|
||||
** Load Evil Collection for comprehensive evil support
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package evil-collection
|
||||
:ensure t
|
||||
:after evil
|
||||
:init
|
||||
(evil-collection-init))
|
||||
|
||||
(if snm-enable-evil
|
||||
;; load evil-collection
|
||||
(use-package evil-collection
|
||||
:ensure t
|
||||
:after evil
|
||||
:init
|
||||
(evil-collection-init)))
|
||||
#+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
|
||||
*** Display startup time
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
@ -785,19 +766,19 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
|
|||
;; 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."
|
||||
(seq-find
|
||||
(lambda (f) (find-font (font-spec :family f)))
|
||||
fonts))
|
||||
|
||||
(defun pti-configure-fonts (&optional frame)
|
||||
(defun snm-configure-fonts (&optional frame)
|
||||
"Set configuration of fonts based on display size.
|
||||
|
||||
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
|
||||
this argument."
|
||||
(defvar pti-font-size
|
||||
(defvar snm-font-size
|
||||
(if (> (display-pixel-height) 1600) 22 14))
|
||||
|
||||
;; 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
|
||||
`((t
|
||||
:default-family ,(pti-find-installed-font
|
||||
:default-family ,(snm-find-installed-font
|
||||
'("FiraCode NF" "FiraCode Nerd Font"))
|
||||
:default-weight regular
|
||||
:default-height ,pti-font-size
|
||||
:variable-pitch-family ,(pti-find-installed-font
|
||||
:default-height ,snm-font-size
|
||||
:variable-pitch-family ,(snm-find-installed-font
|
||||
'("Lato" "Literation Sans" "FiraCode NF Propo" "FiraCode Nerd Font Propo" "DejaVu Sans"))
|
||||
:variable-pitch-height 1.33
|
||||
:bold-weight heavy
|
||||
|
@ -834,8 +815,8 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
|
|||
:if (display-graphic-p)
|
||||
:demand t
|
||||
:config (progn
|
||||
(pti-configure-fonts)
|
||||
(add-hook 'after-make-frame-functions #'pti-configure-fonts)))
|
||||
(snm-configure-fonts)
|
||||
(add-hook 'after-make-frame-functions #'snm-configure-fonts)))
|
||||
#+END_SRC
|
||||
|
||||
*** Update configuration of each created frame
|
||||
|
@ -850,54 +831,66 @@ screen.
|
|||
;; remove chrome from the frames
|
||||
;; also support client frames
|
||||
;;
|
||||
(defun pti-display-tweaks (&optional frame)
|
||||
(defun snm-display-tweaks (&optional frame)
|
||||
"Configure a newly created FRAME."
|
||||
(interactive)
|
||||
(menu-bar-mode -1)
|
||||
(menu-bar-mode 1)
|
||||
(tool-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
|
||||
(pti-display-tweaks)
|
||||
(snm-display-tweaks)
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
*** Set Theme
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; Set theme
|
||||
(use-package catppuccin-theme
|
||||
:ensure t
|
||||
:demand t)
|
||||
(use-package modus-themes
|
||||
: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.")
|
||||
;; Set theme
|
||||
(use-package catppuccin-theme
|
||||
:ensure t
|
||||
:demand t
|
||||
:config
|
||||
(setq catppuccin-flavor 'mocha)
|
||||
(load-theme 'catppuccin t)
|
||||
(defun catppuccin-toggle ()
|
||||
(interactive)
|
||||
(setq catppuccin-flavor (if (eq catppuccin-flavor 'mocha) 'latte 'mocha))
|
||||
(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))
|
||||
(selection . (semibold accented intense))))
|
||||
(modus-themes-org-blocks 'tinted-background)
|
||||
(modus-themes-mixed-fonts t)
|
||||
(modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted))
|
||||
|
||||
(modus-themes-headings '((1 . (monochrome extrabold background overline variable-pitch 1.6))
|
||||
(2 . (monochrome bold overline 1.4))
|
||||
(3 . (monochrome semibold overline 1.3))
|
||||
(4 . (monochrome 1.2))
|
||||
(5 . (monochrome 1.1))
|
||||
(agenda-date . (semilight 1.5))
|
||||
(agenda-structure . (variable-pitch light 1.9))
|
||||
(t . (monochrome light))))
|
||||
:config
|
||||
(load-theme 'modus-operandi-tinted :no-confirm)
|
||||
:bind
|
||||
(("<f5>" . #'modus-themes-toggle)))
|
||||
(modus-themes-completions '((matches . (extrabold background intense))
|
||||
(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))
|
||||
(2 . (monochrome bold overline 1.4))
|
||||
(3 . (monochrome semibold overline 1.3))
|
||||
(4 . (monochrome 1.2))
|
||||
(5 . (monochrome 1.1))
|
||||
(agenda-date . (semilight 1.5))
|
||||
(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
|
||||
|
||||
There is a keybinding on *<F5>* to toggle between light and dark mode.
|
||||
|
@ -1212,11 +1205,18 @@ behind it.
|
|||
:general
|
||||
(:states 'normal
|
||||
"<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
|
||||
|
||||
#+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.
|
||||
|
||||
|
@ -1238,21 +1238,33 @@ Avy is supported by evil and setup in the *evil-integration* package.
|
|||
;; configure eglot-mode
|
||||
(use-package eglot
|
||||
:config
|
||||
(evil-define-key 'normal eglot-mode-map
|
||||
(kbd "<leader>c a") 'eglot-code-actions
|
||||
(kbd "<leader>c d") 'eglot-find-declaration
|
||||
(kbd "<leader>c i") 'eglot-find-implementation
|
||||
(kbd "<leader>c k") 'eglot-find-typeDefinition
|
||||
(kbd "<leader>c f") 'eglot-format
|
||||
(kbd "<leader>c F") 'eglot-format-buffer
|
||||
(kbd "<leader>c r") 'eglot-rename
|
||||
(kbd "<leader>c Q") 'eglot-shutdown
|
||||
(kbd "<leader>c q") 'eglot-reconnect
|
||||
(kbd "<leader>c n") 'flymake-goto-next-error
|
||||
(kbd "<leader>c p") 'flymake-goto-prev-error
|
||||
(kbd "]d") #'flymake-goto-next-error
|
||||
(kbd "[d") #'flymake-goto-prev-error
|
||||
)
|
||||
(if snm-enable-evil
|
||||
(evil-define-key 'normal eglot-mode-map
|
||||
(kbd "<leader>c a") 'eglot-code-actions
|
||||
(kbd "<leader>c d") 'eglot-find-declaration
|
||||
(kbd "<leader>c i") 'eglot-find-implementation
|
||||
(kbd "<leader>c k") 'eglot-find-typeDefinition
|
||||
(kbd "<leader>c f") 'eglot-format
|
||||
(kbd "<leader>c F") 'eglot-format-buffer
|
||||
(kbd "<leader>c r") 'eglot-rename
|
||||
(kbd "<leader>c Q") 'eglot-shutdown
|
||||
(kbd "<leader>c q") 'eglot-reconnect
|
||||
(kbd "<leader>c n") 'flymake-goto-next-error
|
||||
(kbd "<leader>c p") '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
|
||||
(setq eglot-autoshutdown t)
|
||||
|
@ -1278,13 +1290,14 @@ Avy is supported by evil and setup in the *evil-integration* package.
|
|||
*** Flymake Support
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun pti-flymake-evil-keybindings ()
|
||||
(defun snm-flymake-evil-keybindings ()
|
||||
"Map flymake error navigation to easier key sequences."
|
||||
(evil-define-key 'normal flymake-mode-map
|
||||
(kbd "]d") #'flymake-goto-next-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
|
||||
|
||||
|
||||
|
@ -1543,10 +1556,11 @@ see also [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter
|
|||
lisp-mode-hook
|
||||
scheme-mode-hook))
|
||||
(add-hook mode #'enable-paredit-mode)))
|
||||
(use-package enhanced-evil-paredit
|
||||
:ensure (enhanced-evil-paredit :host github :repo "jamescherti/enhanced-evil-paredit.el" :wait t)
|
||||
:config
|
||||
(add-hook 'paredit-mode-hook #'enhanced-evil-paredit-mode))
|
||||
(if snm-enable-evil
|
||||
(use-package enhanced-evil-paredit
|
||||
:ensure (enhanced-evil-paredit :host github :repo "jamescherti/enhanced-evil-paredit.el" :wait t)
|
||||
:config
|
||||
(add-hook 'paredit-mode-hook #'enhanced-evil-paredit-mode)))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
@ -1702,10 +1716,20 @@ Configure Geiser and Scheme
|
|||
:ensure nil
|
||||
:commands (scheme-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
|
||||
|
||||
#+RESULTS:
|
||||
| geiser-mode | enable-paredit-mode | geiser-mode--maybe-activate |
|
||||
: [nil 26508 11537 881112 nil elpaca-process-queues nil nil 113000 nil]
|
||||
|
||||
**** GUIX support
|
||||
|
||||
|
@ -1786,7 +1810,7 @@ inside emacs."
|
|||
(mapcar #'(lambda (x)
|
||||
(slynk::close-connection
|
||||
x nil nil))
|
||||
slynk::*connections*)
|
||||
-evil slynk::*connections*)
|
||||
(dolist (thread (remove
|
||||
(slynk-backend::current-thread)
|
||||
(slynk-backend::all-threads)))
|
||||
|
@ -1815,14 +1839,19 @@ This function has to be called in the *sly-inferior-lisp*
|
|||
(setq
|
||||
terraform-indent-level 2
|
||||
terraform-format-on-save t)
|
||||
(evil-define-key 'normal terraform-mode-map
|
||||
(kbd "<leader>c k") #'terraform-open-doc
|
||||
(kbd "<leader>c f") #'terraform-format
|
||||
(kbd "<leader>c F") #'terraform-format-buffer
|
||||
(kbd "<leader>c n") 'flymake-goto-next-error
|
||||
(kbd "<leader>c p") 'flymake-goto-prev-error
|
||||
(kbd "]d") #'flymake-goto-next-error
|
||||
(kbd "[d") #'flymake-goto-prev-error))
|
||||
(if snm-enable-evil
|
||||
(evil-define-key 'normal terraform-mode-map
|
||||
(kbd "<leader>c k") #'terraform-open-doc
|
||||
(kbd "<leader>c f") #'terraform-format
|
||||
(kbd "<leader>c F") #'terraform-format-buffer
|
||||
(kbd "<leader>c n") 'flymake-goto-next-error
|
||||
(kbd "<leader>c p") '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
|
||||
|
||||
Map the keymap consistently to the eglot mappings.
|
||||
|
@ -1845,25 +1874,25 @@ Map the keymap consistently to the eglot mappings.
|
|||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; install DAP servers
|
||||
(setq pti-vscode-js-debug-dir (file-name-concat user-emacs-directory "dape/vscode-js-debug"))
|
||||
(defun pti-install-vscode-js-debug ()
|
||||
(setq snm-vscode-js-debug-dir (file-name-concat user-emacs-directory "dape/vscode-js-debug"))
|
||||
(defun snm-install-vscode-js-debug ()
|
||||
"Run installation procedure to install JS debugging support."
|
||||
(interactive)
|
||||
(mkdir pti-vscode-js-debug-dir t)
|
||||
(let ((default-directory (expand-file-name pti-vscode-js-debug-dir)))
|
||||
(mkdir snm-vscode-js-debug-dir t)
|
||||
(let ((default-directory (expand-file-name snm-vscode-js-debug-dir)))
|
||||
|
||||
(vc-git-clone "https://github.com/microsoft/vscode-js-debug.git" "." nil)
|
||||
(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")
|
||||
(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")))
|
||||
|
||||
(setq pti-codelldb-dir (file-name-concat user-emacs-directory "dape/codelldb"))
|
||||
(defun pti-install-codelldb ()
|
||||
(setq snm-codelldb-dir (file-name-concat user-emacs-directory "dape/codelldb"))
|
||||
(defun snm-install-codelldb ()
|
||||
"Install Vadimcn.Vscode-Lldb DAP server for C/C++/RUST."
|
||||
(interactive)
|
||||
(let* ((default-directory pti-codelldb-dir)
|
||||
(let* ((default-directory snm-codelldb-dir)
|
||||
(arch (car (split-string system-configuration "-" nil nil)))
|
||||
(os (pcase system-type
|
||||
('windows-nt "windows")
|
||||
|
@ -1875,7 +1904,7 @@ Map the keymap consistently to the eglot mappings.
|
|||
(mkdir default-directory t)
|
||||
(url-copy-file release-url "codelldb.zip" t)
|
||||
(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")
|
||||
))
|
||||
|
||||
|
@ -1888,21 +1917,17 @@ Map the keymap consistently to the eglot mappings.
|
|||
;; (setq dape-repl-use-shorthand t)
|
||||
|
||||
;; By default dape uses gdb keybinding prefix
|
||||
;; (setq dape-key-prefix "<space>d")
|
||||
(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)
|
||||
(if snm-enable-evil
|
||||
(evil-define-key 'normal 'global (kbd "<leader>d") dape-global-map))
|
||||
|
||||
;; Projectile users
|
||||
;; (setq dape-cwd-fn 'projectile-project-root))
|
||||
(add-to-list 'dape-configs
|
||||
`(vscode-js-node
|
||||
modes (js-mode js-ts-mode typescript-mode typescript-ts-mode)
|
||||
host "localhost"
|
||||
port 8123
|
||||
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")
|
||||
:type "pwa-node"
|
||||
: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
|
||||
command ,(expand-file-name
|
||||
(file-name-concat
|
||||
pti-codelldb-dir
|
||||
snm-codelldb-dir
|
||||
(concat "extension/adapter/codelldb"
|
||||
(if (eq system-type 'windows-nt)
|
||||
".exe"
|
||||
|
@ -1975,9 +2000,7 @@ Map the keymap consistently to the eglot mappings.
|
|||
:ensure (copilot :host github :repo "zerolfx/copilot.el"
|
||||
:branch "main"
|
||||
:files ("dist" "*.el"))
|
||||
:bind
|
||||
(:map evil-insert-state-map
|
||||
("C-S-y" . copilot-accept-completion))
|
||||
: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))
|
||||
|
@ -1991,13 +2014,41 @@ Map the keymap consistently to the eglot mappings.
|
|||
#+END_SRC
|
||||
|
||||
#+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
|
||||
or leave it here but move it to config, whatever makes most sense at
|
||||
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
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
@ -2042,7 +2093,7 @@ templates to be generated. By default it uses
|
|||
** Org Mode
|
||||
*** Mixed Pitch Support by Default in Org
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun pti-org-mode-config ()
|
||||
(defun snm-org-mode-config ()
|
||||
"Set options for better writing in org buffers."
|
||||
(mixed-pitch-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
|
||||
released project]] utility function. This block will check if there is a
|
||||
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.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :lexical t
|
||||
(defun pti-download-latest-plantuml ()
|
||||
(defun snm-download-latest-plantuml ()
|
||||
"Download the latest version of PlantUML.
|
||||
|
||||
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)
|
||||
(let* ((version (pti-latest-github-release "plantuml/plantuml"))
|
||||
(let* ((version (snm-latest-github-release "plantuml/plantuml"))
|
||||
(url (format
|
||||
"https://github.com/plantuml/plantuml/releases/download/%s/plantuml-%s.jar"
|
||||
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")))
|
||||
(if (not (file-exists-p plantuml-jar))
|
||||
(pti-download-latest-plantuml))
|
||||
(snm-download-latest-plantuml))
|
||||
|
||||
(setq org-plantuml-jar-path plantuml-jar))
|
||||
#+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]].
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package evil-org
|
||||
:ensure t
|
||||
:after org
|
||||
:hook
|
||||
(org-mode . evil-org-mode)
|
||||
:config
|
||||
(require 'evil-org-agenda)
|
||||
(evil-org-agenda-set-keys))
|
||||
(if snm-enable-evil
|
||||
(use-package evil-org
|
||||
:ensure t
|
||||
:after org
|
||||
:hook
|
||||
(org-mode . evil-org-mode)
|
||||
:config
|
||||
(require 'evil-org-agenda)
|
||||
(evil-org-agenda-set-keys)))
|
||||
#+END_SRC
|
||||
|
||||
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-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
|
||||
:hook (
|
||||
(org-mode . pti-org-mode-config)
|
||||
(org-mode . snm-org-mode-config)
|
||||
(org-mode . org-indent-mode)
|
||||
)
|
||||
:bind (
|
||||
|
|
Loading…
Reference in a new issue