New config as a flake
This commit is contained in:
parent
627707f13d
commit
819123f2b7
9 changed files with 674 additions and 326 deletions
322
README.org
322
README.org
|
@ -1,321 +1,3 @@
|
|||
#+PROPERTY: header-args:emacs-lisp :tangle yes
|
||||
* My opinionated Emacs
|
||||
|
||||
* My Emacs' configuration
|
||||
|
||||
This is my Emacs configuration, it's written as [[https://www.wikiwand.com/en/Literate_programming][literate programming]]
|
||||
using [[https://orgmode.org/][org-mode]]'s Babel.
|
||||
All the settings are enclosed inside this single file named
|
||||
[[README.org]], the reason of this choice is that many services (like
|
||||
GitHub) automatically looks for these names.
|
||||
The configuration of different Emacs' aspects are kept divided in
|
||||
different paragraphs.
|
||||
|
||||
This file must be considered part of the Git repository to which it
|
||||
belongs and it may not work properly without the other files.
|
||||
Despite I mainly use [[https://nixos.org][NixOS]] I chose to keep my Emacs configuration
|
||||
detached from my Nix files, this way I should be able get my Emacs'
|
||||
settings in a non-Nix environment.
|
||||
|
||||
However the installing process of the required packages is not managed
|
||||
by this configuration; for example on my NixOS system I use the
|
||||
[[https://github.com/nix-community/emacs-overlay][emacs-overlay]] which automatically parses this file looking for the
|
||||
~(use-package <package>)~ declarations and then downloads and builds
|
||||
the latest versions from MELPA.
|
||||
I preferred to maintain this agnostic approach in order to don't make
|
||||
this already dense file even more complex.
|
||||
Indeed, as it's configured, ~use-package~ should ensure that the
|
||||
packages are installed, and if this is not the case it should install
|
||||
them.
|
||||
|
||||
I use [[https://github.com/ch11ng/exwm][EXWM]] (i.e. Emacs X Window Manager) but since I wanted to keep
|
||||
the possibility to use this configuration also on different systems
|
||||
(maybe without X.org) I tried to isolate its settings.
|
||||
So, even if I never tried, it should be easy to disable it without
|
||||
consequences.
|
||||
|
||||
** General settings
|
||||
This snippet contatins different things that I wasn't able to gather
|
||||
better.
|
||||
Hopefully, in a future, this section won't exist anymore.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq create-lockfiles nil)
|
||||
(setq backup-directory-alist '((".*" . "~/.emacs-saves/")))
|
||||
(setq auto-save-file-name-transforms '((".*" "~/.emacs-saves/" t)))
|
||||
(setq backup-by-copying t)
|
||||
(setq delete-old-versions t
|
||||
kept-new-versions 6
|
||||
kept-old-versions 2
|
||||
version-control t)
|
||||
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
(setq use-dialog-box nil)
|
||||
(menu-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(fringe-mode 1)
|
||||
(setq display-time-format "%H:%M")
|
||||
(display-time-mode 1)
|
||||
(setq mouse-autoselect-window 't)
|
||||
|
||||
(setq inhibit-startup-screen t)
|
||||
|
||||
(setq async-shell-command-buffer 'new-buffer)
|
||||
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
|
||||
(add-hook 'prog-mode-hook 'hl-line-mode)
|
||||
(add-hook 'org-mode-hook 'auto-fill-mode)
|
||||
(set-fill-column 80)
|
||||
|
||||
(add-to-list 'default-frame-alist '(font . "Fira Code-12"))
|
||||
(set-face-attribute 'default t :font "Fira Code-12")
|
||||
|
||||
(setq show-paren-delay 0)
|
||||
(set-face-background 'show-paren-match "#111")
|
||||
(set-face-attribute 'show-paren-match nil :weight 'extra-bold)
|
||||
(show-paren-mode 1)
|
||||
|
||||
(add-hook 'text-mode-hook
|
||||
(lambda () (set-input-method "italian-postfix")))
|
||||
#+end_src
|
||||
|
||||
** Theming
|
||||
I'm using the ~doom-one~ theme from the ~doom-themes~ package.
|
||||
In addition it's loaded the ~all-the-icons~ fonts and a special
|
||||
modeline from ~doom-modeline~.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package doom-themes
|
||||
:config
|
||||
;; Global settings (defaults)
|
||||
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
|
||||
doom-themes-enable-italic t) ; if nil, italics is universally disabled
|
||||
(load-theme 'doom-one t)
|
||||
|
||||
;; Enable flashing mode-line on errors
|
||||
(doom-themes-visual-bell-config)
|
||||
|
||||
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
|
||||
(doom-themes-treemacs-config)
|
||||
|
||||
;; Corrects (and improves) org-mode's native fontification.
|
||||
(doom-themes-org-config)
|
||||
)
|
||||
|
||||
(set-frame-parameter (selected-frame) 'alpha '(98 . 98))
|
||||
(add-to-list 'default-frame-alist '(alpha . (98 . 98)))
|
||||
|
||||
(use-package all-the-icons)
|
||||
|
||||
(use-package doom-modeline
|
||||
:init (doom-modeline-mode 1))
|
||||
|
||||
(use-package fira-code-mode
|
||||
:hook prog-mode
|
||||
:config (setq fira-code-mode-disabled-ligatures '("x")))
|
||||
#+end_src
|
||||
|
||||
** Evil
|
||||
In a future I think I'll try the Emacs keybindings, but for now I
|
||||
prefer the Vim keybindings, at least for the text editing.
|
||||
Since I use small keyboards I think it's better to use a modal editor,
|
||||
however for everything that is not text editing I use the normal Emacs
|
||||
keybindings.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package evil
|
||||
:init
|
||||
(setq evil-want-keybinding nil)
|
||||
:config
|
||||
(progn
|
||||
(evil-mode 1) ; globally enable evil-mode except for the following modes
|
||||
(mapcar (lambda (mode) (evil-set-initial-state mode 'emacs))
|
||||
'(vterm-mode
|
||||
eshell-mode
|
||||
dired-mode
|
||||
))))
|
||||
|
||||
(use-package evil-collection
|
||||
:after (evil company-mode vterm)
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
(use-package org-evil)
|
||||
#+end_src
|
||||
|
||||
** Org configuration
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'org-protocol)
|
||||
(setq org-default-notes-file (concat org-directory "~/notes.org"))
|
||||
(setq org-capture-templates `(
|
||||
("p" "Protocol" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
|
||||
"* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
|
||||
("L" "Protocol Link" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
|
||||
"* %? [[%:link][%:description]] \nCaptured On: %U")
|
||||
))
|
||||
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((python . t)))
|
||||
|
||||
(setq safe-local-variable-values '((eval add-hook 'after-save-hook 'org-icalendar-export-to-ics nil t)))
|
||||
|
||||
(setq org-agenda-files '("~/nas/syncthing/orgzly/Agenda.org" "~/nas/syncthing/orgzly/Lavoro.org"))
|
||||
|
||||
(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.6))
|
||||
;;(use-package org-fragtog
|
||||
;; :hook (org-mode org-fragtog))
|
||||
#+end_src
|
||||
|
||||
** Helm
|
||||
Unfortunately this is currently unmantained (there was only a
|
||||
mantainer, who devoted himself to it for years) but I hope that
|
||||
someone in the near future will pick up the project.
|
||||
However this is really stable and I never had problems.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package helm
|
||||
:init
|
||||
(progn
|
||||
(require 'helm-config)
|
||||
(setq helm-autoresize-max-height 0)
|
||||
(setq helm-autoresize-min-height 20)
|
||||
(global-set-key (kbd "C-c h") 'helm-command-prefix)
|
||||
(global-unset-key (kbd "C-x c"))
|
||||
|
||||
(when (executable-find "ack")
|
||||
(setq helm-grep-default-command "ack -Hn --no-group --no-color %e %p %f"
|
||||
helm-grep-default-recurse-command "ack -H --no-group --no-color %e %p %f"))
|
||||
|
||||
(setq helm-semantic-fuzzy-match t
|
||||
helm-imenu-fuzzy-match t
|
||||
helm-M-x-fuzzy-match t ;; optional fuzzy matching for helm-M-x
|
||||
helm-buffers-fuzzy-matching t
|
||||
helm-recentf-fuzzy-match t
|
||||
helm-split-window-in-side-p t
|
||||
helm-buffer-max-length nil)
|
||||
|
||||
(helm-mode 1)
|
||||
(helm-autoresize-mode 1))
|
||||
|
||||
:bind
|
||||
(("C-c h" . helm-command-prefix)
|
||||
:map helm-command-map
|
||||
("b" . helm-buffers-list)
|
||||
("f" . helm-find-files)
|
||||
("m" . helm-mini)
|
||||
("o" . helm-imenu))
|
||||
:bind
|
||||
(("M-x" . helm-M-x)
|
||||
("M-y" . helm-show-kill-ring)
|
||||
("C-x b" . helm-mini)
|
||||
("C-x C-f" . helm-find-files)))
|
||||
#+end_src
|
||||
|
||||
** Programming
|
||||
*** FlyCheck
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flycheck
|
||||
:init (global-flycheck-mode))
|
||||
(use-package company
|
||||
:init (global-company-mode))
|
||||
(use-package company-quickhelp
|
||||
:straight t
|
||||
:config
|
||||
(company-quickhelp-mode))
|
||||
(use-package company-try-hard
|
||||
:straight t
|
||||
:bind
|
||||
(("C-<tab>" . company-try-hard)
|
||||
:map company-active-map
|
||||
("C-<tab>" . company-try-hard)))
|
||||
#+end_src
|
||||
|
||||
*** Git
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package magit)
|
||||
#+end_src
|
||||
|
||||
*** Solidity
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package solidity-flycheck
|
||||
:init (setq solidity-flycheck-solc-checker-active t)) ;requires solc in PATH
|
||||
#+end_src
|
||||
|
||||
*** Python
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elpy
|
||||
:init (elpy-enable)
|
||||
:config :config
|
||||
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
|
||||
)
|
||||
(use-package blacken)
|
||||
(use-package python-flycheck
|
||||
:init (setq elpy-modules (delq 'elpy-module-flymake elpy-modules)))
|
||||
(use-package company-jedi)
|
||||
#+end_src
|
||||
|
||||
*** LSP
|
||||
#+begin_src emacs-lisp
|
||||
(use-package lsp-mode
|
||||
:init
|
||||
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
|
||||
(setq lsp-keymap-prefix "C-c l")
|
||||
:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
|
||||
(XXX-mode . lsp)
|
||||
;; if you want which-key integration
|
||||
(lsp-mode . lsp-enable-which-key-integration))
|
||||
:commands lsp)
|
||||
|
||||
;; optionally
|
||||
(use-package lsp-ui :commands lsp-ui-mode)
|
||||
;; if you are helm user
|
||||
(use-package helm-lsp :commands helm-lsp-workspace-symbol)
|
||||
|
||||
;; optionally if you want to use debugger
|
||||
(use-package dap-mode)
|
||||
;; (use-package dap-LANGUAGE) to load the dap adapter for your language
|
||||
|
||||
;; optional if you want which-key integration
|
||||
(use-package which-key
|
||||
:config
|
||||
(which-key-mode))
|
||||
(add-hook 'haskell-mode-hook #'lsp)
|
||||
(add-hook 'haskell-literate-mode-hook #'lsp)
|
||||
#+end_src
|
||||
|
||||
*** Haskell
|
||||
#+begin_src emacs-lisp
|
||||
(use-package haskell-mode)
|
||||
(use-package lsp-haskell)
|
||||
(use-package dap-haskell)
|
||||
#+end_src
|
||||
|
||||
*** Nix
|
||||
#+begin_src emacs-lisp
|
||||
(use-package nix-mode
|
||||
:mode "\\.nix\\'")
|
||||
|
||||
;;(use-package company-nixos-options
|
||||
;; :after company
|
||||
;; :config
|
||||
;; (progn
|
||||
;; (add-to-list 'company-backends 'company-nixos-options)))
|
||||
|
||||
(use-package helm-nixos-options)
|
||||
#+end_src
|
||||
|
||||
** Mail
|
||||
*** Notmuch
|
||||
#+begin_src emacs-lisp
|
||||
(use-package notmuch)
|
||||
(use-package org-notmuch)
|
||||
#+end_src
|
||||
*** SMTP settings
|
||||
#+begin_src emacs-lisp
|
||||
(setq smtpmail-smtp-server "smtp.autistici.org"
|
||||
smtpmail-smtp-service 587
|
||||
smtpmail-local-domain "")
|
||||
#+end_src
|
||||
This is a Nix flake to build my Emacs
|
||||
|
|
Reference in a new issue