emacs/init.org

126 lines
4.1 KiB
Org Mode
Raw Normal View History

#+title: Setup Crafted Emacs User Configuration File
#+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes :tangle-mode "ugo=r"
* Basic configuration
** Set import directories for =crafted-emacs=
#+begin_src emacs-lisp
;;; init.el -- Fschl Crafted Emacs user customization file -*- lexical-binding: t; -*-
;; This file is generated from the .org-file with the same name. If you want to edit the
;; configuration, DO NOT edit this .el-file, edit .org, instead.
2024-04-08 10:30:34 +02:00
(setq user-emacs-directory "~/.config/emacs/")
2024-02-23 18:55:38 +01:00
(setq crafted-emacs-home (expand-file-name "crafted-emacs/" user-emacs-directory))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (and custom-file
(file-exists-p custom-file))
(load custom-file nil :nomessage))
(load (expand-file-name "modules/crafted-init-config" crafted-emacs-home))
#+end_src
** Add selected =crafted-emacs= packages
#+begin_src emacs-lisp
(require 'crafted-completion-packages)
(require 'crafted-evil-packages)
(require 'crafted-org-packages)
(require 'crafted-ui-packages)
(require 'crafted-ide-packages)
(require 'crafted-writing-packages)
#+end_src
** Add more packages
#+begin_src emacs-lisp
2024-04-17 08:41:12 +02:00
(add-to-list 'package-selected-packages 'vterm)
(add-to-list 'package-selected-packages 'all-the-icons-dired)
(add-to-list 'package-selected-packages 'ranger)
(add-to-list 'package-selected-packages 'dired-ranger)
2024-04-17 08:41:12 +02:00
(package-install-selected-packages :noconfirm)
#+end_src
** Load selected =crafted-emacs= packages
#+begin_src emacs-lisp
(require 'crafted-defaults-config)
(require 'crafted-startup-config)
(require 'crafted-completion-config)
(require 'crafted-evil-config)
(require 'crafted-org-config)
(require 'crafted-ui-config)
(require 'crafted-ide-config)
(require 'crafted-writing-config)
2024-04-17 08:41:12 +02:00
(require 'vterm)
(unless crafted-startup-inhibit-splash
(setq initial-buffer-choice #'crafted-startup-screen))
#+end_src
** Identify the system
Some of my personal configuration depends on the system we're running on.
- [ ] add windows
#+begin_src emacs-lisp
2024-04-29 14:29:41 +02:00
(defvar dw/is-termux
(string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))
(defvar dw/is-guix-system (and (eq system-type 'gnu/linux)
(file-exists-p "/etc/os-release")
(with-temp-buffer
(insert-file-contents "/etc/os-release")
(search-forward "ID=guix" nil t))
t))
#+end_src
** Custom key remap
2024-04-29 14:29:41 +02:00
#+begin_src emacs-lisp
(keymap-global-unset "M-#")
2024-04-29 14:29:41 +02:00
(define-key global-map (kbd "M-#") 'comment-line)
(define-key global-map (kbd "s-b") 'switch-to-buffer)
(define-key global-map (kbd "s-w") 'kill-current-buffer)
(define-key global-map (kbd "s-W") 'kill-buffer-and-window)
(define-key global-map (kbd "s-o") 'other-window)
(define-key global-map (kbd "C-z") nil)
#+end_src
** Dired
#+begin_src emacs-lisp
(use-package all-the-icons-dired)
(use-package dired-ranger)
(defun dw/dired-mode-hook ()
(interactive)
(dired-hide-details-mode 0)
(unless (or dw/is-termux
(string-equal "/gnu/store/" (expand-file-name default-directory)))
(all-the-icons-dired-mode 1))
(hl-line-mode 1))
(use-package dired
:ensure nil
:bind (:map dired-mode-map
("b" . dired-up-directory)
("H" . dired-hide-details-mode))
:config
(setq dired-listing-switches "-agho --group-directories-first"
dired-omit-files "^\\.[^.].*"
dired-omit-verbose nil
dired-dwim-target 'dired-dwim-target-next
dired-hide-details-hide-symlink-targets nil
dired-kill-when-opening-new-dired-buffer t
delete-by-moving-to-trash t)
(add-hook 'dired-mode-hook #'dw/dired-mode-hook)
(global-set-key (kbd "s-j") #'dired-jump))
#+end_src
** Load my custom files
#+begin_src emacs-lisp
(load (expand-file-name "modules/fschl-ide.el" user-emacs-directory))
(load (expand-file-name "modules/fschl-org.el" user-emacs-directory))
#+end_src