ai and ui

This commit is contained in:
Chris Cochrun 2023-11-29 09:49:44 -06:00
parent cec4337197
commit 2a4f2cfb73
2 changed files with 168 additions and 77 deletions

View file

@ -6,6 +6,7 @@
- [[#startup-performance][Startup Performance]] - [[#startup-performance][Startup Performance]]
- [[#set-basic-ui-config][Set basic UI config]] - [[#set-basic-ui-config][Set basic UI config]]
- [[#lets-bootstrap-straightel][Let's bootstrap straight.el]] - [[#lets-bootstrap-straightel][Let's bootstrap straight.el]]
- [[#other-ui][Other UI]]
- [[#fix-nixos][Fix NixOS]] - [[#fix-nixos][Fix NixOS]]
- [[#spell-check][Spell Check]] - [[#spell-check][Spell Check]]
- [[#proced][Proced]] - [[#proced][Proced]]
@ -14,6 +15,8 @@
- [[#ligatures][Ligatures]] - [[#ligatures][Ligatures]]
- [[#keybindings][Keybindings]] - [[#keybindings][Keybindings]]
- [[#org-mode][Org Mode]] - [[#org-mode][Org Mode]]
- [[#ai][AI]]
- [[#jinx][Jinx]]
- [[#emoji][Emoji]] - [[#emoji][Emoji]]
- [[#undo-tree][Undo-Tree]] - [[#undo-tree][Undo-Tree]]
- [[#undo-fu][Undo-Fu]] - [[#undo-fu][Undo-Fu]]
@ -272,6 +275,25 @@ Command-log-mode
:commands command-log-mode) :commands command-log-mode)
#+end_src #+end_src
This bit of code reloads emacs packages after updating nix.
#+begin_src emacs-lisp
(defun chris/home-manager-reload ()
(interactive)
(let* ((which-emacs (shell-command-to-string "nix-store --query $(which emacs)"))
(pattern (rx "newLoadPath+=(/nix/store/"
(group (* any))
"-emacs-packages-deps/share/emacs/site-lisp)"))
(current-deps (when (string-match pattern which-emacs)
(match-string 1 which-emacs)))
(subdirs (concat "/nix/store/" current-deps "-emacs-packages-deps/share/emacs/site-lisp/subdirs.el"))
(native (concat "/nix/store/" current-deps "-emacs-packages-deps/share/emacs/native-lisp/")))
(load-file subdirs)
(when (boundp 'native-comp-eln-load-path)
(add-to-list 'native-comp-eln-load-path native))))
#+end_src
** Other UI
All the icons is super pretty and needed for doom-modeline. All the icons is super pretty and needed for doom-modeline.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package all-the-icons) (use-package all-the-icons)
@ -306,39 +328,6 @@ Probably the prettiest and best modeline I've found.
nano-modeline-prefix 'icon)) nano-modeline-prefix 'icon))
#+end_src #+end_src
#+begin_src emacs-lisp
(use-package mini-echo
:init
(mini-echo-mode 1)
(setq mini-echo-default-segments '(:long
("evil" "major-mode" "buffer-name" "vcs" "buffer-position" "buffer-size"
"flymake" "process" "selection-info" "narrow" "macro" "profiler")
:short
("buffer-name-short" "buffer-position" "process" "profiler"
"selection-info" "narrow" "macro"))
mini-echo-rules '((org-mode :long
(("evil" . 1)
("major-mode" . 2)
("buffer-name" . 3)
("word-count" . 4))))
mini-echo-right-padding 0
mini-echo-buffer-status-style 'both)
(defun chris/mini-echo-minibuffer-width-lessp ()
"Return non-nil if current minibuffer window width less than 120."
(< (mini-echo-minibuffer-width) 100))
(setq mini-echo-short-style-predicate 'chris/mini-echo-minibuffer-width-lessp)
:config
(defun chris/toggle-mode-lines ()
"Switch between doom and mini-echo"
(interactive)
(if mini-echo-mode
(eval (mini-echo-mode 0) (doom-modeline-mode 1))
(eval (doom-modeline-mode 0) (mini-echo-mode 1)))))
#+end_src
Again, doom is pretty and I have fallen in love with the snazzy theme and use it about anywhere I can. Again, doom is pretty and I have fallen in love with the snazzy theme and use it about anywhere I can.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -370,6 +359,42 @@ Let's make parens and other delimiters easier to tell apart by making nested one
(which-key-mode)) (which-key-mode))
#+end_src #+end_src
*** Mini Echo
#+begin_src emacs-lisp
(use-package mini-echo
:init
(mini-echo-mode 1)
(setq mini-echo-default-segments '(:long
("evil" "major-mode" "buffer-name" "vcs" "buffer-position" "buffer-size"
"flymake" "process" "selection-info" "narrow" "macro" "profiler")
:short
("buffer-name-short" "buffer-position" "process" "profiler"
"selection-info" "narrow" "macro"))
mini-echo-rules '((org-mode :long
(("evil" . 1)
("major-mode" . 2)
("buffer-name" . 3)
("word-count" . 4))))
mini-echo-right-padding 0
mini-echo-buffer-status-style 'both
mini-echo-update-interval 0.2)
(defun chris/mini-echo-minibuffer-width-lessp ()
"Return non-nil if current minibuffer window width less than 120."
(< (mini-echo-minibuffer-width) 100))
(setq mini-echo-short-style-predicate 'chris/mini-echo-minibuffer-width-lessp)
:config
(defun chris/toggle-mode-lines ()
"Switch between doom and mini-echo"
(interactive)
(if mini-echo-mode
(eval (mini-echo-mode 0) (doom-modeline-mode 1))
(eval (doom-modeline-mode 0) (mini-echo-mode 1)))))
#+end_src
** Fix NixOS ** Fix NixOS
I am currently using NixOS. In order for emacs to have access to certain programs, we need to set some environment variables I am currently using NixOS. In order for emacs to have access to certain programs, we need to set some environment variables
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
@ -403,7 +428,7 @@ I am currently using NixOS. In order for emacs to have access to certain program
(when (boundp 'native-comp-eln-load-path) (when (boundp 'native-comp-eln-load-path)
(add-to-list 'native-comp-eln-load-path (expand-file-name "native-lisp/" store-path))))) (add-to-list 'native-comp-eln-load-path (expand-file-name "native-lisp/" store-path)))))
(add-to-list 'native-comp-eln-load-path (expand-file-name "native-lisp/" "/nix/store/4fcbabjigcwvxv0idh2ik0ml80lq7m49-emacs-bluetooth-0.3.1/")) (add-to-list 'native-comp-eln-load-path (expand-file-name "native-lisp/" "/nix/store/iczsbrl9z6whxs55mrpmvq45mb8s0qbx-emacs-ellama-20231105.1147/"))
#+end_src #+end_src
Also due to using greetd, emacs isn't started with the environment from the system, so let's make sure it knows which wayland display we are using Also due to using greetd, emacs isn't started with the environment from the system, so let's make sure it knows which wayland display we are using
@ -570,7 +595,8 @@ This evil-collection package includes a lot of other evil based things.
(defun chris/open-bible () (defun chris/open-bible ()
"find a bible to open" "find a bible to open"
(interactive) (interactive)
(find-file "~/org/bibles/")) (find-file "~/org/bibles/esv.org")
)
(defun chris/transpose-lines (arg) (defun chris/transpose-lines (arg)
"Moves the current line or region and follows" "Moves the current line or region and follows"
@ -1207,7 +1233,7 @@ We also need to setup some capture templates to use some specific setups with my
(setq org-roam-directory "~/org" (setq org-roam-directory "~/org"
org-roam-buffer-width 0.25 org-roam-buffer-width 0.25
org-roam-list-files-commands '(fd rg find fdfind) org-roam-list-files-commands '(fd rg find fdfind)
org-roam-file-exclude-regexp '(".stversion/|logseq/|presentations/|.stfolder/|.*~.*|.*sync.*") org-roam-file-exclude-regexp '(".stversion/|logseq/|presentations/|.stfolder/|.*~.*|.*sync.*|bibles/")
org-roam-db-location "~/.emacs.d/org-roam.db" org-roam-db-location "~/.emacs.d/org-roam.db"
org-roam-completion-everywhere t org-roam-completion-everywhere t
org-roam-dailies-directory "dailies/" org-roam-dailies-directory "dailies/"
@ -1966,7 +1992,7 @@ I'm going to start a website for my own ramblings, tutorials and links. To do th
org-hugo-section "blog")) org-hugo-section "blog"))
#+end_src #+end_src
*** AI ** AI
GPTEL is a package that uses chatGPT to get some text generation in org-mode GPTEL is a package that uses chatGPT to get some text generation in org-mode
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(use-package gptel (use-package gptel
@ -1981,7 +2007,23 @@ GPTEL is a package that uses chatGPT to get some text generation in org-mode
#+begin_ai #+begin_ai
is emacs the best? is emacs the best?
#+end_ai #+end_ai
*** Jinx
*** Ellama
Idk, let's try this i guess
#+begin_src emacs-lisp
(use-package ellama
:init
(require 'llm-ollama)
(setopt ellama-buffer-mode 'org-mode
ellama-user-nick "Chris"
ellama-assistant-nick "Jeeves"
ellama-provider
(make-llm-ollama
:chat-model "zephyr:7b-chat-q4_0" :embedding-model "zephyr:7b-chat-q4_0")))
#+end_src
** Jinx
Jinx is an enchanted spell checker for emacs. I think I'll just turn it on globally for a while and see how I feel. Jinx is an enchanted spell checker for emacs. I think I'll just turn it on globally for a while and see how I feel.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package jinx (use-package jinx
@ -2373,7 +2415,7 @@ Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searc
(use-package consult (use-package consult
:after vertico :after vertico
:config :config
(setq consult-narrow-key "C-n" (setq consult-narrow-key "<"
consult-project-root-function 'projectile-project-root) consult-project-root-function 'projectile-project-root)
(consult-customize (consult-customize
@ -2398,7 +2440,17 @@ Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searc
"." "."
))) )))
(consult-ripgrep))) (consult-ripgrep)))
(setq consult-imenu-config
'((emacs-lisp-mode :toplevel "Functions" :types
((102 "Functions" font-lock-function-name-face)
(109 "Macros" font-lock-function-name-face)
(112 "Packages" font-lock-constant-face)
(116 "Types" font-lock-type-face)
(118 "Variables" font-lock-variable-name-face)))))
(setq xref-show-xrefs-function 'consult-xref)
:general :general
(chris/leader-keys (chris/leader-keys
@ -2409,6 +2461,7 @@ Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searc
"sf" 'consult-find "sf" 'consult-find
"sm" 'bookmark-jump "sm" 'bookmark-jump
"sf" 'consult-flymake "sf" 'consult-flymake
"sx" 'xref-show-xrefs
"sy" 'consult-yank-from-kill-ring "sy" 'consult-yank-from-kill-ring
"sb" 'consult-eglot-symbols)) "sb" 'consult-eglot-symbols))
#+end_src #+end_src
@ -3137,7 +3190,8 @@ I'd like to start learning and using rust if I can.
:states 'normal :states 'normal
:keymaps '(rustic-mode override) :keymaps '(rustic-mode override)
"gc" 'rustic-compile "gc" 'rustic-compile
"gr" 'projectile-run-project)) "gr" 'projectile-run-project
"si" 'consult-imenu-multi))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -4126,7 +4180,6 @@ Emulate a terminal
(display-line-numbers-mode -1)) (display-line-numbers-mode -1))
(add-hook 'vterm-mode-hook 'chris/vterm-setup) (add-hook 'vterm-mode-hook 'chris/vterm-setup)
#+end_src #+end_src
** Sly ** Sly
Using sly makes a lot better common-lisp interaction within emacs. Using sly makes a lot better common-lisp interaction within emacs.
#+begin_src emacs-lisp #+begin_src emacs-lisp

110
init.el
View file

@ -110,6 +110,20 @@
(use-package command-log-mode (use-package command-log-mode
:commands command-log-mode) :commands command-log-mode)
(defun chris/home-manager-reload ()
(interactive)
(let* ((which-emacs (shell-command-to-string "nix-store --query $(which emacs)"))
(pattern (rx "newLoadPath+=(/nix/store/"
(group (* any))
"-emacs-packages-deps/share/emacs/site-lisp)"))
(current-deps (when (string-match pattern which-emacs)
(match-string 1 which-emacs)))
(subdirs (concat "/nix/store/" current-deps "-emacs-packages-deps/share/emacs/site-lisp/subdirs.el"))
(native (concat "/nix/store/" current-deps "-emacs-packages-deps/share/emacs/native-lisp/")))
(load-file subdirs)
(when (boundp 'native-comp-eln-load-path)
(add-to-list 'native-comp-eln-load-path native))))
(use-package all-the-icons) (use-package all-the-icons)
(use-package doom-modeline (use-package doom-modeline
@ -130,38 +144,6 @@
(with-selected-frame frame (with-selected-frame frame
(setq doom-modeline-icon t)))))) (setq doom-modeline-icon t))))))
(use-package mini-echo
:init
(mini-echo-mode 1)
(setq mini-echo-default-segments '(:long
("evil" "major-mode" "buffer-name" "vcs" "buffer-position" "buffer-size"
"flymake" "process" "selection-info" "narrow" "macro" "profiler")
:short
("buffer-name-short" "buffer-position" "process" "profiler"
"selection-info" "narrow" "macro"))
mini-echo-rules '((org-mode :long
(("evil" . 1)
("major-mode" . 2)
("buffer-name" . 3)
("word-count" . 4))))
mini-echo-right-padding 0
mini-echo-buffer-status-style 'both)
(defun chris/mini-echo-minibuffer-width-lessp ()
"Return non-nil if current minibuffer window width less than 120."
(< (mini-echo-minibuffer-width) 100))
(setq mini-echo-short-style-predicate 'chris/mini-echo-minibuffer-width-lessp)
:config
(defun chris/toggle-mode-lines ()
"Switch between doom and mini-echo"
(interactive)
(if mini-echo-mode
(eval (mini-echo-mode 0) (doom-modeline-mode 1))
(eval (doom-modeline-mode 0) (mini-echo-mode 1)))))
(use-package doom-themes (use-package doom-themes
:ensure t :ensure t
:init (load-theme 'doom-snazzy t)) :init (load-theme 'doom-snazzy t))
@ -180,6 +162,39 @@
(setq which-key-idle-delay 0.3) (setq which-key-idle-delay 0.3)
(which-key-mode)) (which-key-mode))
(use-package mini-echo
:init
(mini-echo-mode 1)
(setq mini-echo-default-segments '(:long
("evil" "major-mode" "buffer-name" "vcs" "buffer-position" "buffer-size"
"flymake" "process" "selection-info" "narrow" "macro" "profiler")
:short
("buffer-name-short" "buffer-position" "process" "profiler"
"selection-info" "narrow" "macro"))
mini-echo-rules '((org-mode :long
(("evil" . 1)
("major-mode" . 2)
("buffer-name" . 3)
("word-count" . 4))))
mini-echo-right-padding 0
mini-echo-buffer-status-style 'both
mini-echo-update-interval 0.2)
(defun chris/mini-echo-minibuffer-width-lessp ()
"Return non-nil if current minibuffer window width less than 120."
(< (mini-echo-minibuffer-width) 100))
(setq mini-echo-short-style-predicate 'chris/mini-echo-minibuffer-width-lessp)
:config
(defun chris/toggle-mode-lines ()
"Switch between doom and mini-echo"
(interactive)
(if mini-echo-mode
(eval (mini-echo-mode 0) (doom-modeline-mode 1))
(eval (doom-modeline-mode 0) (mini-echo-mode 1)))))
(setenv "WAYLAND_DISPLAY" (if (string= (getenv "XDG_CURRENT_DESKTOP") "Hyprland") (setenv "WAYLAND_DISPLAY" (if (string= (getenv "XDG_CURRENT_DESKTOP") "Hyprland")
"wayland-1" "wayland-1"
"wayland-0")) "wayland-0"))
@ -287,7 +302,8 @@
(defun chris/open-bible () (defun chris/open-bible ()
"find a bible to open" "find a bible to open"
(interactive) (interactive)
(find-file "~/org/bibles/")) (find-file "~/org/bibles/esv.org")
)
(defun chris/transpose-lines (arg) (defun chris/transpose-lines (arg)
"Moves the current line or region and follows" "Moves the current line or region and follows"
@ -886,7 +902,7 @@ much faster. The hope is to also make this a faster version of imenu."
(setq org-roam-directory "~/org" (setq org-roam-directory "~/org"
org-roam-buffer-width 0.25 org-roam-buffer-width 0.25
org-roam-list-files-commands '(fd rg find fdfind) org-roam-list-files-commands '(fd rg find fdfind)
org-roam-file-exclude-regexp '(".stversion/|logseq/|presentations/|.stfolder/|.*~.*|.*sync.*") org-roam-file-exclude-regexp '(".stversion/|logseq/|presentations/|.stfolder/|.*~.*|.*sync.*|bibles/")
org-roam-db-location "~/.emacs.d/org-roam.db" org-roam-db-location "~/.emacs.d/org-roam.db"
org-roam-completion-everywhere t org-roam-completion-everywhere t
org-roam-dailies-directory "dailies/" org-roam-dailies-directory "dailies/"
@ -1577,6 +1593,16 @@ Optional BACKEND must be `re-reveal' or a backend derived from it."
async subtreep visible-only body-only ext-plist)) async subtreep visible-only body-only ext-plist))
file))) file)))
(use-package ellama
:init
(require 'llm-ollama)
(setopt ellama-buffer-mode 'org-mode
ellama-user-nick "Chris"
ellama-assistant-nick "Jeeves"
ellama-provider
(make-llm-ollama
:chat-model "zephyr:7b-chat-q4_0" :embedding-model "zephyr:7b-chat-q4_0")))
(use-package jinx (use-package jinx
;; :hook (emacs-startup . global-jinx-mode) ;; :hook (emacs-startup . global-jinx-mode)
:init (flyspell-mode -1) :init (flyspell-mode -1)
@ -1761,7 +1787,7 @@ Optional BACKEND must be `re-reveal' or a backend derived from it."
(use-package consult (use-package consult
:after vertico :after vertico
:config :config
(setq consult-narrow-key "C-n" (setq consult-narrow-key "<"
consult-project-root-function 'projectile-project-root) consult-project-root-function 'projectile-project-root)
(consult-customize (consult-customize
@ -1786,7 +1812,17 @@ Optional BACKEND must be `re-reveal' or a backend derived from it."
"." "."
))) )))
(consult-ripgrep))) (consult-ripgrep)))
(setq consult-imenu-config
'((emacs-lisp-mode :toplevel "Functions" :types
((102 "Functions" font-lock-function-name-face)
(109 "Macros" font-lock-function-name-face)
(112 "Packages" font-lock-constant-face)
(116 "Types" font-lock-type-face)
(118 "Variables" font-lock-variable-name-face)))))
(setq xref-show-xrefs-function 'consult-xref)
:general :general
(chris/leader-keys (chris/leader-keys
@ -1797,6 +1833,7 @@ Optional BACKEND must be `re-reveal' or a backend derived from it."
"sf" 'consult-find "sf" 'consult-find
"sm" 'bookmark-jump "sm" 'bookmark-jump
"sf" 'consult-flymake "sf" 'consult-flymake
"sx" 'xref-show-xrefs
"sy" 'consult-yank-from-kill-ring "sy" 'consult-yank-from-kill-ring
"sb" 'consult-eglot-symbols)) "sb" 'consult-eglot-symbols))
@ -2382,7 +2419,8 @@ targets."
:states 'normal :states 'normal
:keymaps '(rustic-mode override) :keymaps '(rustic-mode override)
"gc" 'rustic-compile "gc" 'rustic-compile
"gr" 'projectile-run-project)) "gr" 'projectile-run-project
"si" 'consult-imenu-multi))
(use-package slint-mode (use-package slint-mode
:mode "\\.slint\\'") :mode "\\.slint\\'")