Update .emacs.d/config.org
This commit is contained in:
parent
6829197014
commit
20a1e43944
1 changed files with 93 additions and 87 deletions
|
@ -1,5 +1,8 @@
|
|||
* Emacs config
|
||||
** Packages initialization
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle init.el
|
||||
#+TITLE: Emacs config
|
||||
#+AUTHOR: Anthony Rodriguez
|
||||
|
||||
* Packages initialization
|
||||
Here, we're initializing MELPA, as well as package.el and use-package.
|
||||
#+begin_src emacs-lisp
|
||||
(require 'package)
|
||||
|
@ -15,8 +18,7 @@ Here, we're initializing MELPA, as well as package.el and use-package.
|
|||
(setq use-package-always-ensure t)
|
||||
#+end_src
|
||||
|
||||
*** vc-use-package
|
||||
|
||||
** vc-use-package
|
||||
vc-use-package integrates package-vc-install, which allows installing packages from git repositories, into use-package. It won't be needed from Emacs 30, as it will integrate natively (hence the condition).
|
||||
#+begin_src emacs-lisp
|
||||
(if (< emacs-major-version 30)
|
||||
|
@ -24,14 +26,22 @@ vc-use-package integrates package-vc-install, which allows installing packages f
|
|||
(package-vc-install "https://github.com/slotThe/vc-use-package"))
|
||||
(require 'vc-use-package))
|
||||
#+end_src
|
||||
** General config
|
||||
*** no-littering
|
||||
|
||||
** Automatically tangle on save
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda () (add-hook 'after-save-hook #'org-babel-tangle
|
||||
:append :local)))
|
||||
#+end_src
|
||||
* General config
|
||||
** no-littering
|
||||
no-littering is a useful package that allows to put all of the autosave files and temporary files in one directory (the files ending with ~ for instance).
|
||||
#+begin_src emacs-lisp
|
||||
(use-package no-littering)
|
||||
#+end_src
|
||||
|
||||
*** Minimal interface
|
||||
** Minimal interface
|
||||
We disable a lot of interface elements, to make the editor more minimal looking.
|
||||
#+begin_src emacs-lisp
|
||||
(setq inhibit-startup-message t)
|
||||
|
@ -42,9 +52,9 @@ We disable a lot of interface elements, to make the editor more minimal looking.
|
|||
(menu-bar-mode -1)
|
||||
#+end_src
|
||||
|
||||
*** Match fish shell's path
|
||||
** Match fish shell's path
|
||||
#+begin_src emacs-lisp
|
||||
(defun set-exec-path-from-shell-PATH ()
|
||||
(defun set-exec-path-from-shell-PATH ()
|
||||
"Set up Emacs' `exec-path' and PATH environment variable to match
|
||||
that used by the user's shell.
|
||||
|
||||
|
@ -61,16 +71,16 @@ We disable a lot of interface elements, to make the editor more minimal looking.
|
|||
(set-exec-path-from-shell-PATH)
|
||||
#+end_src
|
||||
|
||||
*** Bell
|
||||
** Bell
|
||||
I don't like any visual or sound bell.
|
||||
#+begin_src emacs-lisp
|
||||
(setq ring-bell-function 'ignore)
|
||||
#+end_src
|
||||
|
||||
*** Font
|
||||
** Font
|
||||
I use two different fonts in Emacs : my sans serif font for anything where variable fonts wouldn't matter, and monospace for fixed width text (such as code, org blocks and org tables). I like to use the generic sans-serif and monospace fonts, as it allows me to define them system-wide, which I highly prefer.
|
||||
|
||||
Besides the font settings, I use the package fixed-pitch, which sets up hooks automatically for all the modes that require fixed width fonts. This allows me to have my sans serif everywhere else but in
|
||||
Besides the font settings, I use the package fixed-pitch, which sets up hooks automatically for all the modes that require fixed width fonts. This allows me to have my sans serif everywhere else but in
|
||||
#+begin_src emacs-lisp
|
||||
;; Set base fonts
|
||||
(set-face-attribute 'default nil :font "sans-serif" :height 125)
|
||||
|
@ -87,7 +97,7 @@ Besides the font settings, I use the package fixed-pitch, which sets up hooks au
|
|||
:vc ( :fetcher github :repo cstby/fixed-pitch-mode))
|
||||
#+end_src
|
||||
|
||||
**** Ligatures
|
||||
** Ligatures
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ligature
|
||||
:config
|
||||
|
@ -108,13 +118,13 @@ Besides the font settings, I use the package fixed-pitch, which sets up hooks au
|
|||
(global-ligature-mode t))
|
||||
#+end_src
|
||||
|
||||
*** Visual mode
|
||||
** Visual mode
|
||||
We turn on visual mode, so that lines can wrap nicely and do go beyond my Emacs buffer size.
|
||||
#+begin_src emacs-lisp
|
||||
(global-visual-line-mode t)
|
||||
#+end_src
|
||||
|
||||
*** Theme
|
||||
** Theme
|
||||
I use catppuccin as my theme, as I find it comfortable to work with (the Frappe flavor).
|
||||
#+begin_src emacs-lisp
|
||||
(use-package catppuccin-theme
|
||||
|
@ -124,68 +134,67 @@ I use catppuccin as my theme, as I find it comfortable to work with (the Frappe
|
|||
(load-theme 'catppuccin :no-confirm))
|
||||
#+end_src
|
||||
|
||||
*** Modeline
|
||||
** Modeline
|
||||
I use doom-modeline as my modeline, as I find it really clean and minimal.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package doom-modeline
|
||||
:ensure t
|
||||
:init (doom-modeline-mode 1)
|
||||
:config
|
||||
(setq doom-modeline-height 30)
|
||||
(setq nerd-icons-font-family "monospace"))
|
||||
:ensure t
|
||||
:init (doom-modeline-mode 1)
|
||||
:config
|
||||
(setq doom-modeline-height 30))
|
||||
#+end_src
|
||||
|
||||
*** Completion
|
||||
** Completion
|
||||
I use vertico as my completion framework. It's minimal, fast and tells me all I need to know and even sorts by history.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package vertico
|
||||
:init
|
||||
(vertico-mode)
|
||||
(use-package vertico
|
||||
:init
|
||||
(vertico-mode)
|
||||
|
||||
;; Different scroll margin
|
||||
;; (setq vertico-scroll-margin 0)
|
||||
;; Different scroll margin
|
||||
;; (setq vertico-scroll-margin 0)
|
||||
|
||||
;; Show more candidates
|
||||
;; (setq vertico-count 20)
|
||||
;; Show more candidates
|
||||
;; (setq vertico-count 20)
|
||||
|
||||
;; Grow and shrink the Vertico minibuffer
|
||||
(setq vertico-resize t)
|
||||
;; Grow and shrink the Vertico minibuffer
|
||||
(setq vertico-resize t)
|
||||
|
||||
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
|
||||
(setq vertico-cycle t))
|
||||
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
|
||||
(setq vertico-cycle t))
|
||||
|
||||
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||
(use-package savehist
|
||||
:init
|
||||
(savehist-mode))
|
||||
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||
(use-package savehist
|
||||
:init
|
||||
(savehist-mode))
|
||||
|
||||
;; A few more useful configurations...
|
||||
(use-package emacs
|
||||
:init
|
||||
;; Add prompt indicator to `completing-read-multiple'.
|
||||
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
|
||||
(defun crm-indicator (args)
|
||||
(cons (format "[CRM%s] %s"
|
||||
(replace-regexp-in-string
|
||||
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
|
||||
crm-separator)
|
||||
(car args))
|
||||
(cdr args)))
|
||||
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
||||
;; A few more useful configurations...
|
||||
(use-package emacs
|
||||
:init
|
||||
;; Add prompt indicator to `completing-read-multiple'.
|
||||
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
|
||||
(defun crm-indicator (args)
|
||||
(cons (format "[CRM%s] %s"
|
||||
(replace-regexp-in-string
|
||||
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
|
||||
crm-separator)
|
||||
(car args))
|
||||
(cdr args)))
|
||||
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
||||
|
||||
;; Do not allow the cursor in the minibuffer prompt
|
||||
(setq minibuffer-prompt-properties
|
||||
'(read-only t cursor-intangible t face minibuffer-prompt))
|
||||
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
||||
;; Do not allow the cursor in the minibuffer prompt
|
||||
(setq minibuffer-prompt-properties
|
||||
'(read-only t cursor-intangible t face minibuffer-prompt))
|
||||
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
||||
|
||||
;; Support opening new minibuffers from inside existing minibuffers.
|
||||
(setq enable-recursive-minibuffers t)
|
||||
;; Support opening new minibuffers from inside existing minibuffers.
|
||||
(setq enable-recursive-minibuffers t)
|
||||
|
||||
;; Emacs 28 and newer: Hide commands in M-x which do not work in the current
|
||||
;; mode. Vertico commands are hidden in normal buffers. This setting is
|
||||
;; useful beyond Vertico.
|
||||
(setq read-extended-command-predicate #'command-completion-default-include-p))
|
||||
|
||||
;; Emacs 28 and newer: Hide commands in M-x which do not work in the current
|
||||
;; mode. Vertico commands are hidden in normal buffers. This setting is
|
||||
;; useful beyond Vertico.
|
||||
(setq read-extended-command-predicate #'command-completion-default-include-p))
|
||||
|
||||
(use-package orderless
|
||||
:ensure t
|
||||
:custom
|
||||
|
@ -193,7 +202,7 @@ I use vertico as my completion framework. It's minimal, fast and tells me all I
|
|||
(completion-category-overrides '((file (styles basic partial-completion)))))
|
||||
#+end_src
|
||||
|
||||
*** which-key
|
||||
** which-key
|
||||
which-key is a nice little package that allows to have a minibuffer showing which keybinds are available under prefixes.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package which-key
|
||||
|
@ -201,22 +210,24 @@ which-key is a nice little package that allows to have a minibuffer showing whic
|
|||
(which-key-mode))
|
||||
#+end_src
|
||||
|
||||
*** Discord presence
|
||||
** Discord presence
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elcord
|
||||
:config
|
||||
(elcord-mode))
|
||||
#+end_src
|
||||
** Org mode
|
||||
*** Pretty bullets and headlines
|
||||
|
||||
* Org mode
|
||||
** Pretty bullets and headlines
|
||||
I use org-superstar-mode, as it makes headlines and bullets look really nice.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package org-superstar
|
||||
:hook (org-mode . org-superstar-mode))
|
||||
#+end_src
|
||||
|
||||
** Programming
|
||||
*** Eglot
|
||||
* Programming
|
||||
** Eglot
|
||||
Eglot is a built in LSP client for Emacs. I prefer it to LSP as it's more lightweight and more straightforward to setup correctly.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package eglot
|
||||
:bind (:map eglot-mode-map
|
||||
|
@ -235,7 +246,7 @@ I use org-superstar-mode, as it makes headlines and bullets look really nice.
|
|||
(eglot-booster-mode))
|
||||
#+end_src
|
||||
|
||||
*** Autocompletion
|
||||
** Autocompletion
|
||||
#+begin_src emacs-lisp
|
||||
(use-package corfu
|
||||
:custom
|
||||
|
@ -246,7 +257,7 @@ I use org-superstar-mode, as it makes headlines and bullets look really nice.
|
|||
(corfu-popupinfo-mode))
|
||||
#+end_src
|
||||
|
||||
*** Snippets
|
||||
** Snippets
|
||||
#+begin_src emacs-lisp
|
||||
(use-package yasnippet
|
||||
:ensure t
|
||||
|
@ -256,15 +267,21 @@ I use org-superstar-mode, as it makes headlines and bullets look really nice.
|
|||
("C-c C-e" . yas-expand)))
|
||||
#+end_src
|
||||
|
||||
*** Magit
|
||||
** Magit
|
||||
Magit is a git client in Emacs.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package magit)
|
||||
#+end_src
|
||||
|
||||
*** Languages
|
||||
**** tree-sitter
|
||||
Tree-sitter is a built-in Emacs package that allows us to have extremely well integrated language. Here, we're setting up the list of sources, most of them being on tree-sitter's official GitHub, as well as hooking up the languages to their different modes.
|
||||
** Docker
|
||||
#+begin_src emacs-lisp
|
||||
(use-package docker
|
||||
:ensure t
|
||||
:bind ("C-c d" . docker))
|
||||
#+end_src
|
||||
** Languages
|
||||
*** tree-sitter
|
||||
Tree-sitter is a built-in Emacs package that allows us to have extremely well integrated language grammar. Here, we're setting up the list of sources, most of them being on tree-sitter's official GitHub, as well as hooking up the languages to their different modes.
|
||||
#+begin_src emacs-lisp
|
||||
(setq treesit-language-source-alist
|
||||
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
|
||||
|
@ -287,11 +304,7 @@ Tree-sitter is a built-in Emacs package that allows us to have extremely well in
|
|||
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
|
||||
#+end_src
|
||||
|
||||
#+begin_src sh
|
||||
npm install -g typescript-language-server
|
||||
#+end_src
|
||||
|
||||
**** Alapheia
|
||||
*** Alapheia
|
||||
#+begin_src emacs-lisp
|
||||
(use-package apheleia
|
||||
:ensure t
|
||||
|
@ -304,21 +317,14 @@ Tree-sitter is a built-in Emacs package that allows us to have extremely well in
|
|||
(use-package dtrt-indent)
|
||||
#+end_src
|
||||
|
||||
**** expand-region
|
||||
** expand-region
|
||||
#+begin_src emacs-lisp
|
||||
(use-package expand-region
|
||||
:bind ("C-=" . er/expand-region))
|
||||
#+end_src
|
||||
|
||||
** Mail
|
||||
|
||||
* Mail
|
||||
#+begin_src emacs-lisp
|
||||
(autoload 'notmuch "notmuch" "notmuch mail" t)
|
||||
(use-package notmuch)
|
||||
#+end_src
|
||||
|
||||
*** SMTP
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq send-mail-function 'sendmail-query-once)
|
||||
#+end_src
|
||||
|
|
Loading…
Reference in a new issue