Commit Diff


commit - /dev/null
commit + cd826e3ef14a4abb25fadc210e74f21e59d516d7
blob - /dev/null
blob + d32c7387bd2c7d8b3ffb1b17ffbbf8a188ef743a (mode 644)
--- /dev/null
+++ config.org
@@ -0,0 +1,499 @@
+#+TITLE: My New Emacs Config
+#+AUTHOR: Benjamin Stürz
+#+OPTIONS: toc:2
+
+* Initialization
+** Variables
+#+begin_src emacs-lisp
+  (set-face-attribute 'default nil :height 70)
+  (add-to-list 'bdf-directory-list (expand-file-name "~/.local/share/fonts"))
+  ;(add-to-list 'bdf-directory-list "a")
+
+  ;;(defalias 'yes-or-no-p 'y-or-no-p)
+#+end_src
+
+** Package Management
+#+begin_src emacs-lisp
+  (require 'package)
+  (setq package-archives '(("melpa" . "https://melpa.org/packages/")
+                           ("org"   . "https://orgmode.org/elpa/")
+                           ("elpa"  . "https://elpa.gnu.org/packages/")))
+
+  (package-initialize)
+  (unless package-archive-contents
+    (package-refresh-contents))
+
+  ;; Initialize use-package
+  (unless (package-installed-p 'use-package)
+    (package-install 'use-package))
+
+  (require 'use-package)
+  (setq use-package-always-ensure t)
+  ;;(setq use-package-verbose t)
+
+  (use-package no-littering)
+  (setq auto-save-file-name-transforms `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
+  (setq backup-directory-alist `(("." . ,(no-littering-expand-var-file-name "auto-save/"))))
+#+end_src
+
+** Modes
+#+begin_src emacs-lisp
+  (scroll-bar-mode -1)			;; Disable visible scroll bar
+  (tool-bar-mode -1)			;; Disable the toolbar
+  (tooltip-mode -1)				;; Disable tooltips
+  (menu-bar-mode -1)			;; Disable the menubar
+  (set-fringe-mode 10)			;; Give some breathing room
+  (column-number-mode)			;; 
+  (global-display-line-numbers-mode t)	;; Display line numbers
+  (recentf-mode 1)				;; Save recently opened files mode
+  ;;(recentf-load-list)			;; Load recently opened files
+  (setq history-length 100)			;;
+  (savehist-mode 1)				;; Save history
+  (save-place-mode 1)			;; Save place in file
+  (setq global-auto-revert-non-file-buffers t)
+  (global-auto-revert-mode 1)		;;
+#+end_src
+  
+** UI Configuration
+#+begin_src emacs-lisp
+  (setq ring-bell-function 'ignore	;; Disable the bell
+        inhibit-startup-message t	;; Don't display the startup screen
+        scroll-step 1		;; Make scrolling smoother
+        scroll-conservatively 10000	;; Remove the jumpiness
+        use-dialog-box nil		;; Don't show the dialog box
+        custom-file (locate-user-emacs-file "custom.el"))
+
+  (load custom-file 'noerror 'nomessage)
+
+  ;; Make the frame fullscreen
+  (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
+  (add-to-list 'default-frame-alist '(fullscreen . maximized))
+
+  ;; Disable line numbers for some modes
+  (dolist (mode '(term-mode-hook
+                  shell-mode-hook
+                  treemacs-mode-hook
+                  eshell-mode-hook
+                  vterm-mode-hook))
+    (add-hook mode (lambda () (display-line-numbers-mode 0))))
+#+end_src
+
+* Packages
+** Appearence
+#+begin_src emacs-lisp
+  (use-package doom-themes
+    :init
+    (load-theme 'doom-palenight t))
+
+  (use-package rainbow-delimiters
+    :hook (prog-mode . rainbow-delimiters-mode))
+
+;;  (use-package all-the-icons
+;;    :if (display-graphic-p)
+;;    :commands all-the-icons-install-fonts
+;;    :init
+;;    (unless (find-font (font-spec :name "all-the-icons"))
+;;      (all-the-icons-install-fonts t)))
+
+;;  (use-package moody
+;;    :config
+;;    (setq x-underline-at-descent-line	t
+;;          mood-mode-line-height		10)
+;;    (moody-replace-mode-line-buffer-identification)
+;;    (moody-replace-vc-mode)
+;;    (moody-replace-eldoc-minibuffer-message-function))
+
+  ;;(use-package doom-modeline
+  ;;  :init
+  ;;  (doom-modeline-mode 1)
+  ;;  :custom
+  ;;  (doom-modeline-height 10))
+#+end_src
+
+** Dashboard
+#+begin_src emacs-lisp
+  (use-package page-break-lines)
+  (use-package dashboard
+    :after page-break-lines
+    :config
+    (setq initial-buffer-choice		(lambda () (get-buffer-create "*dashboard*"))
+          dashboard-banner-logo-title	"Emacs Dashboard"
+          dashboard-startup-banner		'logo
+          dashboard-center-content		t
+          dashboard-set-heading-icons	t
+          dashboard-set-file-icons		t
+          dashboard-set-navigator		t
+          dashboard-items			'((recents . 5) (bookmarks . 5) (projects . 5) (agenda . 5) (registers . 5)))
+    (dashboard-setup-startup-hook))
+#+end_src
+
+** Undo
+#+begin_src emacs-lisp
+  (if (version< emacs-version "28.1")
+      (progn
+	(use-package undo-fu)
+	(setq benni/redo 'undo-fu))
+    (setq benni/redo 'undo-redo))
+#+end_src
+** Evil
+#+begin_src emacs-lisp
+  (use-package evil
+    :init
+    (setq evil-want-integration	t
+          evil-want-keybinding	nil
+          evil-want-C-u-scroll	t
+          evil-want-C-i-jump	nil
+          evil-want-fine-undo	t
+          evil-undo-system		benni/redo)
+
+    :config
+    (evil-mode 1)
+    (define-key evil-insert-state-map (kbd "C-g")	'evil-normal-state)
+    (define-key evil-insert-state-map (kbd "C-h")	'evil-delete-backward-char-and-join)
+    (define-key evil-normal-state-map (kbd "C-.")	'evil-switch-to-windows-last-buffer)
+    (global-set-key (kbd "C-.")			'evil-switch-to-windows-last-buffer)
+
+    ;; Use visual line motions even outside of visual-line-mode buffers.
+    (evil-global-set-key 'motion "j" 'evil-next-visual-line)
+    (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
+
+    (evil-set-initial-state 'messages-buffer-mode 'normal)
+    (evil-set-initial-state 'dashboard-mode 'normal))
+
+  (use-package evil-collection
+    :after evil
+    :config
+    (evil-collection-init))
+#+end_src
+
+** Ivy
+#+begin_src emacs-lisp
+  (use-package ivy
+    :diminish
+    :bind (("C-s" . swiper)
+           :map ivy-minibuffer-map
+           ("TAB"	. ivy-alt-done))
+    :config
+    (ivy-mode 1))
+
+  (use-package ivy-rich
+    :after ivy
+    :init
+    (ivy-rich-mode 1))
+
+  (use-package ivy-prescient
+    :after (ivy counsel prescient)
+    :config
+    (setq ivy-prescient-retain-classic-highlighting t)
+    (ivy-prescient-mode 1))
+#+end_src
+
+** Consel
+#+begin_src emacs-lisp
+  (use-package counsel
+    :defer nil
+    :bind (("M-x"		. counsel-M-x)
+           ("C-x b"		. counsel-ibuffer)
+           ("C-x C-f"	. counsel-find-file)
+           :map minibuffer-local-map
+           ("C-r"		. 'counsel-minibuffer-history))
+    :config
+    (setq ivy-initial-inputs-alist nil))
+
+  (use-package counsel-projectile
+    :after (counsel projectile)
+    :config (counsel-projectile-mode))
+#+end_src
+
+** Company
+#+begin_src emacs-lisp
+  (use-package company
+    :after lsp-mode
+    :hook (lsp-mode . company-mode)
+    :bind
+    (:map lsp-mode-map		("<tab>" . company-indent-or-complete-common))
+    (:map company-active-map	("<tab>" . company-complete-selection))
+    :custom
+    (company-minimum-prefix-length 1)
+    (company-idle-delay 0.5))
+
+  (use-package company-box
+    :hook (company-mode . company-box-mode))
+
+  (use-package company-prescient
+    :after (company prescient)
+    :config
+    (company-prescient-mode 1))
+#+end_src
+
+** Flycheck
+#+begin_src emacs-lisp
+  (use-package flycheck
+    :after lsp-mode)
+#+end_src
+
+** Prescient
+#+begin_src emacs-lisp
+  (use-package prescient
+    :config
+    (setq prescient-sort-length-enable	t
+          prescient-filter-method		'(literal regexp initialism))
+    (prescient-persist-mode 1))
+#+end_src
+
+** which-key
+#+begin_src emacs-lisp
+  (use-package which-key
+    :diminish which-key-mode
+    :config
+    (which-key-mode)
+    (setq which-key-idle-delay 0.5))
+#+end_src
+
+** helpful
+#+begin_src emacs-lisp
+  (use-package helpful
+    :after (counsel)
+    :commands (helpful-callable helpful-variable helpful-command helpful-key)
+    :custom
+    (counsel-describe-function-function #'helpful-callable)
+    (counsel-describe-variable-function #'helpful-variable)
+    :bind
+    ([remap describe-function]	. counsel-describe-function)
+    ([remap describe-variable]	. counsel-describe-variable)
+    ([remap describe-command]	. helpful-command)
+    ([remap describe-key]	. helpful-key))
+#+end_src
+
+** vterm
+#+begin_src emacs-lisp
+  (use-package vterm
+    :commands vterm
+    :config
+    (setq vterm-max-scrollback 10000))
+#+end_src
+
+** General
+#+begin_src emacs-lisp
+  (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
+
+  (use-package general
+    :config
+    (general-create-definer
+     benni/leader-keys
+     :keymaps '(normal insert visual emacs)
+     :prefix "SPC"
+     :global-prefix "C-SPC"))
+
+  (use-package hydra
+    :defer t)
+
+  (benni/leader-keys
+   "."	'(counsel-find-file :which-key "open file")
+   "V"	'(vterm-other-window :which-key "vterm-other-window")
+   "b"	'(:ignore t :which-key "buffer")
+   "bK"	'(kill-buffer :which-key "kill buffer")
+   "bb"	'(counsel-switch-buffer :which-key "switch buffer")
+   "bk"	'(kill-current-buffer :which-key "kill current buffer")
+   "c"	'(counsel-compile :which-key "compile")
+   "g"	'(magit-status :which-key "magit")
+   "m"	'(mu4e :which-key "mu4e")
+   "r"	'(counsel-recentf :which-key "recent files")
+   "t"	'(:ignore t :which-key "toggles")
+   "tm"	'(treemacs :which-key "treemacs")
+   "ts"	'(hydra-text-scale/body :which-key "scale text")
+   "tt"	'(counsel-load-theme :which-key "choose theme")
+   "v"	'(vterm :which-key "vterm"))
+
+  (defhydra hydra-text-scale
+    (:timeout 5)
+    "scale text"
+    ("+" text-scale-increase "in")
+    ("-" text-scale-decrease "out"))
+#+end_src
+
+** Magit
+#+begin_src emacs-lisp
+  (use-package magit
+    :defer t
+    :commands (magit-status)
+    :config
+    (setq magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1))
+#+end_src
+
+** Treemacs
+#+begin_src emacs-lisp
+  (use-package treemacs
+    :defer t
+    :commands (treemacs)
+    :bind (:map treemacs-mode-map
+		("J" . treemacs-select-directory))
+    :config
+    (setq treemacs-width 25))
+
+  (use-package treemacs-evil
+    :after (treemacs evil))
+
+  (use-package treemacs-projectile
+    :after (treemacs projectile))
+
+  (use-package treemacs-magit
+    :after (treemacs magit))
+#+end_src
+
+** Projectile
+#+begin_src emacs-lisp
+  (use-package projectile
+    :diminish projectile-mode
+    :config (projectile-mode)
+    :custom ((projectile-completion-system 'ivy))
+    :bind-keymap ("C-c p" . projectile-command-map)
+    :init
+    (when (file-directory-p "~/src")
+      (setq projectile-project-searchpath '("~/src")))
+    (setq projectile-switch-project-action #'projectile-dired))
+#+end_src
+
+* Org
+** Setup
+#+begin_src emacs-lisp
+  (defun benni/org-mode-setup ()
+    (org-indent-mode)
+    (variable-pitch-mode 0)
+    (auto-fill-mode 0)
+    (visual-line-mode 1)
+    (setq evil-auto-indent nil))
+#+end_src
+** org
+#+begin_src emacs-lisp
+  (use-package org
+    :defer t
+    :pin org
+    :hook (org-mode . benni/org-mode-setup)
+    :config
+    (setq org-ellipsis			" ▾"
+          org-hide-emphasis-markers		t
+          org-done				'time
+          org-agenda-start-with-log-mode	t
+          org-log-into-drawer		t
+          org-confirm-babel-evaluate	nil))
+
+#+end_src
+** org-tempo
+#+begin_src emacs-lisp
+  (use-package org-tempo
+    :ensure nil
+    :after org
+    :config
+    (setq org-structure-template-alist '(("c"	. "src c")
+                                         ("bash"	. "src bash")
+                                         ("sh"	. "src shell")
+                                         ("el"	. "src emacs-lisp")
+                                         ("a"	. "export ascii")
+                                         ("C"	. "comment")
+                                         ("e"	. "example")
+                                         ("E"	. "export")
+                                         ("h"	. "export html")
+                                         ("l"	. "export latex")
+                                         ("q"	. "quote")
+                                         ("s"	. "src")
+                                         ("v"	. "verse"))))
+#+end_src
+
+** org-bullets
+#+begin_src emacs-lisp
+  (use-package org-bullets
+    :after org
+    :hook (org-mode . org-bullets-mode)
+    :custom
+    (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
+#+end_src
+
+* Development
+** lsp-mode
+#+begin_src emacs-lisp
+  (use-package lsp-mode
+    :commands (lsp lsp-deferred)
+    :init
+    (setq lsp-keymap-prefix "C-c l")
+    :config
+    (lsp-enable-which-key-integration t))
+
+  (use-package lsp-ui
+    :hook (lsp-mode . lsp-ui-mode)
+    :custom
+    (lsp-ui-doc-position 'bottom))
+
+  (use-package lsp-treemacs
+    :after (lsp treemacs))
+
+  (use-package lsp-ivy
+    :after (lsp ivy))
+
+  (add-hook 'c-mode-hook 'lsp)
+  (add-hook 'c++-mode-hook 'lsp)
+#+end_src
+** Indentation Style
+#+begin_src emacs-lisp
+  (add-hook 'c-mode-hook
+            (lambda ()
+              (setq c-default-style "linux"
+                    indent-tabs-mode t)))
+  (add-hook 'c-mode-hook 'c-guess)
+#+end_src
+** Editorconfig
+#+begin_src emacs-lisp
+  (use-package editorconfig
+    :defer 1
+    :config
+    (editorconfig-mode 1))
+#+end_src
+** CompilerExplorer
+#+begin_src emacs-lisp
+;;  (use-package compiler-explorer
+;;    :commands (compiler-explorer))
+#+end_src
+** Rust
+#+begin_src emacs-lisp
+  (add-to-list 'exec-path "~/.cargo/bin")
+
+  (use-package rust-mode
+    :mode "\\.rs\\'")
+
+  (use-package rustic
+    :after rust-mode
+    :bind (:map rustic-mode-map
+                ("C-c r"	. rustic-cargo-run)
+                ("C-c b"	. rustic-cargo-build)
+                ("C-c t"	. rustic-cargo-test)))
+
+  (use-package cargo
+    :after rust-mode
+    :init
+    (add-hook 'rust-mode-hook 'cargo-minor-mode)
+    (add-hook 'toml-mode-hook 'cargo-minor-mode))
+#+end_src
+
+* Mail
+#+begin_src emacs-lisp
+  (use-package mu4e
+    :defer 10
+    :ensure nil
+    :commands (mu4e)
+    ;; :load-path "/usr/local/share/emacs/site-lisp/mu4e/"
+    :config
+    (setq mu4e-change-filenames-when-moving	t
+          mu4e-update-interval		(* 10 60)
+          mu4e-get-mail-command		"mbsync -a"
+          mu4e-maildir			"~/Mail/benni@stuerz.xyz"
+          mu4e-drafts-folder			"/Drafts"
+          mu4e-sent-folder			"/Sent"
+          mu4e-trash-folder			"/Trash"
+          mu4e-maildir-shortcuts
+          '(("/Inbox"				. ?i)
+            ("/Sent"				. ?s)
+            ("/Trash"				. ?t)
+            ("/Drafts"			. ?d)
+            ("/openbsd"			. ?O)))
+    (mu4e t))
+#+end_src
blob - /dev/null
blob + 8cef401a2669b2a8c773dfe6ddb9ec4ce1a8b352 (mode 644)
--- /dev/null
+++ init.el
@@ -0,0 +1,9 @@
+(setq gc-cons-threshold most-positive-fixnum)
+(add-hook 'emacs-startup-hook
+	  (lambda ()
+	    (setq gc-cons-threshold (expt 2 23))))
+
+(org-babel-load-file
+  (expand-file-name
+    "config.org"
+    user-emacs-directory))