commit 1b262f0cf6acb518d0712e5f0b65c8bbe65f59fb Author: Lorenzo Good Date: Sat Dec 27 23:46:15 2025 -0600 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da643e0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +/.cache/ +/eln-cache/ +/elpa/ +/history +/transient/ +/auto-save-list/ +/eshell/ +/projects +emacs-backup +server +tree-sitter/ +session.* +irony/ +.lsp-session* +/projectile-bookmarks.eld \ No newline at end of file diff --git a/early-init.el b/early-init.el new file mode 100644 index 0000000..2e0df0e --- /dev/null +++ b/early-init.el @@ -0,0 +1,20 @@ +;; Turn off gc during startup. +(setq gc-cons-threshhold most-positive-fixnum) + +;; Put gc back. +(add-hook 'emacs-startup-hook + (lambda () (setq gc-cons-threshold 10000000))) + +;; Turn off annoying logs. +(setq byte-compile-warnings '(not obsolete)) +(setq warning-suppress-log-types '((comp) (bytecomp))) +(setq native-comp-async-report-warnings-errors 'silent) +(setq inhibit-startup-echo-area-message (user-login-name)) + +(setq frame-resize-pixelwise t) +(tool-bar-mode -1) +(menu-bar-mode -1) +(setq default-frame-alist '((fullscreen . maximized) + (background-color . "#000000") + (ns-appearance . dark) + (ns-transparent-titlebar . t))) diff --git a/init.el b/init.el new file mode 100644 index 0000000..e03b6ba --- /dev/null +++ b/init.el @@ -0,0 +1,224 @@ +(with-eval-after-load 'package + (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)) + +(setopt inhibit-splash-screen t) + +;; Don't litter. +(setopt make-backup-files nil) +(setopt create-lockfiles nil) + +;; Ensure that scratch starts in fundamental-mode. +(setopt initial-major-mode 'fundamental-mode) + +;; Don't show load average in modeline. +(setopt display-time-default-load-average nil) + +;; Automatically reread from disk if the underlying file changes. +(setopt auto-revert-avoid-polling t) +(setopt auto-revert-interval 5) +(setopt auto-revert-check-vc-info t) +(global-auto-revert-mode) + +;; Save history in EMACS DIR. +(savehist-mode) + +;; Setup ctrl+arrowkey to move between emacs defined windows. Will try to make vim-like at some point. +(windmove-default-keybindings 'control) + +;; Define killing current buffer using C-x c. +(global-set-key (kbd "C-x c") #'kill-this-buffer) + +;; Some legacy shit. +(setopt sentence-end-double-space nil) + +(defun foehammer--backup-file-name (fpath) + "Return a new file path of a given file path. +If the new path's directories does not exist, create them." + (let* ((backupRootDir "~/.emacs.d/emacs-backup/") + (filePath (replace-regexp-in-string "[A-Za-z]:" "" fpath )) ; remove Windows driver letter in path + (backupFilePath (replace-regexp-in-string "//" "/" (concat backupRootDir filePath "~") ))) + (make-directory (file-name-directory backupFilePath) (file-name-directory backupFilePath)) + backupFilePath)) + +(setopt make-backup-file-name-function 'foehammer--backup-file-name) + +;; Globally escape. +(global-set-key (kbd "") 'keyboard-escape-quit) + +(use-package which-key + :ensure t + :config + (which-key-mode)) + +(use-package evil + :ensure t + + :init + (setq evil-respect-visual-line-mode t) + (setq evil-undo-system 'undo-redo) + + (setq evil-want-C-u-scroll t) + + :config + (evil-mode) + (define-key evil-normal-state-map (kbd "C-v") 'evil-visual-block) + (define-key evil-visual-state-map (kbd "C-v") 'evil-visual-block) + (evil-set-initial-state 'vterm-mode 'emacs) +) + +(use-package cua-base + :ensure nil + :config + (define-key evil-insert-state-map (kbd "C-S-v") 'cua-paste) + (define-key evil-normal-state-map (kbd "C-S-v") 'cua-paste) + (define-key evil-visual-state-map (kbd "C-S-v") 'cua-paste)) + +(setopt enable-recursive-minibuffers t) +(setopt completion-cycle-threshold 1) +(setopt completions-detailed t) +(setopt tab-always-indent 'complete) +(setopt completion-styles '(basic initials substring)) +(setopt completion-auto-help 'always) +(setopt completions-max-height 20) +(setopt completions-detailed t) +(setopt completions-format 'one-column) +(setopt completions-group t) +(setopt completion-auto-select 'second-tab) ; Much more eager +(setopt completion-auto-select t) ; See `C-h v completion-auto-select' for more possible values + +(keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) + +;; Interface Things. +(setopt line-number-mode t) +(setopt column-number-mode t) + +(setopt scroll-margin 10) +(setq scroll-conservatively 10) + +(setopt x-underline-at-descent-line nil) +(setopt switch-to-buffer-obey-display-actions t) +(setopt show-trailing-whitespace t) +(setopt indicate-buffer-boundaries 'left) + +(blink-cursor-mode -1) ; Steady cursor +(pixel-scroll-precision-mode) ; Smooth Scrolling. + +;; Line number displays. +(add-hook 'prog-mode-hook 'display-line-numbers-mode) +(setopt display-line-numbers-width 1) + +(add-hook 'text-mode-hook 'visual-line-mode) + +(let ((hl-line-hooks '(text-mode-hook prog-mode-hook))) + (mapc (lambda (hook) (add-hook hook 'hl-line-mode)) hl-line-hooks)) + +(setopt tab-bar-show 1) + +;; Gruvbox theme. +(setq custom-safe-themes t) +(use-package gruvbox-theme + :ensure t + :init + (load-theme 'gruvbox-dark-medium) +) + +(use-package vertico + :ensure t + :init + (vertico-mode)) + +(use-package vertico-directory + :after vertico + :bind (:map vertico-map + ("M-DEL" . vertico-directory-delete-word))) + + +(use-package marginalia + :ensure t + :config + (marginalia-mode)) + +;; Special, telescope-like bindings. +(use-package consult + :ensure t + :bind ( + ("C-x b" . consult-buffer) ; orig. switch-to-buffer + ("M-y" . consult-yank-pop) ; orig. yank-pop + ("M-s r" . consult-ripgrep) + ("M-s l" . consult-line) + ("C-s" . consult-line) + ("M-s s" . consult-line) ; consult-line instead of isearch, bind + ("M-s L" . consult-line-multi) ; isearch to M-s s + ("M-s o" . consult-outline) + :map isearch-mode-map + ("M-e" . consult-isearch-history) ; orig. isearch-edit-string + ("M-s e" . consult-isearch-history) ; orig. isearch-edit-string + ("M-s l" . consult-line) ; needed by consult-line to detect isearch + ("M-s L" . consult-line-multi) ; needed by consult-line to detect isearch + ) + :config + (setq consult-narrow-key "<")) + +;; Magit: +(use-package magit + :ensure t + :bind (("C-x g" . magit-status))) + +;; Completion: +(use-package company + :ensure t + :config (global-company-mode)) + +;; Language specific major modes. +(use-package markdown-mode + :ensure t + :hook ((markdown-mode . visual-line-mode))) + +(use-package yaml-mode + :ensure t) + +(use-package nix-mode + :ensure t) + +(use-package json-mode + :ensure t) + +(use-package projectile + :ensure t + :config + (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) + (projectile-mode)) + +(use-package eshell + :init + (defun foehammer/setup-eshell () + ;; Something funny is going on with how Eshell sets up its keymaps; this is + ;; a work-around to make C-r bound in the keymap + (keymap-set eshell-mode-map "C-r" 'consult-history)) + :hook ((eshell-mode . foehammer/setup-eshell))) + +;; Eat: Emulate A Terminal +(use-package eat + :ensure t + :custom + (eat-term-name "xterm") + :config + (eat-eshell-mode) + (eat-eshell-visual-command-mode)) + +;; Don't change this (or else gg). +(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. + '(package-selected-packages + '(company consult corfu-candidate-overlay corfu-terminal eat evil + gruvbox-theme json-mode lsp-mode magit marginalia + nix-mode projectile vertico yaml-mode))) +(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/projectile-bookmarks.eld b/projectile-bookmarks.eld new file mode 100644 index 0000000..dd262c6 --- /dev/null +++ b/projectile-bookmarks.eld @@ -0,0 +1 @@ +("~/.emacs.d/" "~/src/personal/servers/") \ No newline at end of file