Files
dotemacs/config.el
T

203 lines
7.8 KiB
EmacsLisp

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
;; (setq user-full-name "John Doe"
;; user-mail-address "john@doe.com")
;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;; - `doom-symbol-font' -- for symbols
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'leuven)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type `relative)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/Documents/qwan/essays/willem/")
(setq org-roam-directory "~/Documents/qwan/essays/willem/" )
;; Speed up clock work, possibly
(setq org-clock-clocked-in-display nil)
;; mostalive custom additions to org-roam
(add-load-path! "~/dev/emacs/org-roaming")
(require 'my-org-roam)
(add-load-path! "~/.config/doom/qwan")
(require 'qwan-blog)
(require 'qwan-refactor)
;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
;;
;; (after! PACKAGE
;; (setq x y))
;;
;; The exceptions to this rule:
;;
;; - Setting file/directory variables (like `org-directory')
;; - Setting variables which explicitly tell you to set them before their
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
;; - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
;; embedd llms in emacs. with org-mode support
(use-package ellama
:init
;; setup key bindings
(setopt ellama-keymap-prefix "C-c e")
;; language you want ellama to translate to
(setopt ellama-language "Dutch")
;; could be llm-openai for example
(require 'llm-ollama)
(setopt ellama-provider
(make-llm-ollama
;; this model should be pulled to use it
;; value should be the same as you print in terminal during pull
:chat-model "llama3.1:8b-instruct-q8_0"
:embedding-model "nomic-embed-text"
:default-chat-non-standard-params '(("num_ctx" . 8192))))
;; Naming new sessions with llm
(setopt ellama-naming-provider
(make-llm-ollama
:chat-model "llama3.1:8b-instruct-q8_0"
:embedding-model "nomic-embed-text"
:default-chat-non-standard-params '(("stop" . ("\n")))))
(setopt ellama-naming-scheme 'ellama-generate-name-by-llm)
;; Translation llm provider
(setopt ellama-translation-provider (make-llm-ollama
:chat-model "llama3.1"
:embedding-model "nomic-embed-text")))
;; https://yannesposito.com/posts/0029-ai-assistants-in-doom-emacs-31-on-macos-with-clojure-mcp-server/index.html
;; LLM
(use-package! gptel
:init
;; declare the default llm configuration
;; for me this is co-pilot with claude-sonnet-4
(setq gptel-default-mode 'org-mode ;; I want the llm to reply to me with org-mode format.
gptel-backend
(gptel-make-ollama "Ollama"
:host "localhost:11434"
:stream t
:models '(hf.co/unsloth/Qwen3-30B-A3B-Thinking-2507-GGUF:UD-Q4_K_XL
qwen3:0.6B
(qwen3-coder:30b ;Full spec
:description
"qwen3 coder large coding model "
:capabilities (tools media)
:mime-types ("image/jpeg" "image/png" "image/svg"))))
gptel-model 'qwen3-coder:30b)
(setq gptel-include-reasoning "*gptel-reasoning*")
(require 'gptel-integrations) ;; <- for mcp
;; declare another llm configuration, I also use Ollama to easily use multiple smaller models that don't require
;; max speed or the latest API.
;; Do not use chatgpt as default. took long to find.
(gptel-make-openai "llama.cpp"
:host "localhost:8000"
:protocol "http"
:stream t
:models '(Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf))
(gptel-make-openai "llama.cpp on mac"
:host "MacBook-Pro-3.local:8000"
:protocol "http"
:stream t
:models '(Qwen3-Coder-Next-UD-Q4_K_XL))
(set-default gptel-model 'qwen3-coder:30b))
;; elixir
;; inspiration https://medium.com/@victor.nascimento/elixir-emacs-development-2023-edition-1a6ccc40629
(use-package
emacs
:ensure nil
:custom
;; Should use:
;; (mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist))
;; at least once per installation or while changing this list
(treesit-language-source-alist
'((heex "https://github.com/phoenixframework/tree-sitter-heex")
(elixir "https://github.com/elixir-lang/tree-sitter-elixir")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")))
;; Install grammars if not present
(dolist (lang '(typescript tsx))
(unless (treesit-language-available-p lang)
(treesit-install-language-grammar lang)))
(major-mode-remap-alist
'((elixir-mode . elixir-ts-mode)))
)
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs '(elixir-ts-mode . ("sh" "/Users/willem/.elixir-ls/release/language_server.sh" ))))
(use-package
elixir-ts-mode
:hook (elixir-ts-mode . eglot-ensure)
(elixir-ts-mode
.
(lambda ()
(push '(">=" . ?\u2265) prettify-symbols-alist)
(push '("<=" . ?\u2264) prettify-symbols-alist)
(push '("!=" . ?\u2260) prettify-symbols-alist)
(push '("==" . ?\u2A75) prettify-symbols-alist)
(push '("=~" . ?\u2245) prettify-symbols-alist)
(push '("<-" . ?\u2190) prettify-symbols-alist)
(push '("->" . ?\u2192) prettify-symbols-alist)
(push '("<-" . ?\u2190) prettify-symbols-alist)
(push '("|>" . ?\u25B7) prettify-symbols-alist)))
(before-save . eglot-format))