From f304d92cb56b3d7f95206e8f571a9f2841e95fc0 Mon Sep 17 00:00:00 2001 From: Jonas Hahn Date: Sun, 28 Sep 2025 22:28:43 +0200 Subject: [PATCH] Some working configuration --- .gitignore | 7 +++++++ init.el | 30 ++++++++++++++++++++++++++++++ lisp/init-org.el | 43 +++++++++++++++++++++++++++++++++++++++++++ lisp/keybinds.el | 20 ++++++++++++++++++++ lisp/navigation.el | 8 ++++++++ lisp/options.el | 13 +++++++++++++ lisp/utils.el | 10 ++++++++++ 7 files changed, 131 insertions(+) create mode 100644 .gitignore create mode 100644 lisp/init-org.el create mode 100644 lisp/keybinds.el create mode 100644 lisp/navigation.el create mode 100644 lisp/options.el create mode 100644 lisp/utils.el diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2efc487 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Directories in root +eln-cache/ +auto-save-list/ +elpa/ + +# Files in root +recentf diff --git a/init.el b/init.el index e69de29..87dbd59 100644 --- a/init.el +++ b/init.el @@ -0,0 +1,30 @@ +;;; -*- lexical-binding: t -*- + +;; Package manager +(require 'package) +(add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/")) +(package-initialize) +(unless package-archive-contents + (package-refresh-contents)) + +;; Load custom modules +(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) +(require 'options) +(require 'utils) +(require 'navigation) +(require 'init-org) +(require 'keybinds) +(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-enabled-themes '(leuven-dark)) + '(package-selected-packages '(evil org-modern org-superstar))) +(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. + ) diff --git a/lisp/init-org.el b/lisp/init-org.el new file mode 100644 index 0000000..6f13ed8 --- /dev/null +++ b/lisp/init-org.el @@ -0,0 +1,43 @@ +;; Load org mode + +(use-package org + :ensure t + :hook ((org-mode . visual-line-mode) ;; wrap lines nicely + (org-mode . org-indent-mode)) ;; clean indentation + :config + ;; Better heading bullets (requires org-modern or org-superstar) + (use-package org-superstar + :ensure t + :hook (org-mode . org-superstar-mode)) + + ;; Show inline images after evaluating a block + (setq org-startup-with-inline-images t) + (setq org-image-actual-width nil) ;; scale to window + + ;; Hide emphasis markers (*bold* → bold, no stars shown) + (setq org-hide-emphasis-markers t) + + ;; Start folded, except top-level headings + (setq org-startup-folded 'content) + + ;; Use syntax highlighting in code blocks + (setq org-src-fontify-natively t + org-src-tab-acts-natively t + org-edit-src-content-indentation 0) + + ;; Confirm before evaluating code blocks + (setq org-confirm-babel-evaluate t) + + ;; Enable a few languages in org-babel + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (python . t) + (shell . t))) + + ;; Pretty UTF-8 symbols (like → instead of =>) + (use-package org-modern + :ensure t + :hook (org-mode . org-modern-mode))) + +(provide 'init-org) diff --git a/lisp/keybinds.el b/lisp/keybinds.el new file mode 100644 index 0000000..e083120 --- /dev/null +++ b/lisp/keybinds.el @@ -0,0 +1,20 @@ +;; Variables +(defvar my-zettelkasten-dir "/webdav/notes" + "Path to zettelkasten directory.") + +;; Functions +(defun jonas/open-notes () + "Open zettelkasten directory in dired." + (interactive) + (dired my-zettelkasten-dir)) + +;; Helpers +(global-set-key (kbd "C-c z") #'jonas/open-notes) + +;; Org mode +(with-eval-after-load 'org + (define-key org-mode-map (kbd "C-c t") #'org-todo) + (define-key org-mode-map (kbd "C-c TAB") #'org-cycle) + (define-key org-mode-map (kbd "C-c l") #'org-insert-link)) + +(provide 'keybinds) diff --git a/lisp/navigation.el b/lisp/navigation.el new file mode 100644 index 0000000..7b41db7 --- /dev/null +++ b/lisp/navigation.el @@ -0,0 +1,8 @@ +;; Activate evil mode + +(unless (package-installed-p 'evil) + (package-install 'evil)) +(require 'evil) +(evil-mode 1) + +(provide 'navigation) diff --git a/lisp/options.el b/lisp/options.el new file mode 100644 index 0000000..b1afc4e --- /dev/null +++ b/lisp/options.el @@ -0,0 +1,13 @@ +;; Set all common options here + +(custom-set-variables + '(custom-enabled-themes '(leuven-dark)) + '(package-selected-packages nil)) + +(setq inhibit-startup-message t) +(scroll-bar-mode -1) + +;; Disable just the white menu bar +(menu-bar-mode -1) + +(provide 'options) diff --git a/lisp/utils.el b/lisp/utils.el new file mode 100644 index 0000000..5e8baa9 --- /dev/null +++ b/lisp/utils.el @@ -0,0 +1,10 @@ +;; Utility macros and tools + +;; Setup recent files +(require 'recentf) +(recentf-mode 1) +(setq recentf-max-menu-items 25) +(global-set-key "\C-x\ \C-r" 'recentf-open-files) +(custom-set-faces) + +(provide 'utils)