412 lines
15 KiB
Org Mode
412 lines
15 KiB
Org Mode
#+TODO: | DISABLED(d)
|
|
#+STARTUP: overview
|
|
#+TITLE: Meine Emacs-Konfiguration
|
|
|
|
* Benutzerangaben
|
|
Name und Emailadresse
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq user-full-name "Ariane Troche")
|
|
(setq user-mail-address "ariane@familie-troche.de")
|
|
#+END_SRC
|
|
|
|
* Start
|
|
** Startfenster
|
|
Einige Einstellungen, die den Startbildschirm betreffen:
|
|
*** Splash Screen
|
|
Der übliche Emacs-Startbildschirm soll nicht angezeigt werden. Damit öffnet sich direkt der scratch-Buffer, welcher komplett leer sein soll.
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq inhibit-splash-screen t)
|
|
(setq initial-scratch-message nil)
|
|
#+END_SRC
|
|
|
|
*** Scrollbar, Toolbar, Menubar
|
|
Scrollbar, Toolbar und Menubar werden ausgeblendet.
|
|
#+BEGIN_SRC emacs-lisp
|
|
(scroll-bar-mode -1)
|
|
(tool-bar-mode -1)
|
|
(menu-bar-mode -1)
|
|
#+END_SRC
|
|
|
|
*** Vollbildschirm
|
|
Das Fenster wird im Vollbild geöffnet.
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq initial-frame-alist '((fullscreen . maximized)))
|
|
#+END_SRC
|
|
|
|
** Server
|
|
Damit beim Start von Emacs nicht immer ein neuer Prozess gestartet wird, wird Emacs hier schon als Server aufgesetzt.
|
|
[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html][Using Emacs as a Server]]
|
|
#+BEGIN_SRC emacs-lisp
|
|
(server-start)
|
|
#+END_SRC
|
|
|
|
** Backup und Autosave
|
|
Die Backup- und Autosave-Dateien stören eher, da ich sie noch nie gebraucht habe, sollen sie erst gar nicht angelegt werden.
|
|
[[https://github.com/emacscollective/no-littering][Help keeping ~/.emacs.d clean]]
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package no-littering
|
|
:config (with-eval-after-load 'recentf
|
|
(add-to-list 'recentf-exclude no-littering-var-directory)
|
|
(add-to-list 'recentf-exclude no-littering-etc-directory))
|
|
|
|
(setq auto-save-file-name-transforms ; autosaved-file-name~
|
|
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t))
|
|
custom-file (no-littering-expand-etc-file-name "custom.el"))
|
|
|
|
(if (file-exists-p custom-file)
|
|
(load-file custom-file)))
|
|
#+END_SRC
|
|
|
|
* Konfigurationsdatei
|
|
** Konfigurationsdatei
|
|
Ich bastel sehr gerne an meiner Konfigurationsdatei herum. Mit <f1> kann ich sie ganz schnell öffnen und mit <f2> neu laden.
|
|
| Key | Funktion |
|
|
|-----+----------------------------------------------|
|
|
| F1 | Öffne Konfigurationsdatei in anderem Fenster |
|
|
| F2 | Konfiguration neu laden, ohne Emacs-Neustart |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
;; Pfade
|
|
(setq artr/file-init (expand-file-name "init.el" user-emacs-directory))
|
|
(setq artr/file-config (expand-file-name "config.org" user-emacs-directory))
|
|
;; Öffnen
|
|
(defun artr/find-config-file ()
|
|
"Edit my init file in another window."
|
|
(interactive)
|
|
(find-file artr/file-config))
|
|
;; Laden
|
|
(defun artr/reload-emacs-configuration ()
|
|
"Reload init.el"
|
|
(interactive)
|
|
(load-file artr/file-init))
|
|
;; Keys
|
|
(global-set-key (kbd "<f1>") 'artr/find-config-file)
|
|
(global-set-key (kbd "<f2>") 'artr/reload-emacs-configuration)
|
|
#+END_SRC
|
|
|
|
** Neustart
|
|
Mit <F12> kann ich Emacs neu starten.
|
|
| Key | Funktion |
|
|
|-----+----------------|
|
|
| F12 | Emacs-Neustart |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package restart-emacs
|
|
:ensure t
|
|
:bind ("<f12>" . 'restart-emacs))
|
|
#+END_SRC
|
|
|
|
* Font
|
|
| Key | Funktion |
|
|
|-----+---------------------------------------|
|
|
| C-- | Schriftgröße schrittweise verkleinern |
|
|
| C-* | Schriftgröße schrittweise vergrößern |
|
|
| C-0 | Schriftgröße auf Default zurücksetzen |
|
|
|
|
** Font
|
|
#+BEGIN_SRC emacs-lisp
|
|
;; for unicode
|
|
(when (display-graphic-p)
|
|
(set-fontset-font "fontset-default" nil
|
|
(font-spec :size 20 :name "Symbola")))
|
|
;; for emoji
|
|
(set-fontset-font
|
|
t
|
|
'(#x1f300 . #x1fad0)
|
|
(cond
|
|
((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
|
|
((member "Noto Emoji" (font-family-list)) "Noto Emoji")
|
|
((member "Segoe UI Emoji" (font-family-list)) "Segoe UI Emoji")
|
|
((member "Symbola" (font-family-list)) "Symbola")
|
|
((member "Apple Color Emoji" (font-family-list)) "Apple Color Emoji")))
|
|
|
|
;; font to use
|
|
(defconst artr/default-font-family "Source Code Pro")
|
|
(defconst artr/default-font-size 100)
|
|
(defconst artr/default-icon-size 15)
|
|
|
|
(set-face-attribute 'default nil
|
|
:family artr/default-font-family
|
|
:height artr/default-font-size)
|
|
#+END_SRC
|
|
|
|
** Schriftgröße anpassen
|
|
#+BEGIN_SRC emacs-lisp
|
|
(defun artr/adjust-font-size (height)
|
|
"Adjust font size by given height. If height is '0', reset font
|
|
size. This function also handles icons and modeline font sizes."
|
|
(interactive "nHeight ('0' to reset): ")
|
|
(let ((new-height (if (zerop height)
|
|
artr/default-font-size
|
|
(+ height (face-attribute 'default :height)))))
|
|
(set-face-attribute 'default nil :height new-height)
|
|
(set-face-attribute 'mode-line nil :height new-height)
|
|
(set-face-attribute 'mode-line-inactive nil :height new-height)
|
|
(message "Font size: %s" new-height)))
|
|
#+END_SRC
|
|
|
|
** Schrift vergrößern
|
|
#+BEGIN_SRC emacs-lisp
|
|
(defun artr/increase-font-size ()
|
|
"Increase font size by 0.5 (5 in height)."
|
|
(interactive)
|
|
(artr/adjust-font-size 5))
|
|
#+END_SRC
|
|
|
|
** Schrift verkleinern
|
|
#+BEGIN_SRC emacs-lisp
|
|
(defun artr/decrease-font-size ()
|
|
"Decrease font size by 0.5 (5 in height)."
|
|
(interactive)
|
|
(artr/adjust-font-size -5))
|
|
#+END_SRC
|
|
|
|
** Schriftgröße zurücksetzen
|
|
#+BEGIN_SRC emacs-lisp
|
|
(defun artr/reset-font-size ()
|
|
"Reset font size according to the `artr/default-font-size'."
|
|
(interactive)
|
|
(artr/adjust-font-size 0))
|
|
#+END_SRC
|
|
|
|
** Keybindings
|
|
#+BEGIN_SRC emacs-lisp
|
|
(global-set-key (kbd "C--") 'artr/decrease-font-size)
|
|
(global-set-key (kbd "C-*") 'artr/increase-font-size)
|
|
(global-set-key (kbd "C-0") 'artr/reset-font-size)
|
|
#+END_SRC
|
|
|
|
* Icons
|
|
** Icons
|
|
[[https://github.com/domtronn/all-the-icons.el][domtronn /all-the-icons.el]]
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package all-the-icons)
|
|
#+END_SRC
|
|
|
|
* Magit
|
|
Magit ist ein git-Client für Emacs: [[https://magit.vc/manual/magit/#Top][Magit User Manual]]
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package magit
|
|
:bind ("C-x g" . magit-status))
|
|
#+END_SRC
|
|
|
|
* Fenster
|
|
** teilen
|
|
Funktionen/Tastenkombination um neue Fenster zu erzeugen. Wenn ein neues Fenster erzeugt wird auch direkt dahin wechseln.
|
|
| Key | Funktion |
|
|
|-----+--------------------------------|
|
|
| C-1 | Alle anderen Fenster schließen |
|
|
| C-2 | Neues Fenster unterhalb |
|
|
| C-3 | Neues Fenster daneben |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(defun artr/split-window-below-and-switch ()
|
|
"Split the window below, then switch to the new window."
|
|
(interactive)
|
|
(split-window-below)
|
|
(other-window 1))
|
|
|
|
(defun artr/split-window-right-and-switch ()
|
|
"Split the window right, then switch to the new window."
|
|
(interactive)
|
|
(split-window-right)
|
|
(other-window 1))
|
|
|
|
(global-set-key (kbd "C-1") 'delete-other-windows)
|
|
(global-set-key (kbd "C-2") 'artr/split-window-below-and-switch)
|
|
(global-set-key (kbd "C-3") 'artr/split-window-right-and-switch)
|
|
#+END_SRC
|
|
|
|
** wechseln
|
|
[[https://github.com/abo-abo/ace-window][ace-window]]
|
|
Bei mehr als 2 Fenstern in der Konfiguration werden die Fenster "durchnummeriert". So können Aktionen gezielt durchgeführt werden.
|
|
Die möglichen Aktionen werden mit ? aufgelistet.
|
|
Bei 2 Fenstern wird das Fenster einfach gewechselt.
|
|
| Key | Funktion |
|
|
|-----+-----------------------------------------|
|
|
| M-o | ace-windows (? zeigt mögliche Aktionen) |
|
|
| M-O | ace-swap-windows |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package ace-window
|
|
:init (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
|
aw-scope 'frame)
|
|
:bind (("M-o" . ace-window)
|
|
("M-O" . ace-swap-window)))
|
|
#+END_SRC
|
|
|
|
** anordnen
|
|
| Key | Funktion |
|
|
|-------------+--------------------------------|
|
|
| C-c <left> | vorherige Fensterkonfiguration |
|
|
| C-c <right> | nächste Fensterkonfiguration |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package winner
|
|
:config (winner-mode))
|
|
#+END_SRC
|
|
|
|
[[https://depp.brause.cc/eyebrowse/][eyebrowse]]
|
|
Es können Fensterkonfigurationen angelegt und wiederhergestellt werden. Das Speichern der Konfigurationen passiert in sogenannten Slots, die von 0,... durchnummeriert werden.
|
|
Mit C-c w 0 kann dann direkt die zugehörige Konfiguration wiederhergestellt werden.
|
|
| Key | Funktion |
|
|
|---------+-------------------------------|
|
|
| C-c w | key-map |
|
|
| C-c w n | neue Fensterkonfiguration |
|
|
| C-c w . | Fensterkonfiguration wechseln |
|
|
| C-c w , | Fensterkonfiguration benennen |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package eyebrowse
|
|
:bind (("C-c w ." . eyebrowse-switch-to-window-config)
|
|
("C-c w ," . eyebrowse-rename-window-config)
|
|
("C-c w DEL" . eyebrowse-close-window-config)
|
|
("C-c w k" . eyebrowse-close-window-config)
|
|
("C-c w n" . eyebrowse-create-window-config))
|
|
:init (setq eyebrowse-keymap-prefix (kbd "C-c w")
|
|
eyebrowse-wrap-around t
|
|
eyebrowse-mode-line-style 'always
|
|
eyebrowse-mode-line-separator "|")
|
|
(eyebrowse-mode t))
|
|
#+END_SRC
|
|
|
|
** bezeichnen
|
|
Die Fenster werden mit "Projektname | Dateiname" bezeichnet.
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq-default frame-title-format
|
|
'((:eval
|
|
(let ((project-name (projectile-project-name)))
|
|
(unless (string= "-" project-name)
|
|
(format "%s| " project-name))))
|
|
"%b")) ; project-name| file-name
|
|
#+END_SRC
|
|
* Help
|
|
[[https://github.com/Wilfred/helpful][Helpful]] - Eine Context-Hilfe mit mehr Informationen
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package helpful
|
|
:bind (([remap describe-function] . helpful-callable)
|
|
([remap describe-variable] . helpful-variable)
|
|
([remap describe-key] . helpful-key)
|
|
:map emacs-lisp-mode-map
|
|
("C-c C-d" . helpful-at-point)))
|
|
#+END_SRC
|
|
|
|
* Modeline
|
|
[[https://github.com/seagle0128/doom-modeline][doom-modeline]] - A fancy and fast mode-line inspired by minimalism design.
|
|
[[https://github.com/tarsius/minions][A minor-mode menu for the mode line]] - minions
|
|
[[https://github.com/emacsorphanage/anzu][anzu.el]] - displays match information in the mode-line in various search modes
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package doom-modeline
|
|
:custom (doom-modeline-icon t)
|
|
(doom-modeline-minor-modes t)
|
|
(doom-modeline-unicode-fallback t)
|
|
(doom-modeline-mu4e nil)
|
|
(doom-modeline-buffer-encoding nil)
|
|
:init
|
|
:hook (after-init . doom-modeline-mode))
|
|
|
|
(use-package minions
|
|
:hook (doom-modeline-mode . minions-mode))
|
|
|
|
(use-package anzu
|
|
:after isearch
|
|
:config (global-anzu-mode))
|
|
#+END_SRC
|
|
|
|
* Helm
|
|
[[https://tuhdo.github.io/helm-intro.html][A Package in a league of its own: Helm]]
|
|
Helm ist eine Schnittstelle, mit der man in einer Auswahl von Kandidaten suchen und filtern kann.
|
|
Diese Schnittstelle kann in verschiedensten Anwendungen eingesetzt werden, wie z.B. Dateien, Buffer, Funktionen, Variablen und noch vieles mehr.
|
|
Es gibt viele Erweiterungen für Helm.
|
|
|
|
| Key | Aktion |
|
|
|-----------+--------------------------------------------------|
|
|
| M-x | Funktionsaufruf |
|
|
| C-c h | helm-mini mit Buffer, Recent-Files und Bookmarks |
|
|
|-----------+--------------------------------------------------|
|
|
| C-h a | Tastenkombinationen |
|
|
| C-x C-f | Datei |
|
|
| C-x b | Buffer |
|
|
| C-x f | Recent-Files |
|
|
| C-x c b | Bookmarks |
|
|
| C-x c SPC | Mark-Rings |
|
|
| M-y | Kill-Ring |
|
|
|-----------+--------------------------------------------------|
|
|
| C-x c o | Suche in Datei mit Occur |
|
|
| C-x c s | Suche in Datei mit Swoop |
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package helm
|
|
:demand
|
|
:bind ("M-x" . helm-M-x)
|
|
("C-h a" . helm-apropos)
|
|
("C-c h" . helm-mini)
|
|
("C-x C-f" . helm-find-files)
|
|
("C-x f" . helm-recentf)
|
|
("C-x b" . helm-buffers-list)
|
|
("C-x c b" . helm-filtered-bookmarks)
|
|
("C-x c o" . helm-occur)
|
|
("C-x c s" . helm-swoop)
|
|
("C-x c SPC" . helm-all-mark-rings)
|
|
("M-y" . helm-show-kill-ring)
|
|
:preface (require 'helm-config)
|
|
:config (helm-mode 1))
|
|
#+END_SRC
|
|
|
|
* Dateien und Buffer
|
|
** Dired
|
|
[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired, the Directory Editor]]
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package dired
|
|
:ensure nil
|
|
:config
|
|
;; Always delete and copy recursively
|
|
(setq dired-recursive-deletes 'always
|
|
dired-recursive-copies 'always)
|
|
(when (executable-find "ls")
|
|
;; Using `insert-directory-program'
|
|
(setq ls-lisp-use-insert-directory-program t)
|
|
;; Show directory first
|
|
(setq dired-listing-switches "-alh --group-directories-first")))
|
|
;; Show git info in dired
|
|
(use-package dired-git-info
|
|
:bind (:map dired-mode-map
|
|
(")" . dired-git-info-mode)))
|
|
;; Allow rsync from dired buffers
|
|
(use-package dired-rsync
|
|
:bind (:map dired-mode-map
|
|
("C-c C-r" . dired-rsync)))
|
|
;;Icons
|
|
(use-package all-the-icons-dired
|
|
:hook (dired-mode . all-the-icons-dired-mode))
|
|
#+END_SRC
|
|
|
|
** Treemacs
|
|
[[https://github.com/Alexander-Miller/treemacs][Treemacs - a tree layout file explorer for Emacs]]
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package treemacs
|
|
:diminish
|
|
:commands (treemacs-follow-mode
|
|
treemacs-filewatch-mode
|
|
treemacs-fringe-indicator-mode
|
|
treemacs-git-mode
|
|
treemacs)
|
|
:bind (([f8] . treemacs)
|
|
("M-0" . treemacs-select-window)
|
|
("C-x 1" . treemacs-delete-other-windows)
|
|
("C-x t 1" . treemacs-delete-other-windows)
|
|
("C-x t t" . treemacs)
|
|
("C-x t b" . treemacs-bookmark)
|
|
("C-x t C-t" . treemacs-find-file)
|
|
("C-x t M-t" . treemacs-find-tag)))
|
|
#+END_SRC
|
|
|
|
* Text
|
|
** Textbreite
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq-default fill-column 90)
|
|
(setq column-number-mode t)
|
|
(use-package virtual-auto-fill
|
|
:hook (text-mode . virtual-auto-fill-mode))
|
|
#+END_SRC
|