From 80c70bfca85f1259c444264abb427a4d31b67959 Mon Sep 17 00:00:00 2001 From: earnest ma Date: Sat, 3 Jul 2021 11:13:54 -0400 Subject: [PATCH] Import earnemacs with patches to make it less configurable --- .config/emacs/config.el | 7 + .config/emacs/core/earnecore-display.el | 168 ++++++++++++++++++ .config/emacs/core/earnecore-editing.el | 71 ++++++++ .config/emacs/core/earnecore-keybinds.el | 121 +++++++++++++ .config/emacs/core/earnecore-pkg.el | 50 ++++++ .config/emacs/core/earnecore-projects.el | 28 +++ .config/emacs/core/earnecore-theme.el | 25 +++ .config/emacs/core/earnemacs-main.el | 84 +++++++++ .config/emacs/core/earnemacs-packages.el | 80 +++++++++ .config/emacs/core/earnemacs-vars.el | 52 ++++++ .config/emacs/early-init.el | 43 +++++ .config/emacs/init.el | 34 ++++ .config/emacs/load.el | 38 ++++ .config/emacs/modules/app/earnemod-elfeed.el | 84 +++++++++ .config/emacs/modules/app/earnemod-gemini.el | 17 ++ .config/emacs/modules/app/earnemod-org.el | 124 +++++++++++++ .../modules/completion/earnemod-company.el | 59 ++++++ .../emacs/modules/completion/earnemod-ivy.el | 22 +++ .../emacs/modules/display/earnemod-focus.el | 14 ++ .../modules/display/earnemod-scrolling.el | 14 ++ .../emacs/modules/display/earnemod-window.el | 29 +++ .../emacs/modules/editor/earnemod-check.el | 14 ++ .../emacs/modules/editor/earnemod-docker.el | 18 ++ .../modules/editor/earnemod-everywhere.el | 13 ++ .config/emacs/modules/editor/earnemod-git.el | 50 ++++++ .config/emacs/modules/editor/earnemod-lsp.el | 29 +++ .../emacs/modules/editor/earnemod-parens.el | 19 ++ .config/emacs/modules/lang/earnemod-config.el | 39 ++++ .config/emacs/modules/lang/earnemod-golang.el | 15 ++ .../emacs/modules/lang/earnemod-markdown.el | 34 ++++ .config/emacs/modules/lang/earnemod-python.el | 18 ++ .config/emacs/modules/lang/earnemod-rust.el | 14 ++ .config/emacs/modules/lang/earnemod-web.el | 16 ++ .../modules/projects/earnemod-treemacs.el | 55 ++++++ 34 files changed, 1498 insertions(+) create mode 100644 .config/emacs/config.el create mode 100644 .config/emacs/core/earnecore-display.el create mode 100644 .config/emacs/core/earnecore-editing.el create mode 100644 .config/emacs/core/earnecore-keybinds.el create mode 100644 .config/emacs/core/earnecore-pkg.el create mode 100644 .config/emacs/core/earnecore-projects.el create mode 100644 .config/emacs/core/earnecore-theme.el create mode 100644 .config/emacs/core/earnemacs-main.el create mode 100644 .config/emacs/core/earnemacs-packages.el create mode 100644 .config/emacs/core/earnemacs-vars.el create mode 100644 .config/emacs/early-init.el create mode 100644 .config/emacs/init.el create mode 100644 .config/emacs/load.el create mode 100644 .config/emacs/modules/app/earnemod-elfeed.el create mode 100644 .config/emacs/modules/app/earnemod-gemini.el create mode 100644 .config/emacs/modules/app/earnemod-org.el create mode 100644 .config/emacs/modules/completion/earnemod-company.el create mode 100644 .config/emacs/modules/completion/earnemod-ivy.el create mode 100644 .config/emacs/modules/display/earnemod-focus.el create mode 100644 .config/emacs/modules/display/earnemod-scrolling.el create mode 100644 .config/emacs/modules/display/earnemod-window.el create mode 100644 .config/emacs/modules/editor/earnemod-check.el create mode 100644 .config/emacs/modules/editor/earnemod-docker.el create mode 100644 .config/emacs/modules/editor/earnemod-everywhere.el create mode 100644 .config/emacs/modules/editor/earnemod-git.el create mode 100644 .config/emacs/modules/editor/earnemod-lsp.el create mode 100644 .config/emacs/modules/editor/earnemod-parens.el create mode 100644 .config/emacs/modules/lang/earnemod-config.el create mode 100644 .config/emacs/modules/lang/earnemod-golang.el create mode 100644 .config/emacs/modules/lang/earnemod-markdown.el create mode 100644 .config/emacs/modules/lang/earnemod-python.el create mode 100644 .config/emacs/modules/lang/earnemod-rust.el create mode 100644 .config/emacs/modules/lang/earnemod-web.el create mode 100644 .config/emacs/modules/projects/earnemod-treemacs.el diff --git a/.config/emacs/config.el b/.config/emacs/config.el new file mode 100644 index 0000000..051f92e --- /dev/null +++ b/.config/emacs/config.el @@ -0,0 +1,7 @@ +(setq + user-full-name "earnest ma" + user-mail-address "me@earne.link" + + calendar-latitude 43.70011 + calendar-longitude -79.4163 +) diff --git a/.config/emacs/core/earnecore-display.el b/.config/emacs/core/earnecore-display.el new file mode 100644 index 0000000..1097c8c --- /dev/null +++ b/.config/emacs/core/earnecore-display.el @@ -0,0 +1,168 @@ +;;; earnecore-display.el --- Display -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +;; Misc +(setq frame-title-format (list "%b %* " earnemacs-daemon-name "@" system-name) + truncate-string-ellipsis "…" + use-file-dialog nil + use-dialog-box nil) + +;; Show column number in modeline +(setq-default column-number-mode t) + +;; Font: More set below, this is just in case for the daemon +(add-to-list 'default-frame-alist '(font . "Fira Code 11")) + +;; Modeline +(use-package doom-modeline + :demand + :init (doom-modeline-mode 1) + :config + (display-time-mode 1) + (if (equal "Battery status not available" + (battery)) + () + (display-battery-mode 1))) + +;; Dashboard +(use-package dashboard + :demand + ;; Prevent issues when opening through Daemon - will see scratch buffer instead + :if (< (length command-line-args) 2) + + :config + (dashboard-setup-startup-hook) + + ;; Customizations + (setq dashboard-banner-logo-title "Welcome to earnemacs!") + (setq dashboard-startup-banner 'logo) + (setq dashboard-set-footer nil) + (setq dashboard-items + '((recents . 5) + (bookmarks . 5) + (agenda . 5) + (projects . 5)))) + +;; Tabs +(use-package tab-bar + :straight nil + :bind + (:map tab-prefix-map + ("n" . tab-next) + ("p" . tab-previous) + ("t" . tab-new) + ("x" . tab-close) + ("X" . tab-close-other) + ("C-x" . tab-bar-undo-close-tab)) + :general + (earnemacs-spc-def "T" '(:keymap tab-prefix-map :wk "Tab")) + :init + (tab-bar-mode)) + +;; Scrolling +(setq mouse-wheel-scroll-amount '(2 ((shift) . 1))) +(setq mouse-wheel-progressive-speed nil) +(setq mouse-wheel-follow-mouse 't) +(setq scroll-step 1) + +;; Frame opacity +(defun earnemacs-adjust-opacity (frame incr) + "Adjust the background opacity of FRAME by increment INCR. +From purcell/emacs.d" + (unless (display-graphic-p frame) + (error "Cannot adjust opacity of this frame")) + (let* ((oldalpha (or (frame-parameter frame 'alpha) 100)) + ;; The 'alpha frame param became a pair at some point in + ;; emacs 24.x, e.g. (100 100) + (oldalpha (if (listp oldalpha) (car oldalpha) oldalpha)) + (newalpha (+ incr oldalpha))) + (when (and (<= frame-alpha-lower-limit newalpha) (>= 100 newalpha)) + (modify-frame-parameters frame (list (cons 'alpha newalpha)))))) + +(earnemacs-spc-def + ;; Frame opacity keybindings + "t0" '(:def (lambda () (interactive) (modify-frame-parameters nil + `((alpha . 100)))) + :wk "Reset transparency") + "t-" '(:def (lambda () (interactive) (earnemacs-adjust-opacity nil -10)) + :wk "Decrease transparency") + "t=" '(:def (lambda () (interactive) (earnemacs-adjust-opacity nil 10)) + :wk "Increase transparency")) + + +;; Increase/ decrease font size +(defun font-name-replace-size (font-name new-size) + (let ((parts (split-string font-name "-"))) + (setcar (nthcdr 7 parts) (format "%d" new-size)) + (mapconcat 'identity parts "-"))) + +(defun increment-default-font-height (delta) + "Adjust the default font height by DELTA on every frame. +The pixel size of the frame is kept (approximately) the same. +DELTA should be a multiple of 10, in the units used by the +:height face attribute. From purcell/emacs.d" + (let* ((new-height (+ (face-attribute 'default :height) delta)) + (new-point-height (/ new-height 10))) + (dolist (f (frame-list)) + (with-selected-frame f + ;; Latest 'set-frame-font supports a "frames" arg, but + ;; we cater to Emacs 23 by looping instead. + (set-frame-font (font-name-replace-size (face-font 'default) + new-point-height) + t))) + (set-face-attribute 'default nil :height new-height) + (message "default font size is now %d" new-point-height))) + +;; Functions, keybindings for size +(defun increase-default-font-height () + (interactive) + (increment-default-font-height 10)) + +(defun decrease-default-font-height () + (interactive) + (increment-default-font-height -10)) + +(earnemacs-spc-def + ;; -/+ zooms in/out using `text-scale-...' + "z0" 'text-scale-adjust + "z-" 'text-scale-decrease + "z=" 'text-scale-increase + ;; Shift -/+ increases the default font height + "z+" 'increase-default-font-height + "z_" 'decrease-default-font-height) + +;; - +;; Setup font/ transparency/ display of frame +(defun earnemacs--frame-hook () + "Font and transparency settings. This is in a hook because Emacs doesn't +really like setting fonts/ transparency when run through a daemon." + (if (not (null earnemacs-transparent-frame)) + (modify-all-frames-parameters `((alpha . 95)))) + + (set-face-attribute 'default nil + :font "Fira Code" + :height earnemacs-default-face-height) + + (set-face-attribute 'fixed-pitch nil + :font "Fira Code" + :height earnemacs-fixed-face-height) + + (set-face-attribute 'variable-pitch nil + :font "FiraGO" + :height earnemacs-variable-face-height)) + +;; Run earnemacs--frame-hook, if daemon nothing will happen, but the hook will +;; set everything when it needs to. +(earnemacs--frame-hook) +(add-hook 'server-after-make-frame-hook 'earnemacs--frame-hook) + +;; Give focus when a new client frame is created +(add-hook 'server-after-make-frame-hook + (lambda () (select-frame-set-input-focus (selected-frame)))) + +(provide 'earnecore-display) +;;; earnecore-display.el ends here diff --git a/.config/emacs/core/earnecore-editing.el b/.config/emacs/core/earnecore-editing.el new file mode 100644 index 0000000..a397474 --- /dev/null +++ b/.config/emacs/core/earnecore-editing.el @@ -0,0 +1,71 @@ +;;; earnecore-editing.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; + +;;; Code: +(use-package editorconfig + :demand + :config + (editorconfig-mode 1)) + +;; Improve performance for large files +(global-so-long-mode 1) + +;; Automatically revert buffers when changed on disk +(global-auto-revert-mode 1) + +;; Save and restore place in file +(save-place-mode +1) + +;; Auto-saving/ backup/ lockfiles +(use-package super-save + :demand + :config + (super-save-mode +1) + (setq super-save-auto-save-when-idle t) + (setq super-save-remote-files nil) + (setq super-save-exclude '(".gpg"))) + +(setq backup-by-copying t + delete-old-versions t + kept-new-versions 6 + kept-old-versions 2 + version-control t) + +;; crux (A Collection of Ridiculously Useful eXtensions for Emacs) +(use-package crux + :general + (earnemacs-spc-def + "fr" 'crux-sudo-edit)) + +;; "Paste menu" - taken and adapted with <3 from Doom Emacs +(defun earnemacs/paste () + "Interactively select what text to insert from the kill ring." + (interactive) + (call-interactively + (cond ((fboundp 'counsel-yank-pop) #'counsel-yank-pop) + ((error "No kill-ring search backend available."))))) +(earnemacs-spc-def "ip" 'earnemacs/paste) + +;; yes or no -> y or n +(fset 'yes-or-no-p 'y-or-n-p) + +;; Windows: open current directory in explorer.exe +(when *sys-windows* + (defun earnemacs/open-current-dir-in-explorer () + "Open the currently visited directory in Windows Explorer." + (interactive) + (shell-command "explorer.exe ."))) + +(setq delete-by-moving-to-trash t) + +(setq-default fill-column 80) + +(provide 'earnecore-editing) +;;; earnecore-editing.el ends here diff --git a/.config/emacs/core/earnecore-keybinds.el b/.config/emacs/core/earnecore-keybinds.el new file mode 100644 index 0000000..bf703fa --- /dev/null +++ b/.config/emacs/core/earnecore-keybinds.el @@ -0,0 +1,121 @@ +;;; earnecore-keybinds.el --- Evil mode and keys -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(global-set-key (kbd "") 'keyboard-escape-quit) + +;; Evil +(use-package evil + :demand + :init + (setq evil-want-integration t) + (setq evil-want-keybinding nil) + (setq evil-want-fine-undo t) + :config + (evil-mode 1) + (setq evil-split-window-below t + evil-vsplit-window-right t) + (evil-ex-define-cmd "W" 'evil-write-all) + (evil-ex-define-cmd "Q" 'save-buffers-kill-emacs)) + +;; which-key +(use-package which-key + :demand + :config + (which-key-mode)) + +;; General +(use-package general + :demand + :config + (general-create-definer earnemacs-spc-def + :states '(normal emacs insert visual) + :prefix "SPC" + :non-normal-prefix "C-SPC") + + ;; Base SPC keybindings + (earnemacs-spc-def + "." 'find-file + ";" 'eval-expression + ":" 'shell-command + + "b" '(:wk "Buffer") + "be" 'eval-buffer + "bk" 'kill-buffer + "bK" 'kill-current-buffer + "br" 'revert-buffer + "bs" 'save-buffer + "bS" 'save-some-buffers + "bx" '(:def (lambda () (interactive) (switch-to-buffer "*scratch*")) + :wk "scratch buffer") + "bz" 'bury-buffer + "bZ" 'unbury-buffer + "b " 'switch-to-next-buffer + "b " 'switch-to-prev-buffer + + "c" '(:wk "Code") + + "f" '(:wk "File") + "ff" 'find-file + "fP" '(:def (lambda () (interactive) + (find-file (concat earnemacs-root-dir "config.el"))) + :wk "open config file") + "fs" 'save-buffer + "fS" '(:def (lambda () (interactive) (save-buffer "")) + :wk "save buffer as") + "fy" '(:def (lambda () (interactive) (kill-new buffer-file-name)) + :wk "kill path to buffer") + "fY" '(:def (lambda () (interactive) (kill-new default-directory)) + :wk "kill current dir path") + + "g" '(:wk "Git") + + "h" '(:keymap help-map :wk "Help") + + "i" '(:wk "Insert") + + "o" '(:wk "Open") + "oe" 'eshell + "of" 'make-frame-command + "oS" 'shell + + "q" '(:wk "Quit/Reload") + "qf" 'delete-frame + "qK" 'save-buffers-kill-emacs + "qq" 'save-buffers-kill-terminal + "qQ" 'evil-quit-all-with-error-code + + "t" '(:wk "Toggle") + "tf" 'toggle-frame-fullscreen + "tF" 'flycheck-mode + "tr" 'read-only-mode + "to" 'olivetti-mode + "tv" 'variable-pitch-mode + "tw" 'visual-line-mode + + "w" '(:wk "Window") + "w=" 'balance-windows + "w-" 'evil-window-decrease-height + "w+" 'evil-window-increase-height + "w<" 'evil-window-decrease-width + "w>" 'evil-window-increase-width + + "wh" 'evil-window-left + "wj" 'evil-window-down + "wk" 'evil-window-top + "wl" 'evil-window-right + + "wd" 'evil-window-delete + "wn" 'evil-window-new + "wq" 'evil-quit + "ww" 'evil-window-next + "wv" 'evil-window-vsplit + + "wt" 'tear-off-window + )) + +(provide 'earnecore-keybinds) +;;; earnecore-keybinds.el ends here diff --git a/.config/emacs/core/earnecore-pkg.el b/.config/emacs/core/earnecore-pkg.el new file mode 100644 index 0000000..72f0bcf --- /dev/null +++ b/.config/emacs/core/earnecore-pkg.el @@ -0,0 +1,50 @@ +;;; earnecore-pkg.el --- Misc -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +;; Keep the emacs config directory clean +(use-package no-littering + :demand + :config + ;; Exclude directories from recentf + (with-eval-after-load 'recentf + (add-to-list 'recentf-exclude no-littering-etc-directory) + (add-to-list 'recentf-exclude no-littering-var-directory)) + + (setq ; save some files to different files for daemon(s) + recentf-save-file (concat no-littering-var-directory + "recentf-save-" earnemacs-daemon-name ".el") + bookmark-default-file (concat no-littering-var-directory + "bookmark-" earnemacs-daemon-name ".el") + projectile-cache-file (concat no-littering-var-directory + "projectile/cache-" earnemacs-daemon-name ".el") + projectile-known-projects-file (concat no-littering-var-directory + "projectile/known-projects-" + earnemacs-daemon-name ".el"))) + +;; Do not keep or load a custom file +(setq custom-file (expand-file-name + (format + "custom-%d-%d.el" (emacs-pid) (random)) + temporary-file-directory)) + +;; Native comp adjustments +(defun earnemacs--native-comp-adjustments () + "Adjustments when using Emacs built with native compilation." + (setq comp-async-report-warnings-errors nil)) + +(if (and (fboundp 'native-comp-available-p) + (native-comp-available-p)) + (earnemacs--native-comp-adjustments)) + +;; Inherit environment variables from shell +(use-package exec-path-from-shell + :if (or *sys-bsd* *sys-linux* *sys-mac*) + :init + (exec-path-from-shell-initialize)) + +(provide 'earnecore-pkg) +;;; earnecore-pkg.el ends here diff --git a/.config/emacs/core/earnecore-projects.el b/.config/emacs/core/earnecore-projects.el new file mode 100644 index 0000000..b329268 --- /dev/null +++ b/.config/emacs/core/earnecore-projects.el @@ -0,0 +1,28 @@ +;;; earnecore-projects.el --- Project management -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; + +;;; Code: +(use-package projectile + :general + (general-def + :keymaps 'projectile-command-map "A" + 'projectile-add-known-project) + (earnemacs-spc-def + "SPC" 'projectile-find-file + "," 'projectile-switch-to-buffer + "p" '(:keymap projectile-command-map :package projectile :wk "Projectile")) + + :config + (projectile-mode +1) + (when (file-directory-p "~/ghq") + (setq projectile-project-search-path '("~/ghq")))) + +(provide 'earnecore-projects) +;;; earnecore-projects.el ends here diff --git a/.config/emacs/core/earnecore-theme.el b/.config/emacs/core/earnecore-theme.el new file mode 100644 index 0000000..a3609c1 --- /dev/null +++ b/.config/emacs/core/earnecore-theme.el @@ -0,0 +1,25 @@ +;;; earnecore-theme.el --- Theme -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; + +;;; Code: +(defvar earnemacs-theme 'doom-dracula + "Theme to load. Change in load.el") + +(use-package doom-themes + :demand + :config + (doom-themes-visual-bell-config)) + +(use-package modus-themes) + +(load-theme earnemacs-theme t) + +(provide 'earnecore-theme) +;;; earnemod-base-theme.el ends here diff --git a/.config/emacs/core/earnemacs-main.el b/.config/emacs/core/earnemacs-main.el new file mode 100644 index 0000000..3ddcefe --- /dev/null +++ b/.config/emacs/core/earnemacs-main.el @@ -0,0 +1,84 @@ +;;; earnemacs-main.el --- earnemacs -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; The main earnemacs file. + +;;; Code: + +;; Windows - $HOME folder if not set +(when (and *sys-windows* (null (getenv-internal "HOME"))) + (setenv "HOME" (getenv "USERPROFILE")) + (setq abbreviated-home-dir nil)) + +;; UTF-8, LF by default +(setq-default buffer-file-coding-system 'utf-8-unix) +(setq-default default-buffer-file-coding-system 'utf-8-unix) +(set-default-coding-systems 'utf-8-unix) +(prefer-coding-system 'utf-8-unix) + +;; Less noise on startup +(unless (daemonp) + (advice-add #'display-startup-echo-area-message :override #'ignore)) ; message +(setq inhibit-startup-screen t) ; startup buffer +(setq ad-redefinition-action 'accept) ; silence redefined warnings + +(setq server-use-tcp t) ; daemon: use tcp sockets file + +;; Add default modules to load path (modules/ recursively) +;; Taken with <3 from siren emacs: https://github.com/jimeh/.emacs.d +(defun siren-recursive-add-to-load-path (dir) + "Add DIR and all its sub-directories to `load-path'." + (add-to-list 'load-path dir) + (dolist (f (directory-files dir)) + (let ((name (expand-file-name f dir))) + (when (and (file-directory-p name) + (not (string-prefix-p "." f))) + (siren-recursive-add-to-load-path name))))) + +(siren-recursive-add-to-load-path earnemacs-modules-dir) + +;;; - + +(defun earnemacs+load () + "Function to finish loading earnemacs. + +earnemacs has already loaded earnemacs-var, -main, and -packages. +This function will load: + +- core modules (prefixed with `earnecore-') +- `pre-load.el' if it exists +- `load.el' +- `config.el'" + + (let* ((prel (concat earnemacs-root-dir "pre-load.el"))) + (if (file-exists-p prel) + (load-file prel))) + + ;; Load core modules + (require 'earnecore-theme) + (require 'earnecore-keybinds) + (require 'earnecore-display) + (require 'earnecore-pkg) + (require 'earnecore-projects) + (require 'earnecore-editing) + + (let* ((modules (concat earnemacs-root-dir "load.el"))) + (load modules nil t) + (dolist (module earnemacs-modules) + (require module))) + + (let* ((config (concat earnemacs-root-dir "config.el"))) + (load config nil t)) + + (setq earnemacs-initialized-p t)) + +;; Load everything! +(earnemacs+load) + +(provide 'earnemacs-main) +;;; earnemacs-main.el ends here diff --git a/.config/emacs/core/earnemacs-packages.el b/.config/emacs/core/earnemacs-packages.el new file mode 100644 index 0000000..f20952d --- /dev/null +++ b/.config/emacs/core/earnemacs-packages.el @@ -0,0 +1,80 @@ +;;; earnemacs-packages.el --- Package management -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; Bootstrap/ load and configure straight.el for package management. + +;;; Code: + +;; Profiles +(setq straight-profiles + '((nil . "default.el") + (pinned . "pinned.el"))) + +;; Use the develop branch of straight.el (for now), must set before bootstrap. +(setq straight-repository-branch "develop") + +;; Boostrap/ load straight.el +(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)) + +;; Configure straight +; (setq straight-vc-git-default-clone-depth 1) ; save space + +(setq straight-use-package-by-default t) ; use-package integration +(straight-use-package 'use-package) + +(setq use-package-always-defer t) ; always defer unless :demanded + +(require 'straight-x) ; load additional experimental commands + +;;; Modules system: + +(defvar earnemacs-modules nil + "A quoted list of optional modules to load. The default list is provided and +used form `load.template.el'. It should be checked after every major update to +earnemacs.") + +(defun earnemacs-update-packages () + "Update all packages (core/ module packages mostly will refer to pinned +lockfile unless no commit hash is provided) and write packages the user has +installed to the `default.el' lockfile." + (interactive) + + (message "[earnemacs] Updating packages and lockfiles...") + (straight-x-pull-all) + (straight-x-freeze-versions) + (message "[earnemacs] Update complete, consider reloading earnemacs.")) + +;;; Pin packages to a certain commit (for core/ module packages only): +;; Any core/module package not given a commit hash here will update +;; as normal, and no hash is written to `pinned.el'. + +(defmacro earnemacs-package-pin (package commit) + "Add the PACKAGE and COMMIT hash to the pinned lockfile. Aliased to `epin'. + +Ex: (epin \"packagename\" \"70b64b6d91d62ecef8fa202c65c19b8aba7122e2\") +Only for core/ optional modules. (for now?)" + + `(let ((straight-current-profile 'pinned)) + (add-to-list 'straight-x-pinned-packages + '(,package . ,commit)))) + +(defalias 'epin 'earnemacs-package-pin) + +(provide 'earnemacs-packages) +;;; earnemacs-packages.el ends here diff --git a/.config/emacs/core/earnemacs-vars.el b/.config/emacs/core/earnemacs-vars.el new file mode 100644 index 0000000..b28f32b --- /dev/null +++ b/.config/emacs/core/earnemacs-vars.el @@ -0,0 +1,52 @@ +;;; earnemacs-vars.el --- Variables for earnemacs -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; This file defines variables for earnemacs. + +;;; Code: + +(defconst earnemacs-root-dir user-emacs-directory + "Typically the ~/.config/emacs or ~/.emacs.d directory earnemacs is being +loaded from, although this can differ if you are using chemacs2.") + +(defconst earnemacs-core-dir (concat earnemacs-root-dir "core/") + "Path to the earnemacs core directory.") + +(defconst earnemacs-modules-dir (concat earnemacs-root-dir "modules/") + "Path to the earnemacs modules directory.") + +(defvar earnemacs-initialized-p nil + "Non-nil if earnemacs has been initialized.") + +;; What OS are we using? +(defconst *sys-linux* (eq system-type 'gnu/linux)) +(defconst *sys-windows* (memq system-type '(windows-nt cygwin ms-dos))) +(defconst *sys-mac* (eq system-type 'darwin)) +(defconst *sys-bsd* (or *sys-mac* (eq system-type 'berkeley-unix))) + +;; Daemon identification +(cond ((eq (daemonp) nil) + (defconst earnemacs-daemon-name "indiv")) ; emacs + ((eq (daemonp) t) + (defconst earnemacs-daemon-name "daemon")) ; emacs --daemon + ((defconst earnemacs-daemon-name (daemonp)))) ; emacs --daemon="..." + +;; Config options that must be set very early + +(defvar earnemacs-default-face-height 110 + "If you want to adjust it, it must be done in `pre-load.el'.") +(defvar earnemacs-fixed-face-height 110 + "If you want to adjust it, it must be done in `pre-load.el'.") +(defvar earnemacs-variable-face-height 115 + "If you want to adjust it, it must be done in `pre-load.el'.") +(defvar earnemacs-transparent-frame t + "Enables a semi-transparent frame by default. Set to nil to disable in +`pre-load.el'.") + +(provide 'earnemacs-vars) +;;; earnemacs-vars.el ends here diff --git a/.config/emacs/early-init.el b/.config/emacs/early-init.el new file mode 100644 index 0000000..8760335 --- /dev/null +++ b/.config/emacs/early-init.el @@ -0,0 +1,43 @@ +;;; early-init.el --- Early initialization -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; This file is loaded before the main `init.el' initialization file and +;; graphical window. + +;;; Code: + +;; Garbage collection +(setq gc-cons-threshold most-positive-fixnum + gc-cons-percentage 0.6) + +(add-hook 'emacs-startup-hook + (lambda () + (setq gc-cons-threshold 16777216 + gc-cons-percentage 0.1))) + +;; Remove some graphical things +;; (if (not (eq system-type 'darwin)) (menu-bar-mode -1)) +(tool-bar-mode -1) +(scroll-bar-mode -1) ; no scroll bars at all + +;; Startup slightly faster even if frame is being resized on startup +(setq frame-inhibit-implied-resize t) + +;; Do NOT use package.el +(setq package-enable-at-startup nil) + +;; Silence "Package cl is deprecated" +;; AFAIK, cl was deprecated in Emacs 27.1 and replaced by cl-lib, +;; which some packages have not switched over to yet. +(setq byte-compile-warnings '(cl-functions)) + +;; Don't show the default modeline until doom-modeline loads +(setq-default mode-line-format nil) + +(provide 'early-init) +;;; early-init.el ends here diff --git a/.config/emacs/init.el b/.config/emacs/init.el new file mode 100644 index 0000000..de19588 --- /dev/null +++ b/.config/emacs/init.el @@ -0,0 +1,34 @@ +;;; init.el --- Emacs main initialization file -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; Other than `early-init.el', this file is first looked at when Emacs is first +;; started. It only checks if the Emacs version is too low and the loads the +;; core/main.el file. + +;;; Code: + +(defvar earnemacs-minimum-emacs-version "27.1" + "Minimum Emacs version for earnemacs functionality.") + +;; Error if Emacs version is not supported +(if (version< emacs-version earnemacs-minimum-emacs-version) + (error (concat "[earnemacs] supports %s or higher, " + "but you are running %s." + earnemacs-minimum-emacs-version emacs-version))) + +;; Load! +(add-to-list 'load-path (expand-file-name "core/" user-emacs-directory)) +(require 'earnemacs-vars) +(require 'earnemacs-packages) + +(use-package earnemacs-main + :straight nil + :demand) + +(provide 'init) +;;; init.el ends here diff --git a/.config/emacs/load.el b/.config/emacs/load.el new file mode 100644 index 0000000..654fe7a --- /dev/null +++ b/.config/emacs/load.el @@ -0,0 +1,38 @@ +(setq + earnemacs-modules '( + ;; completion + earnemod-company + earnemod-ivy + + ;; display + earnemod-focus + earnemod-scrolling + earnemod-window + + ;; editor + earnemod-everywhere + earnemod-check + earnemod-docker + earnemod-git + earnemod-lsp + earnemod-parens + + ;; projects + earnemod-treemacs + + ;; lang + earnemod-config + earnemod-markdown + earnemod-golang + earnemod-python + earnemod-rust + earnemod-web + + ;; apps + earnemod-elfeed + earnemod-gemini + earnemod-org + + ;; games + ) + ) diff --git a/.config/emacs/modules/app/earnemod-elfeed.el b/.config/emacs/modules/app/earnemod-elfeed.el new file mode 100644 index 0000000..27adf1c --- /dev/null +++ b/.config/emacs/modules/app/earnemod-elfeed.el @@ -0,0 +1,84 @@ +;;; earnemod-elfeed.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package elfeed + :bind (:map elfeed-search-mode-map + ("q" . bjm/elfeed-save-db-and-bury) + ("w" . (lambda () (interactive) (elfeed-db-save))) + ("m" . elfeed-toggle-star) + ("b" . mz/elfeed-browse-url) + ("B" . elfeed-search-browse-url)) + :general + (earnemacs-spc-def "or" 'bjm/elfeed-load-db-and-open) + + :hook + (elfeed-show-mode . visual-line-mode) + (elfeed-show-mode . olivetti-mode) + + :config + ;; Set the default state to Emacs + (evil-set-initial-state 'elfeed-search-mode 'emacs) + (evil-set-initial-state 'elfeed-show-mode 'emacs) + + (defun elfeed-mark-all-as-read () + "Mark the whole buffer as read." + (interactive) + (mark-whole-buffer) + (elfeed-search-untag-all-unread)) + + (defun bjm/elfeed-load-db-and-open () + "Wrapper to load the elfeed db from disk before opening" + (interactive) + (elfeed-protocol-enable) + (elfeed-db-load) + (elfeed) + (elfeed-goodies/setup) + (elfeed-search-update--force)) + + (defun bjm/elfeed-save-db-and-bury () + "Wrapper to save the elfeed db to disk before burying buffer" + (interactive) + (elfeed-db-save) + (quit-window)) + + ;; Browse the URL at point without marking as read + ;; https://github.com/zamansky/dot-emacs/blob/master/README.org + (defun mz/elfeed-browse-url (&optional use-generic-p) + "Visit the current entry in your browser using `browse-url'. + If there is a prefix argument, visit the current entry in the + browser defined by `browse-url-generic-program'." + (interactive "P") + (let ((entries (elfeed-search-selected))) + (cl-loop for entry in entries + do (if use-generic-p + (browse-url-generic (elfeed-entry-link entry)) + (browse-url (elfeed-entry-link entry)))) + (mapc #'elfeed-search-update-entry entries) + (unless (or elfeed-search-remain-on-entry (use-region-p))))) + + ;; Take advantage of curl if it is available + (if (executable-find "curl") + (setq + elfeed-use-curl t + elfeed-curl-max-connections 10)) + + ;; Set the default search filter (space for convenience) + (setq-default elfeed-search-filter "@3-months-ago +unread ")) + +(use-package elfeed-protocol + :demand + :after elfeed) + +(use-package elfeed-goodies + :demand + :after elfeed + :config + ;; Make the feed source column width longer + (setq elfeed-goodies/feed-source-column-width 26)) + +(provide 'earnemod-elfeed) +;;; earnemod-elfeed.el ends here diff --git a/.config/emacs/modules/app/earnemod-gemini.el b/.config/emacs/modules/app/earnemod-gemini.el new file mode 100644 index 0000000..76140df --- /dev/null +++ b/.config/emacs/modules/app/earnemod-gemini.el @@ -0,0 +1,17 @@ +;;; earnemod-gemini.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package elpher + :general + (earnemacs-spc-def "oG" 'elpher)) + +(use-package gemini-mode) + +(use-package ox-gemini) + +(provide 'earnemod-gemini) +;;; earnemod-gemini.el ends here diff --git a/.config/emacs/modules/app/earnemod-org.el b/.config/emacs/modules/app/earnemod-org.el new file mode 100644 index 0000000..8926d48 --- /dev/null +++ b/.config/emacs/modules/app/earnemod-org.el @@ -0,0 +1,124 @@ +;;; earnemod-org.el --- org-mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package org + ;; Use built-in org + :straight nil + + :general + (earnemacs-spc-def + "oA" 'org-agenda + "oC" 'org-capture) + :config + ;; Default directory containing org-mode files + (setq org-directory "~/org/") + + ;; Enable modules + (add-to-list 'org-modules 'org-habit) + + ;; Hooks: + ;; Indent correctly + (add-hook 'org-mode-hook 'org-indent-mode) + ;; Visual wrapping + (add-hook 'org-mode-hook 'visual-line-mode) + ;; Table of contents generation + (add-hook 'org-mode-hook 'toc-org-mode) + ;; Use sans-serif font + (add-hook 'org-mode-hook 'variable-pitch-mode) + + ;; Set indenting as default + (setq-default org-indent-mode t) + + ;; use org-mode + doom-themes improvements + (doom-themes-org-config) + + ;; Variable pitch and heading + (custom-theme-set-faces + ;; <3 https://zzamboni.org/post/beautifying-org-mode-in-emacs/ + 'user + '(org-block ((t (:inherit fixed-pitch)))) + '(org-code ((t (:inherit fixed-pitch)))) + '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) + '(org-indent ((t (:inherit (org-hide fixed-pitch))))) + '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) + '(org-property-value ((t (:inherit fixed-pitch))) t) + '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))) + t)) + '(org-table ((t (:inherit fixed-pitch)))) + '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) + '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) + + :custom + ;; Set number of lines between headings to display empty lines to 1 + (org-cycle-separator-lines 1) + + ;; Set default table formatting + (org-columns-set-default-format + "80ITM(Task) %10Effort(Effort){:} %10CLOCKSUM(Timed)") + + ;; Enforce todo dependencies + (org-enforce-todo-dependencies t) + + (org-global-properties (quote ( + ;; Set default Effort properties + ("Effort_ALL" . "0:05 0:10 0:15 0:20 + 0:30 0:45 1:00 1:30 2:00 4:00 6:00 8:00")))) + + ;; Drawer names + (org-log-into-drawer "LOGBOOK") + (org-clock-into-drawer "CLOCKING") + + ;; Do not set state triggers when using Shift to change states + (org-treat-S-cursor-todo-selection-as-state-change nil) + + ;; Log time when task marked as DONE + (org-log-done 'time) + + ;; Log note and time when rescheduling or redeadlining + (org-log-reschedule 'note) + (org-log-redeadline 'note) + + ;; Only show today's habits + (org-habit-show-habits-only-for-today t)) + +(use-package org-agenda + :after org + :straight nil + :bind (("C-c a" . org-agenda)) + :custom + (org-agenda-window-setup 'other-window) + (org-agenda-restore-windows-after-quit 't) + (org-agenda-dim-blocked-tasks t) + (org-agenda-span 4) + (org-agenda-start-on-weekday nil) + (org-agenda-start-day "-1d") + (org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled) + (org-agenda-skip-deadline-if-done nil) + (org-agenda-skip-scheduled-if-done nil)) + +(use-package org-capture + :after org + :straight nil + :bind (("C-c c" . org-capture)) + :custom + ;; Base capture templates + (org-capture-templates + `(("t" "Task" entry (file, "~/org/refile.org") + "* TODO %^{Task}\n:PROPERTIES:\n- Added: %U\n:END:" + :empty-lines 1 :immediate-finish t :clock-resume :kill-buffer)))) + +(use-package ox-ssh) + +(use-package toc-org) + +(use-package zpresent + :config + ;; Set default state to Emacs + (evil-set-initial-state 'zpresent-mode 'emacs)) + +(provide 'earnemod-org) +;;; earnemod-org.el ends here diff --git a/.config/emacs/modules/completion/earnemod-company.el b/.config/emacs/modules/completion/earnemod-company.el new file mode 100644 index 0000000..9921bcd --- /dev/null +++ b/.config/emacs/modules/completion/earnemod-company.el @@ -0,0 +1,59 @@ +;;; earnecore-company.el --- Company completion -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package company + :init (global-company-mode) + :bind (:map company-active-map + ;; TAB should always complete the current selection + ("" . company-complete-selection) + + ;; Spaces should not try to complete + ("SPC" . nil)) + + :bind ((;; Trigger completion manually + "M-RET" . company-manual-begin)) + + :config + ;; Max number of results + (setq company-tooltip-limit 10) + + ;; Press M-# to complete that selection + (setq company-show-numbers t) + + ;; Show results immediately/ faster + (setq company-idle-delay 0) + (setq company-echo-delay 0) + (setq company-minimum-prefix-length 2) + + ;; Prevent non-matching input from blocking, but only if we explicitly + ;; interact with company + (setq company-require-match #'company-explicit-action-p) + + ;; Do not downcase completion suggestions + (setq company-dabbrev-downcase nil)) + +(use-package company-statistics + :demand + :after company + :config + ;; Load the company-statistics file silently. + (defun earnemacs--company-statistics--load () + "Restore statistics without a minibuffer message" + (load company-statistics-file 'noerror 'nomessage 'nosuffix)) + (advice-add 'company-statistics--load + :override #'earnemacs--company-statistics--load) + + ;; Load + (company-statistics-mode)) + +(use-package company-quickhelp + :demand + :after company + :config (company-quickhelp-mode)) + +(provide 'earnemod-company) +;;; earnemod-company.el ends here diff --git a/.config/emacs/modules/completion/earnemod-ivy.el b/.config/emacs/modules/completion/earnemod-ivy.el new file mode 100644 index 0000000..bbd99b7 --- /dev/null +++ b/.config/emacs/modules/completion/earnemod-ivy.el @@ -0,0 +1,22 @@ +;;; earnecore-ivy.el --- Ivy -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package ivy + :demand + :general + (earnemacs-spc-def + "/" 'ivy-switch-buffer + "bb" 'ivy-switch-buffer) + :config + (ivy-mode 1)) + +(use-package counsel + :demand + :after ivy) + +(provide 'earnemod-ivy) +;;; earnemod-ivy.el ends here diff --git a/.config/emacs/modules/display/earnemod-focus.el b/.config/emacs/modules/display/earnemod-focus.el new file mode 100644 index 0000000..c9bf134 --- /dev/null +++ b/.config/emacs/modules/display/earnemod-focus.el @@ -0,0 +1,14 @@ +;;; earnemod-focus.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package olivetti + :general + (earnemacs-spc-def + "to" 'olivetti-mode)) + +(provide 'earnemod-focus) +;;; earnemod-focus.el ends here diff --git a/.config/emacs/modules/display/earnemod-scrolling.el b/.config/emacs/modules/display/earnemod-scrolling.el new file mode 100644 index 0000000..057b1b6 --- /dev/null +++ b/.config/emacs/modules/display/earnemod-scrolling.el @@ -0,0 +1,14 @@ +;;; earnemod-scrolling.el --- Improves scrolling -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package good-scroll + :demand + :init + (good-scroll-mode +1)) + +(provide 'earnemod-scrolling) +;;; earnemod-scrolling.el ends here diff --git a/.config/emacs/modules/display/earnemod-window.el b/.config/emacs/modules/display/earnemod-window.el new file mode 100644 index 0000000..01aee33 --- /dev/null +++ b/.config/emacs/modules/display/earnemod-window.el @@ -0,0 +1,29 @@ +;;; earnemod-window.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package ace-window + :bind (("M-o" . 'ace-window) + ("M-O" . 'ace-delete-window)) + :general + (earnemacs-spc-def + "wo" 'ace-window + "wO" 'ace-delete-window + "wX" 'ace-delete-other-windows)) + +;; Easily undo/ redo window configuration +(use-package winner + :straight nil + :demand + :general + (earnemacs-spc-def + "wu" 'winner-undo + "wU" 'winner-redo) + :config + (winner-mode 1)) + +(provide 'earnemod-window) +;;; earnemod-window.el ends here diff --git a/.config/emacs/modules/editor/earnemod-check.el b/.config/emacs/modules/editor/earnemod-check.el new file mode 100644 index 0000000..7027152 --- /dev/null +++ b/.config/emacs/modules/editor/earnemod-check.el @@ -0,0 +1,14 @@ +;;; earnemod-check.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package flycheck + :demand + :config + (global-flycheck-mode +1)) + +(provide 'earnemod-check) +;;; earnemod-check.el ends here diff --git a/.config/emacs/modules/editor/earnemod-docker.el b/.config/emacs/modules/editor/earnemod-docker.el new file mode 100644 index 0000000..270d186 --- /dev/null +++ b/.config/emacs/modules/editor/earnemod-docker.el @@ -0,0 +1,18 @@ +;;; earnemod-docker.el --- Docker -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: + +(use-package docker + :general + (earnemacs-spc-def "od" 'docker)) + +(use-package dockerfile-mode) + +(use-package docker-compose-mode) + +(provide 'earnemod-docker) +;;; earnemod-docker.el ends here diff --git a/.config/emacs/modules/editor/earnemod-everywhere.el b/.config/emacs/modules/editor/earnemod-everywhere.el new file mode 100644 index 0000000..47db690 --- /dev/null +++ b/.config/emacs/modules/editor/earnemod-everywhere.el @@ -0,0 +1,13 @@ +;;; earnemod-everywhere.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package emacs-everywhere + :if (or *sys-bsd* *sys-linux* *sys-mac*) + :demand) + +(provide 'earnemod-everywhere) +;;; earnemod-everywhere.el ends here diff --git a/.config/emacs/modules/editor/earnemod-git.el b/.config/emacs/modules/editor/earnemod-git.el new file mode 100644 index 0000000..eb51361 --- /dev/null +++ b/.config/emacs/modules/editor/earnemod-git.el @@ -0,0 +1,50 @@ +;;; earnemod-git.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package ghq + :if (executable-find "ghq") + :general + (earnemacs-spc-def + "gc" 'ghq)) + +(use-package magit + :demand + :general + (earnemacs-spc-def + "g." 'magit-dispatch + "gb" 'magit-branch + "gf" 'magit-fetch + "gF" 'magit-pull + "gg" 'magit-status + "gs" 'magit-stage-file + "gS" 'magit-unstage-file + "gm" 'magit-merge + "gM" 'magit-remote + "gP" 'magit-push + "gr" 'magit-rebase + "gz" 'magit-stash) + :config + ;; Set default state to Emacs + (evil-set-initial-state 'magit-status-mode 'emacs)) + +(use-package git-gutter + :demand + :config + ;; Update every 2 seconds + (setq git-gutter:update-interval 2) + + ;; Load + (global-git-gutter-mode)) + +;; Follow symlinks +(setq vc-follow-symlinks t) + +;; Major mode for editing git files (ignore, attributes...) +(use-package git-modes) + +(provide 'earnemod-git) +;;; earnemod-git.el ends here diff --git a/.config/emacs/modules/editor/earnemod-lsp.el b/.config/emacs/modules/editor/earnemod-lsp.el new file mode 100644 index 0000000..c7b0820 --- /dev/null +++ b/.config/emacs/modules/editor/earnemod-lsp.el @@ -0,0 +1,29 @@ +;;; earnemod-lsp.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package lsp-mode + :init + (setq lsp-keymap-prefix "C-c l") + :hook + ((lsp-mode . lsp-enable-which-key-integration))) + +(use-package lsp-ui + :demand + :after lsp-mode) + +(use-package lsp-ivy + :if (fboundp 'ivy-mode) + :demand + :after (lsp-mode ivy-mode)) + +(use-package lsp-treemacs + :if (fboundp 'treemacs) + :demand + :after (lsp-mode treemacs)) + +(provide 'earnemod-lsp) +;;; earnemod-lsp.el ends here diff --git a/.config/emacs/modules/editor/earnemod-parens.el b/.config/emacs/modules/editor/earnemod-parens.el new file mode 100644 index 0000000..46f1b11 --- /dev/null +++ b/.config/emacs/modules/editor/earnemod-parens.el @@ -0,0 +1,19 @@ +;;; earnemod-parens.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package smartparens + :demand + :config + ;; Enable globally + (smartparens-global-mode 1) + (show-smartparens-global-mode 1)) + +(use-package rainbow-delimiters + :hook (prog-mode . rainbow-delimiters-mode)) + +(provide 'earnemod-parens) +;;; earnemod-parens.el ends here diff --git a/.config/emacs/modules/lang/earnemod-config.el b/.config/emacs/modules/lang/earnemod-config.el new file mode 100644 index 0000000..0d900dc --- /dev/null +++ b/.config/emacs/modules/lang/earnemod-config.el @@ -0,0 +1,39 @@ +;;; earnemod-config.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: + +;; TOML +(use-package toml-mode) + +;; JSON +(use-package json-mode) + +;; YAML +(use-package yaml-mode + :mode (("\\.yml\\'" . yaml-mode) + ("\\.yaml\\'" . yaml-mode)) + :config + (add-hook 'yaml-mode-hook + '(lambda () + (define-key yaml-mode-map "\C-m" 'newline-and-indent)))) + +;; SSH config files +(use-package ssh-config-mode) + +;; Nginx +(use-package nginx-mode + :config + (setq nginx-indent-tabs-mode t)) + +(use-package company-nginx + :config + (add-hook 'nginx-mode-hook + (lambda () + (add-to-list 'company-backends #'company-nginx)))) + +(provide 'earnemod-config) +;;; earnemod-config.el ends here diff --git a/.config/emacs/modules/lang/earnemod-golang.el b/.config/emacs/modules/lang/earnemod-golang.el new file mode 100644 index 0000000..bfb5157 --- /dev/null +++ b/.config/emacs/modules/lang/earnemod-golang.el @@ -0,0 +1,15 @@ +;;; earnemod-golang.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package go-mode + :mode "\\.go\\'" + :config + ;; Start LSP + (add-hook 'go-mode-hook #'lsp-deferred)) + +(provide 'earnemod-golang) +;;; earnemod-golang.el ends here diff --git a/.config/emacs/modules/lang/earnemod-markdown.el b/.config/emacs/modules/lang/earnemod-markdown.el new file mode 100644 index 0000000..acd3adb --- /dev/null +++ b/.config/emacs/modules/lang/earnemod-markdown.el @@ -0,0 +1,34 @@ +;;; earnemod-markdown.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package markdown-mode + :mode (("README\\.md\\'" . gfm-mode) + ("\\.md\\'" . markdown-mode)) + :config + ;; Hooks: + ;; Visual line wrapping + (add-hook 'markdown-mode-hook 'visual-line-mode) + ;; Font + (add-hook 'markdown-mode-hook 'variable-pitch-mode) + ;; Center text + (add-hook 'markdown-mode-hook 'olivetti-mode) + ;; Line breaks + (add-hook 'markdown-mode-hook 'auto-fill-mode) + + ;; Font settings + (custom-theme-set-faces + 'user + '(markdown-code-face ((t (:inherit fixed-pitch)))) + '(markdown-header-face-1 ((t (:inherit variable-pitch :height 1.9)))) + '(markdown-header-face-2 ((t (:inherit variable-pitch :height 1.7)))) + '(markdown-header-face-3 ((t (:inherit variable-pitch :height 1.55)))) + '(markdown-header-face-4 ((t (:inherit variable-pitch :height 1.4)))) + '(markdown-header-face-5 ((t (:inherit variable-pitch :height 1.3)))) + '(markdown-header-face-6 ((t (:inherit variable-pitch :height 1.25)))))) + +(provide 'earnemod-markdown) +;;; earnecore-markdown.el ends here diff --git a/.config/emacs/modules/lang/earnemod-python.el b/.config/emacs/modules/lang/earnemod-python.el new file mode 100644 index 0000000..91322ee --- /dev/null +++ b/.config/emacs/modules/lang/earnemod-python.el @@ -0,0 +1,18 @@ +;;; earnemod-python.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package elpy + :hook (python-mode . elpy-enable)) + +(use-package blacken + :hook (python-mode . blacken-mode) + :config + ;; Set line length + (setq blacken-line-length '79)) + +(provide 'earnemod-python) +;;; earnemod-python.el ends here diff --git a/.config/emacs/modules/lang/earnemod-rust.el b/.config/emacs/modules/lang/earnemod-rust.el new file mode 100644 index 0000000..2321718 --- /dev/null +++ b/.config/emacs/modules/lang/earnemod-rust.el @@ -0,0 +1,14 @@ +;;; earnemod-rust.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Code: +(use-package rustic + :config + ;; Start LSP + (add-hook 'rustic-mode-hook #'lsp-deferred)) + +(provide 'earnemod-rust) +;;; earnecore-rust.el ends here diff --git a/.config/emacs/modules/lang/earnemod-web.el b/.config/emacs/modules/lang/earnemod-web.el new file mode 100644 index 0000000..51796b6 --- /dev/null +++ b/.config/emacs/modules/lang/earnemod-web.el @@ -0,0 +1,16 @@ +;;; earnemod-web.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;; code: +(use-package web-mode + :mode + "\\.html\\'" + "\\.css\\'") + +(use-package scss-mode) + +(provide 'earnemod-web) +;;; earnemod-web.el ends here diff --git a/.config/emacs/modules/projects/earnemod-treemacs.el b/.config/emacs/modules/projects/earnemod-treemacs.el new file mode 100644 index 0000000..3df6375 --- /dev/null +++ b/.config/emacs/modules/projects/earnemod-treemacs.el @@ -0,0 +1,55 @@ +;;; earnemod-treemacs.el --- Treemacs+Projectile -*- lexical-binding: t; -*- + +;; Copyright (C) 2020-2021 earnest ma +;; SPDX-License-Identifier: MIT +;; Author: earnest ma + +;;; Commentary: + +;; + +;;; Code: +(use-package treemacs + :init + ;; Set persist file per session name + (setq treemacs-persist-file (concat no-littering-var-directory + "treemacs/persist-" + earnemacs-daemon-name ".el")) + :general + (earnemacs-spc-def + "op" 'treemacs) + :config + ;; doom-themes + treemacs <3 (M-x all-the-icons-install-fonts) + (doom-themes-treemacs-config) + + ;; ? + (treemacs-fringe-indicator-mode 'only-when-focused) + + ;; Defer using git to check for modified files + (treemacs-git-mode 'deferred) + + ;; Auto-refresh when files change + (treemacs-filewatch-mode) + + ;; Follow the current file + (setq treemacs-follow-after-init t) + + ;; Set width of buffer + (setq treemacs-width 26) + + ;; Refresh without showing a message + (setq treemacs-silent-refresh t) + + ;; Do not show cursor in buffer + (setq treemacs-show-cursor nil)) + +(use-package treemacs-evil + :demand + :after treemacs) + +(use-package treemacs-projectile + :demand + :after treemacs) + +(provide 'earnemod-treemacs) +;;; earnemod-treemacs.el ends here