Compare commits

...

10 Commits

Author SHA1 Message Date
phundrak c7b7d1f086 feat(emacs/programming): remove unused configuration 2026-05-13 20:32:22 +02:00
phundrak 327c2f94c5 feat(emacs/nix): enable LSP server for Nix files by default 2026-05-13 20:32:22 +02:00
phundrak 68d71a6fe2 feat(emacs/direnv): enable Emacs to load direnv environment
Especially useful when using Nix develompent shells and when LSP
servers would otherwise not be available.
2026-05-13 20:32:22 +02:00
phundrak 2d655e06bd feat(emacs/tree-sitter): remove unused packages 2026-05-13 20:32:22 +02:00
phundrak ecfa2ce7d8 feat(emacs): remove Yadm config 2026-05-13 20:32:22 +02:00
phundrak c4dc41f881 feat(emacs/evil-surround): add typographic delimiters 2026-05-13 20:32:22 +02:00
phundrak 11277ea67a feat(emacs/projectile): ignore nix store 2026-05-13 20:32:22 +02:00
phundrak ec29b8ca0e docs(emacs): move Jujutsu section 2026-05-13 20:32:22 +02:00
phundrak 788ab5e5eb feat(emacs/langtool): change default language to GB English 2026-05-13 20:32:22 +02:00
phundrak aa64a52205 feat(emacs): recreate my old hydra menu for writeroom with transient
Create a Transient menu to adapt on the fly the width of my buffers
when using writeroom-mode. This commit also adds two other functions:
- `my/writeroom-reset` which resets the width of the buffer to its
  default state
- `my/writeroom-fit-buffer` which sets the width of the buffer to be
  exactly what is needed to fit the longest line of the buffer
2026-05-13 20:32:22 +02:00
5 changed files with 119 additions and 217 deletions
+30 -28
View File
@@ -504,34 +504,36 @@ My toggle keybindings are prefixed by ~t~.
A couple of keybindings are hidden from which-key, otherwise theres not
much to say. The prefix here is ~w~.
#+name: keybindings-windows
| Key | Function | Description | Package |
|-----+-------------------------------+-------------+----------------|
| | | windows | |
| c | evil-window-left | | evil |
| t | evil-window-down | | evil |
| s | evil-window-up | | evil |
| r | evil-window-right | | evil |
| . | windows-adjust-size/body | | |
| - | split-window-below-and-focus | | |
| / | split-window-right-and-focus | | |
| $ | winum-select-window-by-number | | winum |
| 0 | winum-select-window-0-or-10 | none | winum |
| 1 | winum-select-window-1 | none | winum |
| 2 | winum-select-window-2 | none | winum |
| 3 | winum-select-window-3 | none | winum |
| 4 | winum-select-window-4 | none | winum |
| 5 | winum-select-window-5 | none | winum |
| 6 | winum-select-window-6 | none | winum |
| 7 | winum-select-window-7 | none | winum |
| 8 | winum-select-window-8 | none | winum |
| 9 | winum-select-window-9 | none | winum |
| b | kill-buffer-and-window | | |
| d | delete-window | | |
| o | other-window | | |
| D | delete-other-windows | | |
| w | | writeroom | |
| w. | writeroom-buffer-width/body | | writeroom-mode |
| ww | writeroom-mode | | writeroom-mode |
| Key | Function | Description | Package |
|-----+-------------------------------+----------------+----------------|
| | | windows | |
| c | evil-window-left | | evil |
| t | evil-window-down | | evil |
| s | evil-window-up | | evil |
| r | evil-window-right | | evil |
| . | windows-adjust-size/body | | |
| - | split-window-below-and-focus | | |
| / | split-window-right-and-focus | | |
| $ | winum-select-window-by-number | | winum |
| 0 | winum-select-window-0-or-10 | none | winum |
| 1 | winum-select-window-1 | none | winum |
| 2 | winum-select-window-2 | none | winum |
| 3 | winum-select-window-3 | none | winum |
| 4 | winum-select-window-4 | none | winum |
| 5 | winum-select-window-5 | none | winum |
| 6 | winum-select-window-6 | none | winum |
| 7 | winum-select-window-7 | none | winum |
| 8 | winum-select-window-8 | none | winum |
| 9 | winum-select-window-9 | none | winum |
| b | kill-buffer-and-window | | |
| d | delete-window | | |
| o | other-window | | |
| D | delete-other-windows | | |
| w | | writeroom | |
| w. | my/writeroom-transient | adapt width | |
| w= | my/writeroom-reset | reset width | |
| wf | my/writeroom-fit-buffer | fit to content | |
| ww | writeroom-mode | | writeroom-mode |
** Quit
Why would I ever use any of these keybindings? They are prefixed with ~q~.
+50 -48
View File
@@ -1280,7 +1280,7 @@ in quite a few languages.
langtool-show-message-at-point
langtool-correct-buffer)
:custom
(langtool-default-language "en-US")
(langtool-default-language "en-GB")
(langtool-mother-tongue "fr")
:config
(setq langtool-http-server-host "localhost"
@@ -1399,53 +1399,6 @@ left it.
#+end_src
** Project Management
*** Jujutsu
Lets face it: [[https://git-scm.com/][git]] is awesome. Theres a reason it took over the world
of software development, replacing pretty much all competitors such as
subversion. And I will forever love it. But, it has a lot of
drawbacks, especially its interface that is... not great, to put it
mildly. I absolutely respect its commitment to staying backward
compatible, but its not great.
[[https://jj-vcs.github.io/][Jujutsu]] on the other hand, is awesome! Its interface is really clean,
really intuitive, especially for someone like me who rebases a LOT!
And, for now, it still uses git as its backend, so its entirely
compatible with git repositories. In fact, I pretty much dont use git
anymore, jj (abbreviation of Jujutsu) has almost completely replaced
git for me.
I like Magits interface, as you can see in my [[file:./applications.md#magit][Magit]] config.
Therefore, lets install =majjit=, my slow and scuffed attempt at
bringing some Magit features to jujutsu.
#+begin_src emacs-lisp
(use-package majjit
:defer t
:after magit
:straight (majjit :built t
:type git
:host nil
:repo "https://labs.phundrak.com/phundrak/majjit")
:custom ((majjit-default-directory "~/code/")))
#+end_src
Though, Ill be honest, I generally prefer to use Jujutsu in the
terminal, unlike git. Something I do use Emacs for, however, is
writing my commit messages.
#+begin_src emacs-lisp
(use-package jjdescription
:defer nil
:straight (:build t)
:commands jjdescription-mode
:init (add-to-list 'auto-mode-alist '("\\.jjdescription\\'" . jjdescription-mode)))
#+end_src
And I want Emacs to know that any directory which has a =.jj= repository
is the root of a project.
#+begin_src emacs-lisp
(add-to-list 'project-vc-extra-root-markers ".jj")
#+end_src
*** Magit
Magit is an awesome wrapper around Git for Emacs! Very often, I go
from disliking to really hating Git GUI clients because they often
@@ -1562,6 +1515,53 @@ deactivate `magit-todos-mode', otherwise enable it."
(setq magit-todos-ignore-case nil))
#+end_src
*** Jujutsu
Lets face it: [[https://git-scm.com/][git]] is awesome. Theres a reason it took over the world
of software development, replacing pretty much all competitors such as
subversion. And I will forever love it. But, it has a lot of
drawbacks, especially its interface that is... not great, to put it
mildly. I absolutely respect its commitment to staying backward
compatible, but its not great.
[[https://jj-vcs.github.io/][Jujutsu]] on the other hand, is awesome! Its interface is really clean,
really intuitive, especially for someone like me who rebases a LOT!
And, for now, it still uses git as its backend, so its entirely
compatible with git repositories. In fact, I pretty much dont use git
anymore, jj (abbreviation of Jujutsu) has almost completely replaced
git for me.
I like Magits interface, as you can see in my [[file:./applications.md#magit][Magit]] config.
Therefore, lets install =majjit=, my slow and scuffed attempt at
bringing some Magit features to jujutsu.
#+begin_src emacs-lisp
(use-package majjit
:defer t
:after magit
:straight (majjit :built t
:type git
:host nil
:repo "https://labs.phundrak.com/phundrak/majjit")
:custom ((majjit-default-directory "~/code/")))
#+end_src
Though, Ill be honest, I generally prefer to use Jujutsu in the
terminal, unlike git. Something I do use Emacs for, however, is
writing my commit messages.
#+begin_src emacs-lisp
(use-package jjdescription
:defer nil
:straight (:build t)
:commands jjdescription-mode
:init (add-to-list 'auto-mode-alist '("\\.jjdescription\\'" . jjdescription-mode)))
#+end_src
And I want Emacs to know that any directory which has a =.jj= repository
is the root of a project.
#+begin_src emacs-lisp
;;(add-to-list 'project-vc-extra-root-markers ".jj")
#+end_src
*** Forge
Forge acts as an interface for GitHub, GitLab, and Bitbucket inside
Magit. A lot of possibilities are present, you can read issues and
@@ -1619,6 +1619,8 @@ to projectile.
(projectile-mode)
(add-to-list 'projectile-ignored-projects "~/")
(add-to-list 'projectile-globally-ignored-directories "^node_modules$")
(setopt projectile-ignored-project-function
(lambda (path) (string-prefix-p "/nix/" (file-truename path))))
:general
(phundrak/leader-key
"p" '(:keymap projectile-command-map :which-key "projectile")))
+29
View File
@@ -67,6 +67,9 @@ enough for me.
:after evil
:config
(add-to-list 'evil-surround-pairs-alist '(?$ . ("${" . "}")))
(add-to-list 'evil-surround-pairs-alist '(?« . ("« " . " »")))
(add-to-list 'evil-surround-pairs-alist '(?“ . ("“ " . " ”")))
(add-to-list 'evil-surround-pairs-alist '(? . ("" . "")))
(global-evil-surround-mode 1))
#+end_src
@@ -176,4 +179,30 @@ is a bit too small for me, and I prefer not to go full-screen.
writeroom-maximize-window nil
writeroom-mode-line t
writeroom-major-modes '(text-mode org-mode markdown-mode nov-mode Info-mode)))
(with-eval-after-load 'transient
(defun my/writeroom-reset ()
(interactive)
(setq writeroom-width 100)
(writeroom-adjust-width nil))
(defun my/writeroom-fit-buffer ()
"Set writeroom to fit the longest line in the current buffer."
(interactive)
(when writeroom-mode
(let ((max-width 0))
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(end-of-line)
(setq max-width (max max-width (current-column)))
(forward-line 1)))
(writeroom-adjust-width (- max-width visual-fill-column-width)))))
(transient-define-prefix my/writeroom-transient ()
"Writewroom Transient"
["Adjust"
("r" "widen" writeroom-increase-width :transient t)
("c" "tighten" writeroom-decrease-width :transient t)
("q" "quit" transient-quit-all)]))
#+end_src
-26
View File
@@ -480,30 +480,4 @@ the following code.
(require 'tramp-sh)
(setq tramp-remote-path (append tramp-remote-path
'(tramp-own-remote-path)))
#+end_src
*** Yadm
[[https://yadm.io/][~yadm~]] is a git wrapper made to easily manage your dotfiles. It has
loads of features I dont use (the main one I like but dont use is
its [[https://yadm.io/docs/templates][Jinja-like host and OS-aware syntax]]), but unfortunately Magit
doesnt play nice with it. Tramp to the rescue, and this page explains
how! Lets just insert in my config this code snippet:
#+name: tramp-add-yadm
#+begin_src emacs-lisp :tangle no
(add-to-list 'tramp-methods
'("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") ("/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
#+end_src
Ill also create a fuction for connecting to this new Tramp protocol:
#+begin_src emacs-lisp
(defun my/yadm ()
"Manage my dotfiles through TRAMP."
(interactive)
(magit-status "/yadm::"))
#+end_src
+10 -115
View File
@@ -6,6 +6,15 @@
* Programming
** Tools
*** Nix environments
#+begin_src emacs-lisp
(use-package envrc
:straight (:build t)
:hook (after-init . envrc-global-mode))
(use-package inheritenv :straight (:built t))
#+end_src
*** Treesitter
Treesit is a native Emacs [[https://tree-sitter.github.io/tree-sitter/][tree-sitter]] implementation which provides a
very fast and flexible way of performing code-highlighting in Emacs.
@@ -22,41 +31,12 @@ variables to install grammars for different languages.
#+end_src
#+begin_src emacs-lisp
(use-package tree-sitter-langs
:after tree-sitter
:straight t
:custom (global-tree-sitter-mode t)
:init
(add-to-list 'treesit-extra-load-path
(expand-file-name "bin" tree-sitter-langs-grammar-dir)))
(use-package treesit-auto
:after tree-sitter
:straight t
:config (global-treesit-auto-mode))
(use-package treesit-fold
:after tree-sitter
:straight (:build t :host github :repo "emacs-tree-sitter/treesit-fold")
:init (global-treesit-fold-mode t))
#+end_src
*** Appwrite
[[https://appwrite.io][Appwrite]] is an open-source and self-hostable alternative to Firebase.
I am currently working on a server SDK for Appwrite in Emacs, so here
it is.
#+begin_src emacs-lisp
(use-package appwrite
:defer t
:straight (appwrite :build t
:type git
:host github
:repo "Phundrak/appwrite.el")
:config
(setopt appwrite-endpoint "https://appwrite.phundrak.com"
appwrite-devel t))
#+end_src
*** Flycheck
#+begin_src emacs-lisp
(use-package flycheck
@@ -633,6 +613,7 @@ Markdown.
(use-package nix-ts-mode
:mode "\\.nix\\'"
:straight (:build t)
:hook (nix-ts-mode . lsp-deferred)
:config (add-to-list 'major-mode-remap-alist '((nix-mode . nix-ts-mode))))
#+end_src
@@ -661,74 +642,6 @@ Nginx syntax.
(add-to-list 'company-backends #'company-nginx))))
#+end_src
*** PKGBUILD
As I am an ArchLinux user, I sometimes have to interact with PKGBUILD
files, both from the AUR when I want to install something from there
or some I write myself.
#+begin_src emacs-lisp
(use-package pkgbuild-mode
:straight (:build t)
:defer t
:custom
(pkgbuild-update-sums-on-save nil)
(pkgbuild-ask-about-save nil)
:general
(phundrak/major-leader-key
:keymaps 'pkgbuild-mode-map
"c" #'pkgbuild-syntax-check
"i" #'pkgbuild-initialize
"I" #'pkgbuild-increase-release-tag
"m" #'pkgbuild-makepkg
"u" '(:ignore :wk "update")
"us" #'pkgbuild-update-sums-line
"uS" #'pkgbuild-update-srcinfo))
#+end_src
*** PlantUML
#+begin_src emacs-lisp
(use-package plantuml-mode
:defer t
:straight (:build t)
:mode ("\\.\\(pum\\|puml\\)\\'" . plantuml-mode)
:after ob
:init
(add-to-list 'org-babel-load-languages '(plantuml . t))
:general
(phundrak/major-leader-key
:keymaps 'plantuml-mode-map
:packages 'plantuml-mode
"c" '(:ignore t :which-key "compile")
"cc" #'plantuml-preview
"co" #'plantuml-set-output-type)
:config
(setq plantuml-default-exec-mode 'jar
plantuml-jar-path "~/.local/bin/plantuml.jar"
org-plantuml-jar-path "~/.local/bin/plantuml.jar"))
#+end_src
*** QML
Im currently working on a [[https://quickshell.org/][Quickshell]] configuration to replace my
[[https://github.com/Alexays/Waybar][Waybar]] one. Quickshell is configured with [[https://doc.qt.io/qt-6/qmlapplications.html][QML]], which requires its
major mode.
#+begin_src emacs-lisp
(use-package qml-ts-mode
:after lsp-mode
:straight (qml-ts-mode :build t
:type git
:host github
:repo "xhcoding/qml-ts-mode")
:config
(add-to-list 'lsp-language-id-configuration '(qml-ts-mode . "qml-ts"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("qmlls" "-E"))
:activation-fn (lsp-activate-on "qml-ts")
:server-id 'qmlls))
(add-hook 'qml-ts-mode-hook (lambda ()
(setq-local electric-indent-chars '(?\n ?\( ?\) ?{ ?} ?\[ ?\] ?\; ?,))
(lsp-deferred))))
#+end_src
*** Ron files
Rusty Object Notation, or RON for short, is to Rust what Json is to
Javascript. Sometimes, I have to work with such files, which is why I
@@ -800,17 +713,6 @@ When editing some scripts though, I need to use the built-in ~shell-mode~.
:mode "\\.yaml\\'")
#+end_src
*** yuck
This is one of the two file formats used by [[https://github.com/elkowar/eww/][eww]]s configuration, a
Lisp-like language. Therefore, it will also use [[file:./editing.md#parinfer][parinfer]] to manage its
parenthesis.
#+begin_src emacs-lisp
(use-package yuck-mode
:straight (:build t)
:defer t
:hook ((yuck-mode . parinfer-rust-mode)))
#+end_src
** General Programming Languages
*** C/C++
I know, I know, C and C++ no longer are closely related languages,
@@ -1328,13 +1230,6 @@ several improvements on top of =rust-mode=.
(remove-hook 'rustic-mode-hook #'rustic-setup-lsp))
#+end_src
*** Uiua
#+begin_src emacs-lisp
(use-package uiua-ts-mode
:mode "\\.ua\\'"
:straight (:build t))
#+end_src
*** Web programming
[[https://emmet.io/][Emmet]] is a powerful templating engine that can generate through simple
CSS-like expression some HTML to avoid the user writing everything by