Formatierung, Which-Key und Helm-Descbinds

This commit is contained in:
2020-12-27 13:52:15 +01:00
parent d1be362230
commit 6cea656501

View File

@@ -31,7 +31,7 @@
*** Vollbildschirm *** Vollbildschirm
Das Fenster wird im Vollbild geöffnet. Das Fenster wird im Vollbild geöffnet.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq initial-frame-alist '((fullscreen . maximized))) (setq initial-frame-alist '((fullscreen . maximized)))
#+END_SRC #+END_SRC
** Server ** Server
@@ -45,17 +45,17 @@
Die Backup- und Autosave-Dateien stören eher, da ich sie noch nie gebraucht habe, sollen sie erst gar nicht angelegt werden. 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]] [[https://github.com/emacscollective/no-littering][Help keeping ~/.emacs.d clean]]
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package no-littering (use-package no-littering
:config (with-eval-after-load 'recentf :config (with-eval-after-load 'recentf
(add-to-list 'recentf-exclude no-littering-var-directory) (add-to-list 'recentf-exclude no-littering-var-directory)
(add-to-list 'recentf-exclude no-littering-etc-directory)) (add-to-list 'recentf-exclude no-littering-etc-directory))
(setq auto-save-file-name-transforms ; autosaved-file-name~ (setq auto-save-file-name-transforms ; autosaved-file-name~
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t)) `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))
custom-file (no-littering-expand-etc-file-name "custom.el")) custom-file (no-littering-expand-etc-file-name "custom.el"))
(if (file-exists-p custom-file) (if (file-exists-p custom-file)
(load-file custom-file))) (load-file custom-file)))
#+END_SRC #+END_SRC
* Konfigurationsdatei * Konfigurationsdatei
@@ -106,74 +106,74 @@
** Font ** Font
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; for unicode ;; for unicode
(when (display-graphic-p) (when (display-graphic-p)
(set-fontset-font "fontset-default" nil (set-fontset-font "fontset-default" nil
(font-spec :size 20 :name "Symbola"))) (font-spec :size 20 :name "Symbola")))
;; for emoji ;; for emoji
(set-fontset-font (set-fontset-font
t t
'(#x1f300 . #x1fad0) '(#x1f300 . #x1fad0)
(cond (cond
((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji") ((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
((member "Noto Emoji" (font-family-list)) "Noto Emoji") ((member "Noto Emoji" (font-family-list)) "Noto Emoji")
((member "Segoe UI Emoji" (font-family-list)) "Segoe UI Emoji") ((member "Segoe UI Emoji" (font-family-list)) "Segoe UI Emoji")
((member "Symbola" (font-family-list)) "Symbola") ((member "Symbola" (font-family-list)) "Symbola")
((member "Apple Color Emoji" (font-family-list)) "Apple Color Emoji"))) ((member "Apple Color Emoji" (font-family-list)) "Apple Color Emoji")))
;; font to use ;; font to use
(defconst artr/default-font-family "Source Code Pro") (defconst artr/default-font-family "Source Code Pro")
(defconst artr/default-font-size 100) (defconst artr/default-font-size 100)
(defconst artr/default-icon-size 15) (defconst artr/default-icon-size 15)
(set-face-attribute 'default nil (set-face-attribute 'default nil
:family artr/default-font-family :family artr/default-font-family
:height artr/default-font-size) :height artr/default-font-size)
#+END_SRC #+END_SRC
** Schriftgröße anpassen ** Schriftgröße anpassen
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun artr/adjust-font-size (height) (defun artr/adjust-font-size (height)
"Adjust font size by given height. If height is '0', reset font "Adjust font size by given height. If height is '0', reset font
size. This function also handles icons and modeline font sizes." size. This function also handles icons and modeline font sizes."
(interactive "nHeight ('0' to reset): ") (interactive "nHeight ('0' to reset): ")
(let ((new-height (if (zerop height) (let ((new-height (if (zerop height)
artr/default-font-size artr/default-font-size
(+ height (face-attribute 'default :height))))) (+ height (face-attribute 'default :height)))))
(set-face-attribute 'default nil :height new-height) (set-face-attribute 'default nil :height new-height)
(set-face-attribute 'mode-line nil :height new-height) (set-face-attribute 'mode-line nil :height new-height)
(set-face-attribute 'mode-line-inactive nil :height new-height) (set-face-attribute 'mode-line-inactive nil :height new-height)
(message "Font size: %s" new-height)) (message "Font size: %s" new-height))
(let ((new-size (if (zerop height) (let ((new-size (if (zerop height)
artr/default-icon-size artr/default-icon-size
(+ (/ height 5) treemacs--icon-size)))) (+ (/ height 5) treemacs--icon-size))))
(when (fboundp 'treemacs-resize-icons) (when (fboundp 'treemacs-resize-icons)
(treemacs-resize-icons new-size)) (treemacs-resize-icons new-size))
(when (fboundp 'company-box-icons-resize) (when (fboundp 'company-box-icons-resize)
(company-box-icons-resize new-size)))) (company-box-icons-resize new-size))))
#+END_SRC #+END_SRC
** Schrift vergrößern ** Schrift vergrößern
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun artr/increase-font-size () (defun artr/increase-font-size ()
"Increase font size by 0.5 (5 in height)." "Increase font size by 0.5 (5 in height)."
(interactive) (interactive)
(artr/adjust-font-size 5)) (artr/adjust-font-size 5))
#+END_SRC #+END_SRC
** Schrift verkleinern ** Schrift verkleinern
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun artr/decrease-font-size () (defun artr/decrease-font-size ()
"Decrease font size by 0.5 (5 in height)." "Decrease font size by 0.5 (5 in height)."
(interactive) (interactive)
(artr/adjust-font-size -5)) (artr/adjust-font-size -5))
#+END_SRC #+END_SRC
** Schriftgröße zurücksetzen ** Schriftgröße zurücksetzen
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun artr/reset-font-size () (defun artr/reset-font-size ()
"Reset font size according to the `artr/default-font-size'." "Reset font size according to the `artr/default-font-size'."
(interactive) (interactive)
(artr/adjust-font-size 0)) (artr/adjust-font-size 0))
#+END_SRC #+END_SRC
@@ -194,8 +194,8 @@ size. This function also handles icons and modeline font sizes."
* Magit * Magit
Magit ist ein git-Client für Emacs: [[https://magit.vc/manual/magit/#Top][Magit User Manual]] Magit ist ein git-Client für Emacs: [[https://magit.vc/manual/magit/#Top][Magit User Manual]]
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package magit (use-package magit
:bind ("C-x g" . magit-status)) :bind ("C-x g" . magit-status))
#+END_SRC #+END_SRC
* Fenster * Fenster
@@ -208,21 +208,21 @@ size. This function also handles icons and modeline font sizes."
| C-3 | Neues Fenster daneben | | C-3 | Neues Fenster daneben |
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun artr/split-window-below-and-switch () (defun artr/split-window-below-and-switch ()
"Split the window below, then switch to the new window." "Split the window below, then switch to the new window."
(interactive) (interactive)
(split-window-below) (split-window-below)
(other-window 1)) (other-window 1))
(defun artr/split-window-right-and-switch () (defun artr/split-window-right-and-switch ()
"Split the window right, then switch to the new window." "Split the window right, then switch to the new window."
(interactive) (interactive)
(split-window-right) (split-window-right)
(other-window 1)) (other-window 1))
(global-set-key (kbd "C-1") 'delete-other-windows) (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-2") 'artr/split-window-below-and-switch)
(global-set-key (kbd "C-3") 'artr/split-window-right-and-switch) (global-set-key (kbd "C-3") 'artr/split-window-right-and-switch)
#+END_SRC #+END_SRC
** wechseln ** wechseln
@@ -236,11 +236,11 @@ size. This function also handles icons and modeline font sizes."
| M-O | ace-swap-windows | | M-O | ace-swap-windows |
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package ace-window (use-package ace-window
:init (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) :init (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
aw-scope 'frame) aw-scope 'frame)
:bind (("M-o" . ace-window) :bind (("M-o" . ace-window)
("M-O" . ace-swap-window))) ("M-O" . ace-swap-window)))
#+END_SRC #+END_SRC
** anordnen ** anordnen
@@ -250,8 +250,8 @@ size. This function also handles icons and modeline font sizes."
| C-c <right> | nächste Fensterkonfiguration | | C-c <right> | nächste Fensterkonfiguration |
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package winner (use-package winner
:config (winner-mode)) :config (winner-mode))
#+END_SRC #+END_SRC
[[https://depp.brause.cc/eyebrowse/][eyebrowse]] [[https://depp.brause.cc/eyebrowse/][eyebrowse]]
@@ -265,38 +265,38 @@ size. This function also handles icons and modeline font sizes."
| C-c w , | Fensterkonfiguration benennen | | C-c w , | Fensterkonfiguration benennen |
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package eyebrowse (use-package eyebrowse
:bind (("C-c w ." . eyebrowse-switch-to-window-config) :bind (("C-c w ." . eyebrowse-switch-to-window-config)
("C-c w ," . eyebrowse-rename-window-config) ("C-c w ," . eyebrowse-rename-window-config)
("C-c w DEL" . eyebrowse-close-window-config) ("C-c w DEL" . eyebrowse-close-window-config)
("C-c w k" . eyebrowse-close-window-config) ("C-c w k" . eyebrowse-close-window-config)
("C-c w n" . eyebrowse-create-window-config)) ("C-c w n" . eyebrowse-create-window-config))
:init (setq eyebrowse-keymap-prefix (kbd "C-c w") :init (setq eyebrowse-keymap-prefix (kbd "C-c w")
eyebrowse-wrap-around t eyebrowse-wrap-around t
eyebrowse-mode-line-style 'always eyebrowse-mode-line-style 'always
eyebrowse-mode-line-separator "|") eyebrowse-mode-line-separator "|")
(eyebrowse-mode t)) (eyebrowse-mode t))
#+END_SRC #+END_SRC
** bezeichnen ** bezeichnen
Die Fenster werden mit "Projektname | Dateiname" bezeichnet. Die Fenster werden mit "Projektname | Dateiname" bezeichnet.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq-default frame-title-format (setq-default frame-title-format
'((:eval '((:eval
(let ((project-name (projectile-project-name))) (let ((project-name (projectile-project-name)))
(unless (string= "-" project-name) (unless (string= "-" project-name)
(format "%s| " project-name)))) (format "%s| " project-name))))
"%b")) ; project-name| file-name "%b")) ; project-name| file-name
#+END_SRC #+END_SRC
* Help * Help
[[https://github.com/Wilfred/helpful][Helpful]] - Eine Context-Hilfe mit mehr Informationen [[https://github.com/Wilfred/helpful][Helpful]] - Eine Context-Hilfe mit mehr Informationen
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package helpful (use-package helpful
:bind (([remap describe-function] . helpful-callable) :bind (([remap describe-function] . helpful-callable)
([remap describe-variable] . helpful-variable) ([remap describe-variable] . helpful-variable)
([remap describe-key] . helpful-key) ([remap describe-key] . helpful-key)
:map emacs-lisp-mode-map :map emacs-lisp-mode-map
("C-c C-d" . helpful-at-point))) ("C-c C-d" . helpful-at-point)))
#+END_SRC #+END_SRC
* Modeline * Modeline
@@ -304,21 +304,21 @@ size. This function also handles icons and modeline font sizes."
[[https://github.com/tarsius/minions][A minor-mode menu for the mode line]] - minions [[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 [[https://github.com/emacsorphanage/anzu][anzu.el]] - displays match information in the mode-line in various search modes
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package doom-modeline (use-package doom-modeline
:custom (doom-modeline-icon t) :custom (doom-modeline-icon t)
(doom-modeline-minor-modes t) (doom-modeline-minor-modes t)
(doom-modeline-unicode-fallback t) (doom-modeline-unicode-fallback t)
(doom-modeline-mu4e nil) (doom-modeline-mu4e nil)
(doom-modeline-buffer-encoding nil) (doom-modeline-buffer-encoding nil)
:init :init
:hook (after-init . doom-modeline-mode)) :hook (after-init . doom-modeline-mode))
(use-package minions (use-package minions
:hook (doom-modeline-mode . minions-mode)) :hook (doom-modeline-mode . minions-mode))
(use-package anzu (use-package anzu
:after isearch :after isearch
:config (global-anzu-mode)) :config (global-anzu-mode))
#+END_SRC #+END_SRC
* Helm * Helm
@@ -347,143 +347,178 @@ size. This function also handles icons and modeline font sizes."
(use-package helm (use-package helm
:demand :demand
:bind ("M-x" . helm-M-x) :bind ("M-x" . helm-M-x)
("C-h a" . helm-apropos) ("C-h a" . helm-apropos)
("C-c h" . helm-mini) ("C-c h" . helm-mini)
("C-x C-f" . helm-find-files) ("C-x C-f" . helm-find-files)
("C-x f" . helm-recentf) ("C-x f" . helm-recentf)
("C-x b" . helm-buffers-list) ("C-x b" . helm-buffers-list)
("C-x c b" . helm-filtered-bookmarks) ("C-x c b" . helm-filtered-bookmarks)
("C-x c o" . helm-occur) ("C-x c o" . helm-occur)
("C-x c s" . helm-swoop) ("C-x c s" . helm-swoop)
("C-x c SPC" . helm-all-mark-rings) ("C-x c SPC" . helm-all-mark-rings)
("M-y" . helm-show-kill-ring) ("M-y" . helm-show-kill-ring)
:preface (require 'helm-config) :preface (require 'helm-config)
:config (helm-mode 1)) :config (helm-mode 1))
(use-package helm-icons (use-package helm-icons
:after helm :after helm
:config :config
(treemacs-resize-icons artr/default-icon-size) (treemacs-resize-icons artr/default-icon-size)
(helm-icons-enable)) (helm-icons-enable))
(use-package helm-swoop (use-package helm-swoop
:after helm :after helm
:chords :chords
("js" . helm-swoop) ("js" . helm-swoop)
("jp" . helm-swoop-back-to-last-point) ("jp" . helm-swoop-back-to-last-point)
:init :init
(bind-key "M-m" 'helm-swoop-from-isearch isearch-mode-map)) (bind-key "M-m" 'helm-swoop-from-isearch isearch-mode-map))
(use-package helm-descbinds
:init
(setq helm-descbinds-window-style 'split-window)
:bind ("C-h b" . helm-descbinds))
#+END_SRC #+END_SRC
* Dateien und Buffer * Dateien und Buffer
** Dired ** Dired
[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired, the Directory Editor]] [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired, the Directory Editor]]
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package dired (use-package dired
:ensure nil :ensure nil
:config :config
;; Always delete and copy recursively ;; Always delete and copy recursively
(setq dired-recursive-deletes 'always (setq dired-recursive-deletes 'always
dired-recursive-copies 'always) dired-recursive-copies 'always)
(when (executable-find "ls") (when (executable-find "ls")
;; Using `insert-directory-program' ;; Using `insert-directory-program'
(setq ls-lisp-use-insert-directory-program t) (setq ls-lisp-use-insert-directory-program t)
;; Show directory first ;; Show directory first
(setq dired-listing-switches "-alh --group-directories-first"))) (setq dired-listing-switches "-alh --group-directories-first")))
;; Show git info in dired ;; Show git info in dired
(use-package dired-git-info (use-package dired-git-info
:bind (:map dired-mode-map :bind (:map dired-mode-map
(")" . dired-git-info-mode))) (")" . dired-git-info-mode)))
;; Allow rsync from dired buffers ;; Allow rsync from dired buffers
(use-package dired-rsync (use-package dired-rsync
:bind (:map dired-mode-map :bind (:map dired-mode-map
("C-c C-r" . dired-rsync))) ("C-c C-r" . dired-rsync)))
;;Icons ;;Icons
(use-package all-the-icons-dired (use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode)) :hook (dired-mode . all-the-icons-dired-mode))
#+END_SRC #+END_SRC
** Treemacs ** Treemacs
[[https://github.com/Alexander-Miller/treemacs][Treemacs - a tree layout file explorer for Emacs]] [[https://github.com/Alexander-Miller/treemacs][Treemacs - a tree layout file explorer for Emacs]]
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package treemacs (use-package treemacs
:diminish :diminish
:commands (treemacs-follow-mode :commands (treemacs-follow-mode
treemacs-filewatch-mode treemacs-filewatch-mode
treemacs-fringe-indicator-mode treemacs-fringe-indicator-mode
treemacs-git-mode treemacs-git-mode
treemacs) treemacs)
:bind (([f8] . treemacs) :bind (([f8] . treemacs)
("M-0" . treemacs-select-window) ("M-0" . treemacs-select-window)
("C-x 1" . treemacs-delete-other-windows) ("C-x 1" . treemacs-delete-other-windows)
("C-x t 1" . treemacs-delete-other-windows) ("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs) ("C-x t t" . treemacs)
("C-x t b" . treemacs-bookmark) ("C-x t b" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file) ("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag))) ("C-x t M-t" . treemacs-find-tag)))
#+END_SRC #+END_SRC
* Text * Text
** Textbreite ** Textbreite
Der Text wird nach 90 Zeichen umgebrochen. Jedoch nur in der Ansicht!
[[https://github.com/luisgerhorst/virtual-auto-fill][virtual-auto-fill]] - display unfilled text in a readable way
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq-default fill-column 90) (setq-default fill-column 90)
(setq column-number-mode t) (setq column-number-mode t)
(use-package virtual-auto-fill
:hook (text-mode . virtual-auto-fill-mode))
#+END_SRC #+END_SRC
* Snippets
Mit Yasnippet lassen sich Templates definieren und mit einer Tastenkombination belegen.
Die Templates werden im Ordner /snippets/ jeweils unter einem Mode-spezifischen Ordner gespeichert.
Das Paket /yasnippet-snippets/ stellt eine Auswahl an Templates zur Verfügung. Mit /helm-c-yasnippet/ lassen sich die Snippets mit Helm durchsuchen und filtern. ** Whitespace
#+BEGIN_SRC emacs-lisp
(use-package whitespace
:hook (before-save . whitespace-cleanup))
(setq-default sentence-end-double-space nil)
#+END_SRC
| Key | Aktion | ** Tabulators
|-----------+------------------------| #+BEGIN_SRC emacs-lisp
| C-c & C-n | neues Template anlegen | (setq-default
| C-c & C-s | Template einfügen | indent-tabs-mode nil ; Use spaces instead of tabs
| C-c & C-v | Template öffnen | tab-width 4)
|-----------+------------------------| #+END_SRC
| C-c y | Templates auswählen |
#+BEGIN_SRC emacs-lisp ** Copy/Paste
(use-package yasnippet #+BEGIN_SRC emacs-lisp
:diminish yas-minor-mode (delete-selection-mode)
:hook (after-init . yas-global-mode)) #+END_SRC
(use-package yasnippet-snippets ** Klammern
:after yasnippet) #+BEGIN_SRC emacs-lisp
(electric-pair-mode)
(show-paren-mode 1)
(use-package rainbow-delimiters
:hook
(prog-mode . rainbow-delimiters-mode))
#+END_SRC
(use-package helm-c-yasnippet
:bind (("C-c y" . helm-yas-complete)))
#+END_SRC
* Completion * Completion
#+BEGIN_SRC emacs-lisp ** Company
(use-package company #+BEGIN_SRC emacs-lisp
:bind ("M-/" . company-complete) (use-package company
:hook (after-init . global-company-mode) :bind ("M-/" . company-complete)
:init (setq company-idle-delay 0)) :hook (after-init . global-company-mode)
:init (setq company-idle-delay 0))
(use-package helm-company
:after company helm
:bind (:map company-mode-map
("C-:" . helm-company)
:map company-active-map
("C-:" . helm-company)))
#+END_SRC
** Snippets
Mit Yasnippet lassen sich Templates definieren und mit einer Tastenkombination belegen.
Die Templates werden im Ordner /snippets/ jeweils unter einem Mode-spezifischen Ordner gespeichert.
Das Paket /yasnippet-snippets/ stellt eine Auswahl an Templates zur Verfügung. Mit /helm-c-yasnippet/ lassen sich die Snippets mit Helm durchsuchen und filtern.
| Key | Aktion |
|-----------+------------------------|
| C-c & C-n | neues Template anlegen |
| C-c & C-s | Template einfügen |
| C-c & C-v | Template öffnen |
|-----------+------------------------|
| C-c y | Templates auswählen |
#+BEGIN_SRC emacs-lisp
(use-package yasnippet
:diminish yas-minor-mode
:hook (after-init . yas-global-mode))
(use-package yasnippet-snippets
:after yasnippet)
(use-package helm-c-yasnippet
:bind (("C-c y" . helm-yas-complete)))
#+END_SRC
(use-package helm-company
:after company helm
:bind (:map company-mode-map
("C-:" . helm-company)
:map company-active-map
("C-:" . helm-company)))
#+END_SRC
* Projectile * Projectile
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package projectile (use-package projectile
:config :config
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map) (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode 1) (projectile-mode 1)
:init :init
(setq projectile-completion-system 'helm)) (setq projectile-completion-system 'helm))
#+END_SRC #+END_SRC
* Whitespace
#+BEGIN_SRC emacs-lisp * Which-Key
(use-package whitespace #+BEGIN_SRC emacs-lisp
:hook (before-save . whitespace-cleanup)) (use-package which-key
:init
(which-key-mode))
#+END_SRC #+END_SRC