Compare commits
20 Commits
7a7700855f
...
21c570a440
| Author | SHA1 | Date | |
|---|---|---|---|
|
21c570a440
|
|||
|
9b266c444d
|
|||
|
3fe9b05623
|
|||
|
c29895d019
|
|||
|
003d5d12cf
|
|||
|
764be96265
|
|||
|
4b070dbe4f
|
|||
|
e432aa5f20
|
|||
|
419d291d21
|
|||
|
43e54218a9
|
|||
|
bbfd7414f4
|
|||
|
06a787d3c9
|
|||
|
0adfe045a8
|
|||
|
79fbbd45e5
|
|||
|
df99684d3c
|
|||
|
4adcfc8f6f
|
|||
|
9d58977c68
|
|||
|
5c28ff6d39
|
|||
|
880d9a0a4a
|
|||
|
11aba117de
|
@@ -90,28 +90,32 @@ Undefining some stuff to make keybind prefixes work correctly.
|
||||
** Apps
|
||||
Here are my apps keybindings. Each one of them is prefixed by ~a~.
|
||||
#+name: keybindings-apps
|
||||
| Key | Function | Description | Package |
|
||||
|-----+----------------------------+-------------+------------|
|
||||
| | | apps | |
|
||||
| c | calc | | |
|
||||
| C | | calendar | |
|
||||
| CC | calendar | | |
|
||||
| Co | org-agenda | | org |
|
||||
| Cs | org-caldav-sync | | org-caldav |
|
||||
| d | docker | | docker |
|
||||
| E | elfeed | | elfeed |
|
||||
| e | | email | |
|
||||
| ec | mu4e-compose-new | | mu4e |
|
||||
| em | mu4e | | mu4e |
|
||||
| k | keycast-mode | | keycast |
|
||||
| K | keycast-log-mode | | keycast |
|
||||
| m | | mastodon | |
|
||||
| mm | mastodon | | mastodon |
|
||||
| mn | mastodon-notifications-get | | mastodon |
|
||||
| mt | mastodon-toot | | mastodon |
|
||||
| T | tetris | | |
|
||||
| S | screenshot | | screenshot |
|
||||
| w | wttrin | | wttrin |
|
||||
| Key | Function | Description | Package |
|
||||
|-----+----------------------------+-------------+-----------------|
|
||||
| | | apps | |
|
||||
| a | | AI | |
|
||||
| ae | eca | | eca |
|
||||
| aC | claude-code-ide | | claude-code-ide |
|
||||
| ac | claude-code-ide-menu | | claude-code-ide |
|
||||
| c | calc | | |
|
||||
| C | | calendar | |
|
||||
| CC | calendar | | |
|
||||
| Co | org-agenda | | org |
|
||||
| Cs | org-caldav-sync | | org-caldav |
|
||||
| d | docker | | docker |
|
||||
| E | elfeed | | elfeed |
|
||||
| e | | email | |
|
||||
| ec | mu4e-compose-new | | mu4e |
|
||||
| em | mu4e | | mu4e |
|
||||
| k | keycast-mode | | keycast |
|
||||
| K | keycast-log-mode | | keycast |
|
||||
| m | | mastodon | |
|
||||
| mm | mastodon | | mastodon |
|
||||
| mn | mastodon-notifications-get | | mastodon |
|
||||
| mt | mastodon-toot | | mastodon |
|
||||
| T | tetris | | |
|
||||
| S | screenshot | | screenshot |
|
||||
| w | wttrin | | wttrin |
|
||||
|
||||
*** Shell apps
|
||||
I also have two main shell-related functions, prefixed with ~as~.
|
||||
@@ -407,10 +411,10 @@ My keybindings for jumping around are prefixed by ~j~.
|
||||
| Key | Function | Description | Package |
|
||||
|-----+----------------------------------+-------------+----------|
|
||||
| | | language | |
|
||||
| . | langtool-correct-at-point | | langtool |
|
||||
| B | langtool-correct-buffer | | langtool |
|
||||
| b | langtool-check-buffer | | langtool |
|
||||
| c | langtool-check | | langtool |
|
||||
| C | langtool-correct-at-point | | langtool |
|
||||
| d | langtool-check-done | | langtool |
|
||||
| l | langtool-switch-default-language | | langtool |
|
||||
| p | langtool-show-message-at-point | | langtool |
|
||||
@@ -466,7 +470,13 @@ My keybindings for my projects are prefixed by ~p~.
|
||||
| Key | Function | Description | Package |
|
||||
|-----+--------------------------------+-------------+----------|
|
||||
| | | org | |
|
||||
| c | org-capture | | org |
|
||||
| c | | clock | |
|
||||
| cc | org-clock-cancel | | org |
|
||||
| cd | org-clock-display | | org |
|
||||
| cg | org-clock-goto | | org |
|
||||
| ci | org-clock-in | | org |
|
||||
| co | org-clock-out | | org |
|
||||
| C | org-capture | | org |
|
||||
| r | | roam | |
|
||||
| rb | org-mark-ring-goto | back | org-roam |
|
||||
| rB | org-roam-buffer-toggle | | org-roam |
|
||||
|
||||
@@ -33,6 +33,35 @@
|
||||
:defer t)
|
||||
#+end_src
|
||||
|
||||
** AI
|
||||
*** Claude Code Emacs
|
||||
#+begin_src emacs-lisp
|
||||
(use-package claude-code-ide
|
||||
:defer t
|
||||
:straight (:build t :type git :host github :repo "manzaltu/claude-code-ide.el")
|
||||
:custom
|
||||
((claude-code-ide-terminal-backend 'eat)
|
||||
(claude-code-ide-enable-mcp-server t))
|
||||
:config
|
||||
(claude-code-ide-emacs-tools-setup))
|
||||
#+end_src
|
||||
|
||||
*** Editor Code Assistant
|
||||
The Editor Code Assistant, or ECA, is a nice package that allows the
|
||||
user to use an AI agent right in Emacs. AI is certainly not something
|
||||
that will replace programmers any time soon, but it’s still a nice
|
||||
tool to have when you know what you’re doing.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package eca
|
||||
:defer t
|
||||
:init (setopt eca-extra-args '("--verbose" "--log-level debug"))
|
||||
:straight (:build t
|
||||
:host github
|
||||
:repo "editor-code-assistant/eca-emacs"
|
||||
:files ("*.el")))
|
||||
#+end_src
|
||||
|
||||
** Bitwarden
|
||||
This package is still a very much work in progress one I’m developing
|
||||
in order to interact with Bitwarden in Emacs with the help of the
|
||||
@@ -295,6 +324,7 @@ know about it since I don’t want it to include it a second time after
|
||||
(setq message-signature nil
|
||||
mail-signature nil)
|
||||
#+end_src
|
||||
|
||||
*** Gnus
|
||||
#+begin_src emacs-lisp
|
||||
(use-package gnus
|
||||
@@ -406,8 +436,8 @@ configuration for the ~mu4e~ package itself.
|
||||
(require 'mu4e)
|
||||
(remove-hook 'mu4e-main-mode-hook 'evil-collection-mu4e-update-main-view)
|
||||
|
||||
<<mu4e-ical-setup>>
|
||||
<<mu4e-ical-init-config>>
|
||||
;; <<mu4e-ical-setup>>
|
||||
;; <<mu4e-ical-init-config>>
|
||||
|
||||
(setopt mu4e-completing-read-function 'completing-read
|
||||
mu4e-use-fancy-chars t
|
||||
@@ -433,7 +463,7 @@ configuration for the ~mu4e~ package itself.
|
||||
(add-hook 'mu4e-view-mode-hook (lambda () (setq truncate-lines nil)))
|
||||
(add-hook 'mu4e-headers-mode-hook (lambda () (setq truncate-lines t)))
|
||||
|
||||
<<mu4e-ical-config>>
|
||||
;; <<mu4e-ical-config>>
|
||||
<<mu4e-keybindings-undef>>
|
||||
<<mu4e-keybindings-view>>
|
||||
<<mu4e-keybindings-view-no-prefix>>
|
||||
@@ -506,8 +536,8 @@ events shared with me on my personal mailbox. The answer is actually
|
||||
[[https://www.djcbsoftware.nl/code/mu/mu4e/iCalendar.html][dead simple]].
|
||||
#+name: mu4e-ical-setup
|
||||
#+begin_src emacs-lisp
|
||||
(require 'mu4e-icalendar)
|
||||
(mu4e-icalendar-setup)
|
||||
;; (require 'mu4e-icalendar)
|
||||
;; (mu4e-icalendar-setup)
|
||||
#+end_src
|
||||
|
||||
I’ll just configure a couple of things regarding these events, namely
|
||||
@@ -515,14 +545,14 @@ converting them to org-mode and add them to my =~/org/notes.org= file,
|
||||
and delete the email once I answered to the event.
|
||||
#+name: mu4e-ical-config
|
||||
#+begin_src emacs-lisp
|
||||
(setq mu4e-icalendar-trash-after-reply t)
|
||||
;; (setq mu4e-icalendar-trash-after-reply t)
|
||||
#+end_src
|
||||
|
||||
#+name: mu4e-ical-init-config
|
||||
#+begin_src emacs-lisp
|
||||
(setq gnus-icalendar-org-capture-file "~/org/notes.org"
|
||||
gnus-icalendar-org-capture-headline '("Calendar"))
|
||||
(gnus-icalendar-org-setup)
|
||||
;; (setq gnus-icalendar-org-capture-file "~/org/notes.org"
|
||||
;; gnus-icalendar-org-capture-headline '("Calendar"))
|
||||
;; (gnus-icalendar-org-setup)
|
||||
#+end_src
|
||||
|
||||
**** Basic configuration
|
||||
@@ -1011,8 +1041,6 @@ skipping the export part and write your emails directly in org-mode?
|
||||
org-msg-signature (format "\n--\n#+begin_signature\n%s\n#+end_signature"
|
||||
(with-temp-buffer
|
||||
(insert-file-contents mail-signature-file)
|
||||
(while (re-search-forward "\n" nil t)
|
||||
(replace-match "\n\n"))
|
||||
(buffer-string))))
|
||||
:general
|
||||
(phundrak/major-leader-key
|
||||
@@ -1214,6 +1242,40 @@ minibuffer, both separated by a single space."
|
||||
("q" nil :exit t))
|
||||
#+end_src
|
||||
|
||||
** Langtool
|
||||
LanguageTool is a great tool for catching typos and grammatical errors
|
||||
in quite a few languages.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package langtool
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:commands (langtool-check
|
||||
langtool-check-done
|
||||
langtool-show-message-at-point
|
||||
langtool-correct-buffer)
|
||||
:custom
|
||||
(langtool-default-language "en-US")
|
||||
(langtool-mother-tongue "fr")
|
||||
:config
|
||||
(setq langtool-http-server-host "localhost"
|
||||
langtool-http-server-port 8081))
|
||||
#+end_src
|
||||
|
||||
Finally, =writegood-mode= detects some simple general rules when writing
|
||||
in English and can also calculate the Flesh-Kincaid levels of a
|
||||
document.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package writegood-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:hook org-mode latex-mode
|
||||
:general
|
||||
(phundrak/major-leader-key
|
||||
:keymaps 'writegood-mode-map
|
||||
"g" #'writegood-grade-level
|
||||
"r" #'writegood-reading-ease))
|
||||
#+end_src
|
||||
|
||||
** Nov
|
||||
Nov is a major-mode for reading EPUB files within Emacs. Since I have
|
||||
it, I don’t need any other Epub reader on my computer! Plus this one
|
||||
@@ -1311,6 +1373,60 @@ left it.
|
||||
#+end_src
|
||||
|
||||
** Project Management
|
||||
*** Jujutsu
|
||||
Let’s face it: [[https://git-scm.com/][git]] is awesome. There’s 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 it’s not great.
|
||||
|
||||
[[https://jj-vcs.github.io/][Jujutsu]] on the other hand, is awesome! It’s 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 it’s entirely
|
||||
compatible with git repositories. In fact, I pretty much don’t use git
|
||||
anymore, jj (abbreviation of Jujutsu) has almost completely replaced
|
||||
git for me.
|
||||
|
||||
It comes to no surprise then that I will use [[https://elpa.gnu.org/packages/vc-jj.html][=vc-jj=]], a Jujutsu
|
||||
backend for =vc.el= and =project.el=.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package vc-jj
|
||||
:straight (:build t)
|
||||
:defer nil)
|
||||
#+end_src
|
||||
|
||||
As mentioned in the package’s README, I do need to set these lines in
|
||||
my jj config:
|
||||
#+begin_src toml :tangle no
|
||||
[ui]
|
||||
diff-formatter = ":git"
|
||||
conflict-marker-style = "git"
|
||||
#+end_src
|
||||
|
||||
I also like Magit’s interface, as you can see in my [[file:./applications.md#magit][Magit]] config.
|
||||
Therefore, let’s install =jujutsu-mode= which attempts to recreate a
|
||||
Magit-style interface for Jujutsu.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package jj-mode
|
||||
:straight (:build t :host github :repo "bolivier/jj-mode.el")
|
||||
:defer t)
|
||||
#+end_src
|
||||
|
||||
Though, I’ll 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
|
||||
|
||||
*** 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
|
||||
@@ -1581,31 +1697,12 @@ buffer.
|
||||
(shell-pop-cleanup-buffer-at-process-exit t))
|
||||
#+end_src
|
||||
|
||||
** XWidgets Webkit Browser
|
||||
I used to use the xwidgets webkit browser in order to view or preview
|
||||
HTML files from Emacs, but it seems the Cairo background transparency
|
||||
patch breaks it. So while this isn’t patched, I will disable Xwidgets
|
||||
in my Emacs build, and these keybinds *will not* be tangled.
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(phundrak/evil
|
||||
:keymaps 'xwidget-webkit-mode-map
|
||||
"<mouse-4>" #'xwidget-webkit-scroll-down-line
|
||||
"<mouse-5>" #'xwidget-webkit-scroll-up-line
|
||||
"c" #'xwidget-webkit-scroll-backward
|
||||
"t" #'xwidget-webkit-scroll-up-line
|
||||
"s" #'xwidget-webkit-scroll-down-line
|
||||
"r" #'xwidget-webkit-scroll-forward
|
||||
"h" #'xwidget-webkit-goto-history
|
||||
"C" #'xwidget-webkit-back
|
||||
"R" #'xwidget-webkit-forward
|
||||
"C-r" #'xwidget-webkit-reload
|
||||
"j" nil
|
||||
"k" nil
|
||||
"l" nil
|
||||
"H" nil
|
||||
"L" nil
|
||||
"C-d" #'xwidget-webkit-scroll-up
|
||||
"C-u" #'xwidget-webkit-scroll-down)
|
||||
** Wakatime
|
||||
#+begin_src emacs-lisp
|
||||
(use-package wakatime-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:init (global-wakatime-mode))
|
||||
#+end_src
|
||||
|
||||
** Wttr.in
|
||||
|
||||
@@ -18,34 +18,27 @@ variables to install grammars for different languages.
|
||||
:hook ((bash-ts-mode c-ts-mode c++-ts-mode
|
||||
html-ts-mode js-ts-mode typescript-ts-mode
|
||||
json-ts-mode rust-ts-mode tsx-ts-mode python-ts-mode
|
||||
css-ts-mode yaml-ts-mode) . lsp-deferred)
|
||||
css-ts-mode yaml-ts-mode) . lsp-deferred))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package tree-sitter-langs
|
||||
:after tree-sitter
|
||||
:straight t
|
||||
:custom (global-tree-sitter-mode t)
|
||||
:init
|
||||
(setq treesit-font-lock-level 4
|
||||
treesit-language-source-alist
|
||||
'((astro "https://github.com/virchau13/tree-sitter-astro")
|
||||
(bash "https://github.com/tree-sitter/tree-sitter-bash")
|
||||
(c "https://github.com/tree-sitter/tree-sitter-c")
|
||||
(cmake "https://github.com/uyha/tree-sitter-cmake")
|
||||
(common-lisp "https://github.com/theHamsta/tree-sitter-commonlisp")
|
||||
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
|
||||
(css "https://github.com/tree-sitter/tree-sitter-css")
|
||||
(csharp "https://github.com/tree-sitter/tree-sitter-c-sharp")
|
||||
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
|
||||
(go "https://github.com/tree-sitter/tree-sitter-go")
|
||||
(go-mod "https://github.com/camdencheek/tree-sitter-go-mod")
|
||||
(html "https://github.com/tree-sitter/tree-sitter-html")
|
||||
(js ("https://github.com/tree-sitter/tree-sitter-javascript" "master" "src"))
|
||||
(json "https://github.com/tree-sitter/tree-sitter-json")
|
||||
(lua "https://github.com/Azganoth/tree-sitter-lua")
|
||||
(make "https://github.com/alemuller/tree-sitter-make")
|
||||
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
|
||||
(python "https://github.com/tree-sitter/tree-sitter-python")
|
||||
(r "https://github.com/r-lib/tree-sitter-r")
|
||||
(rust "https://github.com/tree-sitter/tree-sitter-rust")
|
||||
(toml "https://github.com/tree-sitter/tree-sitter-toml")
|
||||
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
|
||||
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
|
||||
(yaml "https://github.com/ikatyang/tree-sitter-yaml"))))
|
||||
(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")
|
||||
:config (treesit-fold-mode))
|
||||
#+end_src
|
||||
|
||||
*** Appwrite
|
||||
@@ -202,9 +195,18 @@ awesome!
|
||||
(lsp-rust-analyzer-cargo-watch-command "clippy")
|
||||
(lsp-eldoc-render-all t)
|
||||
(lsp-idle-delay 0.6)
|
||||
(lsp-rust-analyzer-server-display-inlay-hints t)
|
||||
(lsp-use-plist t)
|
||||
(lsp-enable-indentation nil)
|
||||
;; Bash
|
||||
(lsp-bash-highlight-parsing-errors t)
|
||||
;; Nix
|
||||
;; Rust
|
||||
(lsp-rust-analyzer-server-display-inlay-hints t)
|
||||
;; ;; Vue configuration
|
||||
(lsp-vetur-emmet "always")
|
||||
(lsp-vetur-format-default-formatter-html "prettier")
|
||||
:config
|
||||
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]coverage\\'")
|
||||
(lsp-register-client
|
||||
(make-lsp-client :new-connection (lsp-tramp-connection "shellcheck")
|
||||
:major-modes '(sh-mode)
|
||||
@@ -306,42 +308,6 @@ that currently, ~dap-firefox~ and ~dap-chrome~ don’t work correctly due to
|
||||
:cwd nil))))
|
||||
#+end_src
|
||||
|
||||
*** Langtool
|
||||
LanguageTool is a great tool for catching typos and grammatical errors
|
||||
in quite a few languages.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package langtool
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:commands (langtool-check
|
||||
langtool-check-done
|
||||
langtool-show-message-at-point
|
||||
langtool-correct-buffer)
|
||||
:custom
|
||||
(langtool-default-language "en-US")
|
||||
(langtool-mother-tongue "fr")
|
||||
:config
|
||||
(setq langtool-java-classpath (string-join '("/usr/share/languagetool"
|
||||
"/usr/share/java/languagetool/*")
|
||||
":")))
|
||||
#+end_src
|
||||
|
||||
Finally, =writegood-mode= detects some simple general rules when writing
|
||||
in English and can also calculate the Flesh-Kincaid levels of a
|
||||
document.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package writegood-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:hook org-mode latex-mode
|
||||
:general
|
||||
(phundrak/major-leader-key
|
||||
:keymaps 'writegood-mode-map
|
||||
"g" #'writegood-grade-level
|
||||
"r" #'writegood-reading-ease))
|
||||
#+end_src
|
||||
|
||||
**** TODO Auto detection of langtool java classpath :noexport:
|
||||
** DSLs
|
||||
DSLs, or /Domain Specific Languages/, are languages dedicated to some
|
||||
very tasks, such as configuration languages or non-general programming
|
||||
@@ -650,6 +616,13 @@ Markdown.
|
||||
:defer t)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package nix-ts-mode
|
||||
:mode "\\.nix\\'"
|
||||
:straight (:build t)
|
||||
:config (add-to-list 'major-mode-remap-alist '((nix-mode . nix-ts-mode))))
|
||||
#+end_src
|
||||
|
||||
*** Nginx
|
||||
Nginx is another webserver, older and more mature than Caddy. A couple
|
||||
of packages are required in order to be able to properly work with
|
||||
@@ -720,6 +693,29 @@ or some I write myself.
|
||||
org-plantuml-jar-path "~/.local/bin/plantuml.jar"))
|
||||
#+end_src
|
||||
|
||||
*** QML
|
||||
I’m 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
|
||||
@@ -1389,6 +1385,7 @@ languages in the same buffer, mainly HTML, CSS, and JavaScript.
|
||||
("\\.svelte\\'" . web-mode)
|
||||
("\\.ctp\\'" . web-mode)
|
||||
("\\.djhtml\\'" . web-mode)
|
||||
("\\.ftl\\'" . web-mode)
|
||||
("\\.vue\\'" . web-mode))
|
||||
:config
|
||||
(setopt web-mode-markup-indent-offset 2
|
||||
@@ -1436,8 +1433,7 @@ Auto-completion for ~emmet-mode~, ~html-mode~, and ~web-mode~.
|
||||
(use-package astro-ts-mode
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init
|
||||
(mapc #'treesit-install-language-grammar '(astro css tsx)))
|
||||
:mode "\\.astro\\'")
|
||||
#+end_src
|
||||
|
||||
**** CSS
|
||||
@@ -1451,6 +1447,7 @@ Let’s customize a bit the built-in CSS mode.
|
||||
:hook (scss-mode . prettier-js-mode)
|
||||
:init
|
||||
(put 'css-indent-offset 'safe-local-variable #'integerp)
|
||||
:config (setopt css-indent-offset 2)
|
||||
:general
|
||||
(phundrak/major-leader-key
|
||||
:keymaps 'css-mode-map
|
||||
@@ -1506,6 +1503,16 @@ activate when I open ~.less~ files by default. Let’s fix that.
|
||||
"l" '(:keymap lsp-command-map :which-key "lsp")))
|
||||
#+end_src
|
||||
|
||||
I also use from time to time TailwindCSS. Let’s add its LSP
|
||||
configuration.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package lsp-tailwindcss
|
||||
:defer t
|
||||
:after lsp
|
||||
:init (setq lsp-tailwindcss-add-on-mode t)
|
||||
:straight (:type git :host github :repo "merrickluo/lsp-tailwindcss"))
|
||||
#+end_src
|
||||
|
||||
**** Javascript
|
||||
~javascript-mode~ is meh at best, while ~rjsx-mode~ (Real JSX) is much
|
||||
better: it supports both JavaScript and ~.jsx~ files for React and
|
||||
@@ -1562,15 +1569,14 @@ don’t. Let’s interact with NPM through Emacs then.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package npm-transient
|
||||
:defer t
|
||||
:straight (npm-transient :build t
|
||||
:type git
|
||||
:host github
|
||||
:repo "Phundrak/npm-transient"))
|
||||
;; :general
|
||||
;; (phundrak/major-leader-key
|
||||
;; :packages '(npm-transient rjsx-mode web-mode)
|
||||
;; :keymaps '(rjsx-mode-map web-mode-map)
|
||||
;; "n" #'npm-transient))
|
||||
:straight (:build t
|
||||
:type git
|
||||
:repo "labs.phundrak.com/phundrak/npm-transient.el")
|
||||
:general
|
||||
(phundrak/major-leader-key
|
||||
:packages '(npm-transient typescript-ts-mode web-mode)
|
||||
:keymaps '(web-mode-map)
|
||||
"n" #'npm-transient))
|
||||
#+end_src
|
||||
|
||||
And finally, here is a formatter for JavaScript.
|
||||
@@ -1584,8 +1590,21 @@ And finally, here is a formatter for JavaScript.
|
||||
(setq prettier-js-args '("--single-quote" "--jsx-single-quote")))
|
||||
#+end_src
|
||||
|
||||
**** Typescript
|
||||
Typescript is a safer alternative to JavaScript. Let’s install its major mode then.
|
||||
**** Json
|
||||
My configuration for Json is quite short, I’m just defaulting to
|
||||
Emacs’ built-in tree-sitter mode for any =.json= file and reducing the
|
||||
indentation to 2 spaces for any file using a mode from the built-in
|
||||
package =js=.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package js
|
||||
:straight (:type built-in)
|
||||
:mode ("\\.json\\'" . json-ts-mode)
|
||||
:config (setopt js-indent-level 2))
|
||||
#+end_src
|
||||
|
||||
**** TypeScript
|
||||
TypeScript is a safer alternative to JavaScript. Let’s install its major mode then.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package typescript-mode
|
||||
:defer t
|
||||
@@ -1652,7 +1671,12 @@ simplest fix is to run the following command:
|
||||
#+begin_src sh
|
||||
npm install --save-dev vue-tsc typescript
|
||||
#+end_src
|
||||
|
||||
Or replace =npm= with whichever package manager you prefer.
|
||||
|
||||
If you want to work with Vue in Emacs, =web-mode= is more than enough
|
||||
when paired with an LSP server.
|
||||
|
||||
With the Nix package manager, the Vue 3 LSP server is
|
||||
=nodePackages."@vue/language-server"= and not =vue-language-server=. The
|
||||
latter is for Vue 2.
|
||||
|
||||
Reference in New Issue
Block a user