First commit

This commit is contained in:
Arthur Barraux
2024-10-18 18:52:51 +02:00
commit 70693b9eeb
+185
View File
@@ -0,0 +1,185 @@
#TITLE: My Emacs Configuration
#+AUTHOR: Arthur Barraux
#+OPTIONS: num:nil
* Init
** Package management
#+begin_src emacs-lisp
(require 'use-package)
(setq use-package-always-ensure t)
(setq package-archives
'(("GNU ELPA" . "https://elpa.gnu.org/packages/")
("MELPA Stable" . "https://stable.melpa.org/packages/")
("MELPA" . "https://melpa.org/packages/"))
package-archive-priorities
'(("GNU ELPA" . 10)
("MELPA" . 5)
("MELPA Stable" . 0)))
#+end_src
** Theme
#+BEGIN_SRC emacs-lisp
(load-theme 'zenburn t)
#+END_SRC
** Encoding
#+begin_src emacs-lisp
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8)
#+end_src
* Completion
#+BEGIN_SRC emacs-lisp
(use-package vertico)
(use-package consult)
(use-package marginalia)
#+END_SRC
** Company
#+BEGIN_SRC emacs-lisp
(use-package company)
(company-mode 1)
#+END_SRC
* Key-binds
** Dereference arrow
#+BEGIN_SRC emacs-lisp
(defun print-arrow ()
(interactive)
(with-current-buffer (buffer-name);
(insert "->")))
(keymap-global-set "ù" 'print-arrow)
#+END_SRC
** Reload config
#+BEGIN_SRC emacs-lisp
(defun reload-conf ()
(interactive)
(load-file "~/.emacs.default/init.el"))
(keymap-global-set "C-c r" 'reload-conf)
#+END_SRC
** Open config
#+begin_src emacs-lisp
(defun open-config ()
(interactive)
(find-file "~/.emacs.default/config.org"))
(keymap-global-set "C-c c" 'open-config)
#+end_src
** Window command
*** Split verticaly
#+begin_src emacs-lisp
(keymap-global-set "C-x é" 'split-window-below)
#+end_src
*** Split horizontally
#+begin_src emacs-lisp
(keymap-global-set "C-x \"" 'split-window-right)
#+end_src
*** Close window
#+begin_src emacs-lisp
(keymap-global-set "C-x à" 'delete-window)
#+end_src
* Org
** Org bullets
#+begin_src emacs-lisp
(use-package org-bullets
:config
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
#+end_src
** Font
#+begin_src emacs-lisp
(font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))))
(custom-theme-set-faces
'user
'(variable-pitch ((t (:family "ETBembo" :height 220 :weight thin))))
'(fixed-pitch ((t ( :family "Fira Code Retina" :height 200)))))
(let* ((variable-tuple
(cond ((x-list-fonts "ETBembo") '(:font "ETBembo"))
((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
((x-list-fonts "Lucida Grande") '(:font "Lucida Grande"))
((x-list-fonts "Verdana") '(:font "Verdana"))
((x-family-fonts "Sans Serif") '(:family "Sans Serif"))
(nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro."))))
(base-font-color (face-foreground 'default nil 'default))
(headline `(:inherit default :weight bold :foreground ,base-font-color)))
;; Headlines
(custom-theme-set-faces
'user
`(org-level-8 ((t (,@headline ,@variable-tuple))))
`(org-level-7 ((t (,@headline ,@variable-tuple))))
`(org-level-6 ((t (,@headline ,@variable-tuple))))
`(org-level-5 ((t (,@headline ,@variable-tuple))))
`(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1))))
`(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25))))
`(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5))))
`(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75))))
`(org-document-title ((t (,@headline ,@variable-tuple :height 2.0 :underline nil))))))
#+end_src
** Emphasis markers
#+begin_src emacs-lisp
(setq org-hide-emphasis-markers t)
#+end_src
** Hooks
*** Variable pitch mode
#+begin_src emacs-lisp
(add-hook 'org-mode-hook 'variable-pitch-mode)
#+end_src
*** Visual line mode
#+begin_src emacs-lisp
(add-hook 'org-mode-hook 'visual-line-mode)
#+end_src
** Custom faces
#+begin_src emacs-lisp
(custom-theme-set-faces
'user
'(org-block ((t (:inherit fixed-pitch))))
'(org-code ((t (:inherit (shadow fixed-pitch)))))
'(org-document-info ((t (:foreground "dark orange"))))
'(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
'(org-indent ((t (:inherit (org-hide fixed-pitch)))))
'(org-link ((t (:foreground "royal blue" :underline t))))
'(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-property-value ((t (:inherit fixed-pitch))) t)
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-table ((t (:inherit fixed-pitch :foreground "#83a598"))))
'(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8))))
'(org-verbatim ((t (:inherit (shadow fixed-pitch))))))
#+end_src
* Misceleaneous
** Tool bar
#+BEGIN_SRC emacs-lisp
(tool-bar-mode -1)
#+END_SRC
** Menu bar
#+BEGIN_SRC emacs-lisp
(menu-bar-mode -1)
#+END_SRC
** Scroll bar
#+BEGIN_SRC emacs-lisp
(scroll-bar-mode -1)
#+END_SRC
** Global font
#+begin_src emacs-lisp
(set-face-attribute 'default nil :family "Cascadia Mono" :height 200)
#+end_src