CBNDWUXF2JZSF32HNDRZ57AAJGA4IVXW3DUMEYVIIP2B7KPGTGGAC
(use-package keychain-environment ; Store ssh passphrase
:init
(keychain-refresh-environment))
(use-package pass) ; Manage passwords
;; (use-package tmdb
;; :straight (tmdb :type git :host github :repo "StoffePro/tmdb"))
;; ;; Manage music (with dired)
;; (use-package emms
;; :config
;; (require 'emms-setup)
;; ;; (emms-minimalistic)
;; (emms-all)
;; (emms-default-players)
;; (setq emms-source-file-default-directory "/data/music/")
;; ;; Disable irrating cover popup
;; (setq emms-player-mplayer-parameters '("-novideo")))
;; ;; IRC
;; (use-package auth-source-pass
;; :ensure t
;; :config
;; (auth-source-pass-enable))
;; (use-package erc
;; :straight nil
;; :commands (erc)
;; :init
;; (require 'erc-join)
;; (setq erc-autojoin-channels-alist '(("irc.libera.chat" "#haskell" ))
;; erc-hide-list '("JOIN" "PART" "QUIT")
;; )
;; (defun irc-connect ()
;; (interactive)
;; (erc
;; :server "irc.libera.chat" :port 6667
;; :nick (auth-source-pass-get "login" "irc/libera.chat")
;; :password (auth-source-pass-get 'secret "irc/libera.chat"))))
;; Cleanup
(setq inhibit-startup-message t)
(scroll-bar-mode -1) ; Disable visible scrollbar
(tool-bar-mode -1) ; Disable the toolbar
(tooltip-mode -1) ; Disable tooltips
(set-fringe-mode 10) ; Give some breathing room
(menu-bar-mode -1) ; Disable the menu bar
(load-theme 'modus-operandi) ; Light theme, built-in emacs 28
;; Doome-one theme
;; (use-package doom-themes
;; :ensure t
;; :config
;; (setq doom-one-brighter-comments t ; Our ideal config: readable comments
;; doom-one-comment-bg nil) ; without colored background !
;; (load-theme 'doom-one t))
;; Built-in equivalent of snippets
;; Skeletons for template and abbrev for shortcuts
;; Complete abbreviation with <C-x '>
(define-skeleton red-ops-skeleton
"Org TOODs for both red and ops"
""
"**** TODO Red\n**** TODO Ops")
(define-abbrev org-mode-abbrev-table "ros" "" 'red-ops-skeleton)
;; --------------- Package manager ---------------
;; Use straight.el as our package manager
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Emacs >= 27
(setq package-enable-at-startup nil)
;; Use straight by default
(setq straight-use-package-by-default t)
;; use-package to manage them (download them with ":straight t")
(straight-use-package 'use-package)
;;---------------------- Agenda
(require 'org-habit)
(remap-global "C-à" 'org-agenda)
(remap-global "C-ç" 'org-capture)
;; My agenda files
(setq org-agenda-files (list "~/projects/blog/todo.org"))
;; Common variables for org-agenda
;; Important : agenda view does not show notes with imcomplete parents in Doom
(setq org-agenda-dim-blocked-notes nil
org-agenda-start-day "today"
org-agenda-skip-deadline-if-done t
org-deadline-warning-days 0)
;; But it's easier to use org-super-agenda !
;;Warning : org-agenda-tag-filter-preset is set for all the view !! Cannot be used in blocks
(setq org-agenda-custom-commands
'(("d" "daily"
((agenda "" ((org-agenda-span 1))))
((org-agenda-filter-preset '("+daily"))))
("t" "today"
((agenda "" ((org-agenda-span 1)
(org-super-agenda-groups
'((:name "Studying"
;; :deadline today
:tag "revisions")
(:name "Daily"
:tag "daily")
(:name "Others"
:todo "WAIT"
:not (:tag ("revisions" "daily"))
)
)))))
)))
;; ----------- Org + latex
;; (use-package org-ref
;; :config
;; (setq org-ref-completion-library 'org-ref-ivy-cite
;; reftex-default-bibliography '("~/projects/sir/manuscript/references.bib")
;; org-ref-bibliography-notes '("~/projects/blog/notes/books.org")
;; org-ref-default-bibliography '("~/projects/sir/manuscript/references.bib")
;; org-ref-pdf-directory "~/projects/blog/notes/pdfs/")
;; ;; Customization : we want to insert the title of an entry in a reading list
;; (push '("justtitle" . ((nil . "${title}"))) org-ref-formatted-citation-formats)
;; ;; Helm bibtex configuration must be set
;; (setq bibtex-completion-library-path '("~/projects/blog/notes/pdfs")
;; bibtex-completion-bibliography '("~/projects/sir/manuscript/references.bib")
;; bibtex-completion-library-path "~/projects/blog/notes/pdfs"
;; bibtex-completion-notes-path "~/projects/blog/notes/books.org"
;; ;; Do not open on default
;; ivy-bibtex-default-action 'ivy-bibtex-insert-citation))
(setq org-latex-pdf-process '("latexmk -pdflatex='lualatex --shell-escape -interaction nonstopmode' -pdf -bibtex -f %f"))
;; Fast export: F5 is for users
(define-key org-mode-map (kbd "<f5>") #'(lambda() (interactive) (org-latex-export-to-pdf t)))
(setq revert-without-query '(".pdf")) ; Avoid confirmation with pdf
(require 'ox-beamer) ; Beamer presentations
;; Mimosis class for thesis
(add-to-list 'org-latex-classes
'("mimosis"
"\\documentclass{mimosis}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\chapter{%s}" . "\\addchap{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
;;------------------------------- Workout template
(setq org-capture-templates
'(
;; Workout
("h" "Handstand" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Handstand
StW %^{StW}
BtW %^{BtW}" )
("j" "Jump ro»pe" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Jump rope
%^{today}")
("l" "L-sit" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* L-sit
%^{GtG}" )
("p" "Parkour")
("pm" "Parkour (passe-muraille)" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Parkour
Passe-muraille :
- cat hang (each side) : %^{Cat hang shimmy}
- top out (each side) : %^{Top out}
- cat hang leg press (each side) : %^{Cat hang leg press}
- cat hang pull-up (each side) : %^{Cat hang pull-up}
- knee raises (each side) : %^{Knee raises}
- passe-muraille: %^{passe-muraille}")
("po" "Parkour (autre)" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Parkour
%^{Parkour}")
("s" "Splits" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Splits
Standing splits (2-5s + rest) : %^{Standing splits}
Wall calf : %^{Wall calf}
Low lunge : %^{Low lunge}
Frog pose (dynamic) : %^{Frog pose}
Horse stance : %^{Horse stance}
Standing pancake : %^{Standing pancake}
Front split : %^{Front split}")
("r" "Running")
("rs" "Sprint" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Running
:PROPERTIES:
:type: sprint
:END:
%^{reps}p
%^{sprint}p
%^{rest}p
")
("ro" "Other" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Running
%^{type}p
%^{distance}p
%^{duration}p
%^{speed}p
")
("t" "Tricks" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Tricks
Kip up : %^{kip-up}
Back flip : %^{backflip}
Front flip : %^{frontflip}
Front handspring : : %^{front handspring}")
("w" "Workout" entry (file+olp+datetree "~/projects/blog/notes/workout.org")
"* Workout
RTO : %^{RTO}
Skin-the-cat : %^{Skin the cat}
L-sit : %^{L-sit}
Muscle-up L-sit : %^{Muscle-up}
Pistols (assisted) : %^{Pistols}
Extension (lower-back) : %^{Extension}
Front-lever row (tuck) : %^{Rows}
Planche on rings (tuck): %^{Planche tucked}
Norwegian curls: %^{Curls}
Compression : %^{Compression}"
)
("c" "Cookbook" entry (file "~/projects/blog/notes/cooking.org") ;; Needs org-chef
"%(org-chef-get-recipe-from-url)")
("m" "Manual Cookbook" entry (file "~/projects/blog/notes/cooking.org")
"* %^{Recipe title: }\n :PROPERTIES:\n :source-url:\n :servings:\n :prep-time:\n :cook-time:\n :ready-in:\n :END:\n** Ingredients\n %?\n** Directions\n\n")
))
;; ------------------- Other
(add-to-list 'org-modules 'ol-gnus) ; Manage link to mail in gnus
(require 'ob-shell)
;; Everything relation to navigation (file, buffers, windows .. is here
;; With fish, there are some troubles to run commands...
;; For example with projectile-find-file...
(setq shell-file-name "/bin/sh")
; remember recent files every 30 minutes
(recentf-mode 1)
(run-at-time nil (* 30 60) 'recentf-save-list)
;; Show the end of a combination (useful for short memory....)
(use-package which-key
:init
(which-key-mode))
;; ------------------- Dired ---------------
;; No details by default, toggle back with (
;; No dotfiles either (activate back with C-x M-o
;; does not work
(use-package dired
:straight nil ; Needed to avoid installing it
:init
(setq dired-use-ls-dired nil ; For freebsd
dired-dwim-target t ; suggest a target for moving/copying intelligently
dired-listing-switches "-alh" ; Human readable size
)
:bind (:map dired-mode-map
(("ê" . dired-do-async-shell-command)
("è" . dired-up-directory)))
;; For wdired, use C-x C-q (builtin)
)
:root-dir
(use-package dired-x ; Dired-x is needed to omit
:straight nil ; Needed to avoid installing it
:config
(setq dired-omit-files
(concat dired-omit-files "\\|^\\..+$"))
:hook
((dired-mode . dired-hide-details-mode) ; No details
(dired-mode . dired-omit-mode) ; No details
))
;; Open movies and ebooks in dired
(use-package openwith
:config
(openwith-mode 1)
(add-hook 'dired-mode-hook 'openwith-mode 1)
(setq openwith-associations
(list
;; (list (openwith-make-extension-regexp '("pdf" "epub"))
(list (openwith-make-extension-regexp '("epub"))
"zathura" '(file))
(list (openwith-make-extension-regexp '("mkv"))
"mpv" '(file))
)))
;; -------------- other ------------------
;; Workspaces support: use tab-bar-mode instead (built in)
;; Manage pdfs
(use-package pdf-tools
:init
(pdf-loader-install)
(setq pdf-view-display-size 'fit-height)
:bind
(:map pdf-view-mode-map ("M-g g" . pdf-view-goto-page))
)
;; Nice modeline (support tab-mode too)
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1))
(remap-global "C-c e" 'eshell)
;; ------------------- Windows ---------------
;; Use windmove (built-in). Ace-windows is not *that* useful
;; S-left for going left andl so on
(windmove-default-keybindings)
;; With repeat mode (emacs 28), we can easily switch windows with C-x o then o o o...
(repeat-mode)
;;--------------------- Recentf -----------------
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(setq recentf-max-saved-items 25)
(run-at-time nil (* 10 60) 'recentf-save-list) ;; Every 10min
;; Manage mails with notmuch
;; Use default mapping (emacs)
(defun +notmuch/search-delete ()
(interactive)
(notmuch-search-add-tag (list "+deleted" "-inbox" "-unread"))
(notmuch-tree-next-message))
(use-package notmuch
:config
(setq-default notmuch-search-oldest-first nil) ;; setq does NOT work
(setq sendmail-program "/usr/local/bin/msmtp" ;; Freebsd
notmuch-fcc-dirs nil
notmuch-archive-tags '("-inbox" "-unread" "-new" "+archived")
notmuch-saved-searches '(
(:name "inbox" :query "tag:inbox " :key "i" :search-type 'tree)
(:name "sent" :query "tag:sent" :key "s" :search-type 'tree)
(:name "archived":query "tag:archived" :key "a" :search-type 'tree)
(:name "drafts" :query "tag:draft" :key "d" :search-type 'tree))
send-mail-function 'sendmail-send-it ; Activate mail sending
message-cite-reply-position 'above) ; mailing list reply style
(add-to-list 'mm-inhibit-file-name-handlers 'openwith-file-handler)
;; Jump to inbox
(remap-global "C-c m" '(lambda () (interactive) (notmuch-search "tag:inbox")))
(define-key notmuch-search-mode-map (kbd "d") '+notmuch/search-delete))
;; WARNING: This config is for a bepo keyboard
;; Native comp: disable warnings
(setq native-comp-async-report-warnings-errors nil)
(setq package-native-compile t)
;; Slightly faster booting time. The default is 800 kilobytes. Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
;; Default mappings are used, with minor adaptation to a bepo keyboard
;; See https://yiufung.net/post/emacs-key-binding-conventions-and-why-you-should-try-it/ for tips about emacs mapping
(load-file "~/.emacs.d/theme.el") ; Show theme as quickly as possible
(load-file "~/.emacs.d/packages.el") ; Package manager must be loaded first
(load-file "~/.emacs.d/emacs-bepo.el") ; Remap vanilla emacs
(load-file "~/.emacs.d/code.el")
(load-file "~/.emacs.d/mail.el")
(load-file "~/.emacs.d/navigation.el")
(load-file "~/.emacs.d/org.el")
(load-file "~/.emacs.d/skeletons.el")
(load-file "~/.emacs.d/utilities.el")
(put 'downcase-region 'disabled nil)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("d6da24347c813d1635a217d396cf1e3be26484fd4d05be153f3bd2b293d2a0b5" default)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; Remap some default emacs keybindings to adapt to bepo
;; We try to minimize the number of remappings: only 0,1...9 keys
;; No need for general.el if we only use vanilla emacs
(defun remap-global (s f)
(define-key global-map (kbd s) f))
;; Window : remap 0,1...9
(remap-global "C-x 0" nil)
(remap-global "C-x *" 'delete-window)
(remap-global "C-x 1" nil)
(remap-global "C-x \"" 'delete-other-windows)
(remap-global "C-x 2" nil)
(remap-global "C-x «" 'split-window-below)
(remap-global "C-x 3" nil)
(remap-global "C-x »" 'split-window-right)
;; Tab-bar: remap 0,1...
(remap-global "C-x t 0" nil)
(remap-global "C-x t *" 'tab-close)
(remap-global "C-x t 1" nil)
(remap-global "C-x t \"" 'tab-close-other)
(remap-global "C-x t 2" nil)
(remap-global "C-x t «" 'tab-new)
;; Navigation with bepo
(remap-global "M-«" 'backward-paragraph)
(remap-global "M-»" 'forward-paragraph)
;; ";" is harder to reach
(remap-global "M-;" nil)
(remap-global "M-ç" 'comment-dwim)
(remap-global "C-x C-ç" 'comment-line)
;; Swap : and , for evaluating lisp
(remap-global "M-:" 'xref-pop-marker-stack)
(remap-global "M-," 'eval-expression)
;; Not bepo specific
(remap-global "C-x x e" 'eval-buffer) ; Emacs 28
;; Avoid typing ^ twice by remapping it to è
(remap-global "M-è" 'delete-indentation) ; Same as join-line
;;------------ Languages -------------
;; 2 issues with project.el : straight.el use the local version
;; - Symbol’s value as variable is void: project-switch-commands (magit)
;; - Symbol’s value as variable is void: project-root (eglot)
;; So we have to install it by hand with `package-install` -> `project`
(use-package eglot
:config
(add-hook 'haskell-mode-hook 'eglot-ensure))
;;---------- Haskell
;; With egplot, we have haskell-server too
(use-package haskell-mode
:bind ("C-c l" . haskell-process-load-file))
;; Project management with project.el (builtin)
;; ------------------- Completion ---------------
;; Selectrum replaces ivy (uses Emacs API)
;; Minimalist alternative to selectrum, fully compatible with Emacs api
;; We could use icomplete (vertical mode built-in in emacs 28) but it's less fluid
(use-package vertico
:init
(vertico-mode)
)
;; Use orderless to improve filtering (faster that prescient it seems)
(use-package orderless
:init
(setq completion-styles '(orderless))
;; Persist history over Emacs restarts
(savehist-mode)
)
;; --- Show more details in the minibuffer
(use-package marginalia
:init
;; Enabled right away. Note that this forces loading the package.
(marginalia-mode))
;; Counsel alternative (Super uselful). Default mapping suggested from the authors
(use-package consult
:bind (;; C-c bindings (mode-specific-map)
("C-c h" . consult-history)
("C-c b" . consult-bookmark)
("C-c k" . consult-kmacro)
("C-c r" . consult-recent-file)
;; C-x bindings (ctl-x-map)
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
("<help> a" . consult-apropos) ;; orig. apropos-command
;; M-g bindings (goto-map)
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g o" . consult-outline)
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-project-imenu)
;; M-s bindings (search-map)
("M-s f" . consult-find)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s m" . consult-multi-occur)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch)
:map isearch-mode-map
("M-e" . consult-isearch) ;; orig. isearch-edit-string
("M-s e" . consult-isearch) ;; orig. isearch-edit-string
("M-s l" . consult-line)) ;; required by consult-line to detect isearch
;; Enable automatic preview at point in the *Completions* buffer.
:hook (completion-list-mode consult-preview-at-point-mode)
:config
;; Ripgrep-all (cannot jump to pdf page though)
(defcustom consult-ripgrep-all-command
"rga --null --line-buffered --color=ansi --max-columns=1000\
--no-heading --line-number . -e ARG OPTS"
"Command line string for ripgrep-all, see `consult-ripgrep-all'.
The command string must have a specific format, including ARG and OPTS
substrings. ARG is replaced by the filter string and OPTS by the auxillary
command options."
:type 'string)
(defun consult-ripgrep-all (&optional dir initial)
(interactive "P")
(consult--grep "Ripgrep-all" consult-ripgrep-all-command dir initial))
)
;; Lighter alternative to company, without backend to programming languages
;; With eglot, we should be fine
(use-package corfu
:init
(corfu-global-mode) ; Enable globally (recommended)
;; Optionally use TAB for cycling, default is `corfu-complete'.
:bind (:map corfu-map
("TAB" . corfu-next)
("S-TAB" . corfu-previous))
)
(use-package emacs
:init
;; TAB cycle if there are only few candidates
(setq completion-cycle-threshold 3)
;; Enable indentation+completion using the TAB
;; Won't work properly with TAB without this !
(setq tab-always-indent 'complete))
;; ------------- Others --------------
(use-package magit)
;; Do not use lispy, but built-in sexp
;; Do not use yasnippet but skeleton (builti)n
(use-package wgrep) ; Editable grep results <3
(show-paren-mode 1) ; Show matching parenthesis
;; Yank from mouse selection. By default, only available with mouse-2....
(defun my/yank-primary ()
"Yank from primary selection."
(interactive)
(push-mark)
(insert-for-yank (gui-get-primary-selection)))
(use-package fish-mode) ; Fish shell
My emacs configuration, from scratch, after trying Doom. The idea is use vanilla Emacs as much as possible, so that means:
- only a handful of packages
- avoid remapping default keybindings
This setup is adapted to the bepo keyboard layout.