diff --git a/home/emacs.nix b/home/emacs.nix index 3d9f8b2..824f387 100644 --- a/home/emacs.nix +++ b/home/emacs.nix @@ -1,7 +1,9 @@ { config, pkgs, inputs, nurNoPkgs, ... }: -let pcfg = config.programs.emacs.init.usePackage; -in { +let + pcfg = config.programs.emacs.init.usePackage; +in +{ imports = [ nurNoPkgs.repos.rycee.hmModules.emacs-init ]; programs.emacs.enable = true; @@ -18,84 +20,98 @@ in { recommendedGcSettings = true; usePackageVerbose = false; earlyInit = '' - ; -*-emacs-lisp-*- + ; -*-emacs-lisp-*- ;; Disable Toolbar (tool-bar-mode -1) + ;; Disable scrollbar (scroll-bar-mode -1) + ;; Disable menubar (menu-bar-mode -1) + (setq debug-on-error t) + ;; Use UTF-8 (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (prefer-coding-system 'utf-8) + ;; Minimize native-comp warnings (setq native-comp-async-report-warnings-errors nil) (setq warning-minimum-level 'error) - ''; - prelude = '' - ; -*-emacs-lisp-*- ;; Disable startup message. (setq inhibit-startup-screen t inhibit-startup-echo-area-message (user-login-name)) + + ;; Empty initial scratch buffer. + (setq initial-major-mode 'emacs-lisp-mode + initial-scratch-message nil) + ''; + + prelude = '' + ; -*-emacs-lisp-*- (setq package-archives '(("melpa" . "https://melpa.org/packages/") ("melpa-stable" . "https://stable.melpa.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/") ("nongnu" . "https://elpa.nongnu.org/nongnu/"))) - ;; Empty initial scratch buffer. - (setq initial-major-mode 'emacs-lisp-mode - initial-scratch-message nil) + (setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH"))) + ''; + + postlude = '' + ;-*-emacs-lisp-*- ;; Accept 'y' and 'n' rather than 'yes' and 'no'. (defalias 'yes-or-no-p 'y-or-n-p) + ;; Typically, I only want spaces when pressing the TAB key. I also ;; want 4 of them. (setq-default indent-tabs-mode nil tab-width 4 c-basic-offset 4) + ;; Increase emacs data read limit (default too low for LSP) (setq read-process-output-max (* 1024 1024)) - ''; - postlude = '' - ;-*-emacs-lisp-*- ;; Stop creating backup and autosave files. (setq make-backup-files nil auto-save-default nil) + ;; Always show line and column number in the mode line. (line-number-mode) (column-number-mode) + ;; Soft wrap lines (visual-line-mode) + ;; Use one space to end sentences. (setq sentence-end-double-space nil) - ;; I typically want to use UTF-8. - (prefer-coding-system 'utf-8) + ;; Enable highlighting of current line. (global-hl-line-mode 1) - ;; When finding file in non-existing directory, offer to create the - ;; parent directory. + (defun with-buffer-name-prompt-and-make-subdirs () + "Offer to create parent directory when finding file in a non-existent directory." (let ((parent-directory (file-name-directory buffer-file-name))) (when (and (not (file-exists-p parent-directory)) (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) (make-directory parent-directory t)))) (add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs) - ;; Reduce wrist pain + (global-set-key (kbd "M-n") "~") (global-set-key (kbd "M-N") "`") + ;; Keybind to format/prettify document, uses either format-all or ;; lsp-mode depending on availability (global-set-key (kbd "C-c C-y") 'my/format-document) + ;; Don't warn when cannot guess python indent level (setq-default python-indent-guess-indent-offset-verbose nil) + ;; Disable scroll + C to zoom (global-unset-key (kbd "C-")) (global-unset-key (kbd "C-")) - (load-theme 'doom-gruvbox t) - ''; usePackage = { @@ -183,8 +199,6 @@ in { ''; }; - doom-themes.enable = true; - edit-indirect.enable = true; editorconfig = { @@ -727,6 +741,11 @@ in { ''; }; + solarized-theme = { + enable = true; + init = "(load-theme 'solarized-gruvbox-dark t)"; + }; + swiper = { enable = true; bind = { "C-s" = "swiper"; };