aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d')
-rw-r--r--emacs/.emacs.d/config.org300
-rwxr-xr-xemacs/.emacs.d/init.el46
-rwxr-xr-xemacs/.emacs.d/myinit.org2
3 files changed, 302 insertions, 46 deletions
diff --git a/emacs/.emacs.d/config.org b/emacs/.emacs.d/config.org
new file mode 100644
index 0000000..544bda0
--- /dev/null
+++ b/emacs/.emacs.d/config.org
@@ -0,0 +1,300 @@
+* Emacs
+ :PROPERTIES:
+ :header-args: :tangle ~/.emacs.d/config.el
+ :END:
+
+** Essentials
+*** Debugging essentials
+#+BEGIN_SRC elisp
+(setq debug-on-error t)
+(setq debug-on-quit t)
+#+END_SRC
+*** Package setup
+#+BEGIN_SRC elisp
+(defconst emacs-start-time (current-time))
+
+(setq straight-repository-branch "develop"
+ straight-vc-git-default-clone-depth 1
+ straight-use-package-by-default t)
+
+(defvar bootstrap-version)
+(let ((bootstrap-file
+ (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
+ (bootstrap-version 5))
+ (unless (file-exists-p bootstrap-file)
+ (with-current-buffer
+ (url-retrieve-synchronously
+ "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
+ 'silent 'inhibit-cookies)
+ (goto-char (point-max))
+ (eval-print-last-sexp)))
+ (load bootstrap-file nil 'nomessage))
+
+(setq straight-use-package-by-default 't)
+(straight-use-package 'use-package)
+(let ((elapsed (float-time (time-subtract (current-time)
+ emacs-start-time))))
+ (message "Loaded packages in %.3fs" elapsed))
+(setq gc-cons-threshold 100000)
+#+END_SRC
+*** Information
+#+BEGIN_SRC elisp
+(setq user-full-name "Peter Son Struschka"
+ user-mail-address "me@peter-struschka.com")
+(setenv "SHELL" "/usr/bin/zsh")
+#+END_SRC
+*** Garbage collection
+#+BEGIN_SRC elisp
+(use-package gcmh
+ :straight t
+ :demand t
+ :init
+ (setq gcmh-verbose t
+ gcmh-lows-cons-threshold #x800000
+ gcmh-high-cons-threshold #x800000
+ gcmh-idle-delay 300)
+ :config
+ (gcmh-mode))
+#+END_SRC
+*** Benchmarks
+#+BEGIN_SRC elisp
+(use-package benchmark-init
+ :demand t
+ :hook ((after-init . benchmark-init/deactivate)))
+#+END_SRC
+*** Littering
+#+BEGIN_SRC elisp
+(use-package no-littering)
+(require 'no-littering)
+#+END_SRC
+
+** Base
+*** Helm
+#+BEGIN_SRC elisp
+(use-package helm
+ :init
+ (setq helm-split-window-default-side 'other)
+ (helm-mode 1)
+ :config
+ (define-key helm-find-files-map
+ (kbd "<backtab>") #'helm-select-action)
+ (define-key helm-find-files-map
+ (kbd "C-i") #'helm-execute-persistent-action)
+ :bind
+ (([remap apropos] . helm-apropos)
+ ([remap find-library] . helm-locate-library)
+ ([remap bookmark-jump] . helm-bookmarks)
+ ([remap execute-extended-command] . helm-M-x)
+ ([remap find-file] . helm-find-files)
+ ([remap locate] . helm-locate)
+ ([remap imenu] . helm-imenu)
+ ([remap noop-show-kill-ring] . helm-show-kill-ring)
+ ([remap switch-to-buffer] . helm-buffers-list)
+ ([remap minibuffer] . helm-mini)
+ ([remap recentf-open-files] . helm-recentf)
+ ([remap occur] . helm-occur)
+ ([remap yank-pop] . helm-show-kill-ring)
+ ("C-x b" . helm-mini)
+ ("C-h d" . helm-info-at-point)
+ ("C-c r" . helm-resume)))
+
+(use-package swiper-helm
+ :bind (("C-s" . swiper-helm)))
+#+END_SRC
+*** Which
+#+BEGIN_SRC elisp
+(use-package which-key
+ :init
+ (setq which-key-separator " ")
+ (setq which-key-prefix-prefix "+")
+ :config
+ (which-key-mode))
+#+END_SRC
+*** Evil
+#+BEGIN_SRC elisp
+(use-package evil
+ :config
+ (evil-mode 1))
+(use-package evil-escape
+ :init
+ (setq-default evil-escape-key-sequence "jk")
+ :config
+ (evil-escape-mode t))
+#+END_SRC
+*** General
+#+BEGIN_SRC elisp
+(use-package general
+ :config
+ (general-define-key
+ :states '(normal visual insert emacs)
+ :prefix "SPC"
+ :non-normal-prefix "M-SPC"
+ ;; "/" '(counsel-rg :which-key "ripgrep") ; You'll need counsel package for this
+ "TAB" '(switch-to-prev-buffer :which-key "previous buffer")
+ "SPC" '(helm-M-x :which-key "M-x")
+ ;; Files
+ "f" '(:ignore t :which-key "Files")
+ "ff" '(helm-find-files :which-key "find files")
+ ;; Buffers
+ "b" '(:ignore t :which-key "Buffers")
+ "bb" '(helm-buffers-list :which-key "buffers list")
+ "bd" '(kill-this-buffer :which-key "buffer kill")
+ ;; Window
+ "w" '(:ignore t :which-key "Windows")
+ "wl" '(windmove-right :which-key "move right")
+ "wh" '(windmove-left :which-key "move left")
+ "wk" '(windmove-up :which-key "move up")
+ "wj" '(windmove-down :which-key "move bottom")
+ "w/" '(split-window-right :which-key "split right")
+ "w-" '(split-window-below :which-key "split bottom")
+ "wx" '(delete-window :which-key "delete window")
+ ;; Others
+ "a" '(:ignore t :which-key "Apps")
+ "at" '(ansi-term :which-key "open terminal")
+ ))
+#+END_SRC
+*** Completion
+#+BEGIN_SRC elisp
+(use-package company
+ :defer t
+ :diminish (company-mode . " ⓐ")
+ :init
+ (global-company-mode)
+ :config
+ (setq company-tooltip-align-annotations t
+ company-idle-delay 0.2
+ ;; min prefix of 2 chars
+ company-minimum-prefix-length 2
+ company-require-match nil))
+
+(use-package company-quickhelp ; Show help in tooltip
+ :requires (company)
+ :defer t
+ :init (with-eval-after-load 'company
+ (company-quickhelp-mode)))
+#+END_SRC
+
+*** Org Mode
+#+BEGIN_SRC elisp
+(use-package org-bullets
+ :hook (org-mode . (lambda () (org-bullets-mode t))))
+(setq org-hide-leading-stars t)
+(add-hook 'org-mode-hook 'org-indent-mode)
+(setq org-src-fontify-natively t)
+(setq org-src-preserve-indentation t
+ org-edit-src-content-indentation t)
+#+END_SRC
+
+*** Project
+#+BEGIN_SRC elisp
+(use-package projectile
+ :config
+ (projectile-mode t))
+
+#+END_SRC
+*** Git
+#+BEGIN_SRC elisp
+(use-package magit)
+#+END_SRC
+*** Treemacs
+#+BEGIN_SRC elisp
+(use-package treemacs
+ :ensure t
+ :defer t
+ :init
+ (with-eval-after-load 'winum
+ (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
+ :bind
+ (:map global-map
+ ("M-0" . treemacs-select-window)
+ ("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)))
+
+(use-package treemacs-evil)
+(use-package treemacs-projectile)
+(use-package treemacs-icons-dired)
+(use-package treemacs-magit)
+#+END_SRC
+** Appearance
+*** theme
+#+BEGIN_SRC elisp
+(use-package doom-themes
+ :config
+ (load-theme 'doom-one t))
+#+END_SRC
+
+*** Dashboard
+#+BEGIN_SRC elisp
+(use-package dashboard
+ :ensure t
+ :config
+ ;; Set the title
+ (setq dashboard-banner-logo-title "Welcome to Emacs Dashboard")
+ ;; Set the banner
+ (setq dashboard-startup-banner 'official)
+ ;; Value can be
+ ;; 'official which displays the official emacs logo
+ ;; 'logo which displays an alternative emacs logo
+ ;; 1, 2 or 3 which displays one of the text banners
+ ;; "path/to/your/image.png" which displays whatever image you would prefer
+
+ ;; Content is not centered by default. To center, set
+ (setq dashboard-center-content t)
+
+ ;; To disable shortcut "jump" indicators for each section, set
+ (setq dashboard-show-shortcuts nil)
+ (dashboard-setup-startup-hook))
+#+END_SRC
+
+*** Modeline
+#+BEGIN_SRC elisp
+(use-package doom-modeline
+ :hook (after-init . doom-modeline-mode)
+ :config (setq doom-modeline-height 25
+ doom-modeline-bar-width 3
+ doom-modeline-project-detection 'project
+ doom-modeline-buffer-file-name-style 'truncate-upto-project))
+
+#+END_SRC
+** Misc
+*** QOL
+#+BEGIN_SRC elisp
+(show-paren-mode 1)
+(setq sentence-end-double-space nil)
+
+(setq scroll-step 1
+ mouse-wheel-scroll-amount '(1 ((shift) . 1))
+ mouse-wheel-progressive-speed nil
+ mouse-wheel-follow-mouse 't
+ redisplay-dont-pause t)
+
+(when (version<= "26.0.50" emacs-version )
+ (global-display-line-numbers-mode))
+
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+
+(defalias 'yes-or-no-p 'y-or-n-p)
+#+END_SRC
+*** Custom definitions
+#+BEGIN_SRC elisp
+(defun find-config ()
+ "Edit config.org"
+ (interactive)
+ (find-file "~/.emacs.d/config.org"))
+
+(global-set-key (kbd "C-c I") 'find-config)
+#+END_SRC
+*** Finish
+#+BEGIN_SRC elisp
+(setq debug-on-error nil)
+(setq debug-on-quit nil)
+
+(let ((elapsed (float-time (time-subtract (current-time)
+ emacs-start-time))))
+ (message "Loading settings...done (%.3fs)" elapsed))
+(put 'narrow-to-region 'disabled nil)
+#+END_SRC
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
index fa6c5e8..7f731c6 100755
--- a/emacs/.emacs.d/init.el
+++ b/emacs/.emacs.d/init.el
@@ -1,45 +1 @@
-(require 'package)
-
-(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
- (not (gnutls-available-p))))
- (proto (if no-ssl "http" "https")))
- ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
- (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
- ; (add-to-list 'package-archives (cons "marmalade" (concat proto "://marmalade-repo.org/packages/")) t)
- (add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
- (add-to-list 'package-archives (cons "org" (concat proto "://orgmode.org/elpa/")) t)
- (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))
-
-(package-initialize)
-
-(unless package-archive-contents
- (package-refresh-contents))
-
-(setq package-load-list '(all))
-(unless (package-installed-p 'org)
- (package-install 'org))
-(unless (package-installed-p 'use-package)
- (package-install 'use-package))
-(package-initialize)
-
-
-(require 'org)
-
-(org-babel-load-file (expand-file-name "~/.emacs.d/myinit.org"))
-(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-safe-themes
- (quote
- ("44961a9303c92926740fc4121829c32abca38ba3a91897a4eab2aa3b7634bed4" "fede08d0f23fc0612a8354e0cf800c9ecae47ec8f32c5f29da841fe090dfc450" "8e51e44e5b079b2862335fcc5ff0f1e761dc595c7ccdb8398094fb8e088b2d50" "7559ac0083d1f08a46f65920303f970898a3d80f05905d01e81d49bb4c7f9e39" default)))
- '(package-selected-packages
- (quote
- (docker dockerfile-mode racer yaml-mode pkgbuild-mode zenburn-theme color-theme-modern base16-theme spacemacs-theme dumb-jump which-key use-package undo-tree try treemacs-projectile spaceline smartparens rainbow-delimiters org-plus-contrib nlinum magit ivy-hydra iedit fzf flycheck expand-region exec-path-from-shell doom-modeline diminish counsel-projectile company color-theme-sanityinc-solarized aggressive-indent))))
-(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.
- )
+(org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))
diff --git a/emacs/.emacs.d/myinit.org b/emacs/.emacs.d/myinit.org
index f53fa4d..aba6dc3 100755
--- a/emacs/.emacs.d/myinit.org
+++ b/emacs/.emacs.d/myinit.org
@@ -1,4 +1,4 @@
-* Interface
+ * Interface
#+BEGIN_SRC emacs-lisp
(setq inhibit-startup-screen t)
(scroll-bar-mode -1)