Compare commits

..

11 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
phundrak e42b591bd8 chore(devenv): update environment 2026-05-03 15:40:59 +02:00
6 changed files with 130 additions and 286 deletions
+10 -68
View File
@@ -3,10 +3,11 @@
"devenv": { "devenv": {
"locked": { "locked": {
"dir": "src/modules", "dir": "src/modules",
"lastModified": 1771852244, "lastModified": 1777679510,
"narHash": "sha256-uG8LPb1useAwa0cjO5sEkYhCSPjbWiCH3DyNxQLVSck=",
"owner": "cachix", "owner": "cachix",
"repo": "devenv", "repo": "devenv",
"rev": "c88c14a32d06173867e26b7d4f5daed38a3f6f1e", "rev": "bc8b21628907c726c74094cedc439c10a455cdb7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -16,71 +17,16 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1771858127,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "49bbbfc218bf3856dfa631cead3b052d78248b83",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762808025,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"inputs": { "inputs": {
"nixpkgs-src": "nixpkgs-src" "nixpkgs-src": "nixpkgs-src"
}, },
"locked": { "locked": {
"lastModified": 1770434727, "lastModified": 1776852779,
"narHash": "sha256-WwO/ITisCXwyiRgtktZgv3iGhAGO+IB5Av4kKCwezR0=",
"owner": "cachix", "owner": "cachix",
"repo": "devenv-nixpkgs", "repo": "devenv-nixpkgs",
"rev": "8430f16a39c27bdeef236f1eeb56f0b51b33d348", "rev": "ec3063523dcd911aeadb50faa589f237cdab5853",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -93,11 +39,11 @@
"nixpkgs-src": { "nixpkgs-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1769922788, "lastModified": 1776329215,
"narHash": "sha256-H3AfG4ObMDTkTJYkd8cz1/RbY9LatN5Mk4UF48VuSXc=", "narHash": "sha256-a8BYi3mzoJ/AcJP8UldOx8emoPRLeWqALZWu4ZvjPXw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "207d15f1a6603226e1e223dc79ac29c7846da32e", "rev": "b86751bc4085f48661017fa226dee99fab6c651b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -110,11 +56,7 @@
"root": { "root": {
"inputs": { "inputs": {
"devenv": "devenv", "devenv": "devenv",
"git-hooks": "git-hooks", "nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
]
} }
} }
}, },
+4 -2
View File
@@ -505,7 +505,7 @@ A couple of keybindings are hidden from which-key, otherwise theres not
much to say. The prefix here is ~w~. much to say. The prefix here is ~w~.
#+name: keybindings-windows #+name: keybindings-windows
| Key | Function | Description | Package | | Key | Function | Description | Package |
|-----+-------------------------------+-------------+----------------| |-----+-------------------------------+----------------+----------------|
| | | windows | | | | | windows | |
| c | evil-window-left | | evil | | c | evil-window-left | | evil |
| t | evil-window-down | | evil | | t | evil-window-down | | evil |
@@ -530,7 +530,9 @@ much to say. The prefix here is ~w~.
| o | other-window | | | | o | other-window | | |
| D | delete-other-windows | | | | D | delete-other-windows | | |
| w | | writeroom | | | w | | writeroom | |
| w. | writeroom-buffer-width/body | | writeroom-mode | | 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 | | ww | writeroom-mode | | writeroom-mode |
** Quit ** Quit
+50 -48
View File
@@ -1280,7 +1280,7 @@ in quite a few languages.
langtool-show-message-at-point langtool-show-message-at-point
langtool-correct-buffer) langtool-correct-buffer)
:custom :custom
(langtool-default-language "en-US") (langtool-default-language "en-GB")
(langtool-mother-tongue "fr") (langtool-mother-tongue "fr")
:config :config
(setq langtool-http-server-host "localhost" (setq langtool-http-server-host "localhost"
@@ -1399,53 +1399,6 @@ left it.
#+end_src #+end_src
** Project Management ** 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
Magit is an awesome wrapper around Git for Emacs! Very often, I go Magit is an awesome wrapper around Git for Emacs! Very often, I go
from disliking to really hating Git GUI clients because they often 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)) (setq magit-todos-ignore-case nil))
#+end_src #+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
Forge acts as an interface for GitHub, GitLab, and Bitbucket inside Forge acts as an interface for GitHub, GitLab, and Bitbucket inside
Magit. A lot of possibilities are present, you can read issues and Magit. A lot of possibilities are present, you can read issues and
@@ -1619,6 +1619,8 @@ to projectile.
(projectile-mode) (projectile-mode)
(add-to-list 'projectile-ignored-projects "~/") (add-to-list 'projectile-ignored-projects "~/")
(add-to-list 'projectile-globally-ignored-directories "^node_modules$") (add-to-list 'projectile-globally-ignored-directories "^node_modules$")
(setopt projectile-ignored-project-function
(lambda (path) (string-prefix-p "/nix/" (file-truename path))))
:general :general
(phundrak/leader-key (phundrak/leader-key
"p" '(:keymap projectile-command-map :which-key "projectile"))) "p" '(:keymap projectile-command-map :which-key "projectile")))
+29
View File
@@ -67,6 +67,9 @@ enough for me.
:after evil :after evil
:config :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 '(?“ . ("“ " . " ”")))
(add-to-list 'evil-surround-pairs-alist '(? . ("" . "")))
(global-evil-surround-mode 1)) (global-evil-surround-mode 1))
#+end_src #+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-maximize-window nil
writeroom-mode-line t writeroom-mode-line t
writeroom-major-modes '(text-mode org-mode markdown-mode nov-mode Info-mode))) 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 #+end_src
-26
View File
@@ -480,30 +480,4 @@ the following code.
(require 'tramp-sh) (require 'tramp-sh)
(setq tramp-remote-path (append tramp-remote-path (setq tramp-remote-path (append tramp-remote-path
'(tramp-own-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 #+end_src
+10 -115
View File
@@ -6,6 +6,15 @@
* Programming * Programming
** Tools ** 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 *** Treesitter
Treesit is a native Emacs [[https://tree-sitter.github.io/tree-sitter/][tree-sitter]] implementation which provides a 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. very fast and flexible way of performing code-highlighting in Emacs.
@@ -22,41 +31,12 @@ variables to install grammars for different languages.
#+end_src #+end_src
#+begin_src emacs-lisp #+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 (use-package treesit-fold
:after tree-sitter :after tree-sitter
:straight (:build t :host github :repo "emacs-tree-sitter/treesit-fold") :straight (:build t :host github :repo "emacs-tree-sitter/treesit-fold")
:init (global-treesit-fold-mode t)) :init (global-treesit-fold-mode t))
#+end_src #+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 *** Flycheck
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package flycheck (use-package flycheck
@@ -633,6 +613,7 @@ Markdown.
(use-package nix-ts-mode (use-package nix-ts-mode
:mode "\\.nix\\'" :mode "\\.nix\\'"
:straight (:build t) :straight (:build t)
:hook (nix-ts-mode . lsp-deferred)
:config (add-to-list 'major-mode-remap-alist '((nix-mode . nix-ts-mode)))) :config (add-to-list 'major-mode-remap-alist '((nix-mode . nix-ts-mode))))
#+end_src #+end_src
@@ -661,74 +642,6 @@ Nginx syntax.
(add-to-list 'company-backends #'company-nginx)))) (add-to-list 'company-backends #'company-nginx))))
#+end_src #+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 *** Ron files
Rusty Object Notation, or RON for short, is to Rust what Json is to 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 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\\'") :mode "\\.yaml\\'")
#+end_src #+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 ** General Programming Languages
*** C/C++ *** C/C++
I know, I know, C and C++ no longer are closely related languages, 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)) (remove-hook 'rustic-mode-hook #'rustic-setup-lsp))
#+end_src #+end_src
*** Uiua
#+begin_src emacs-lisp
(use-package uiua-ts-mode
:mode "\\.ua\\'"
:straight (:build t))
#+end_src
*** Web programming *** Web programming
[[https://emmet.io/][Emmet]] is a powerful templating engine that can generate through simple [[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 CSS-like expression some HTML to avoid the user writing everything by