diff --git a/README.md b/README.md index 506677f..68aa75c 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,21 @@ You can also use the [vim-tab-bar](https://github.com/jamescherti/vim-tab-bar.el (vim-tab-bar-mode 1)) ``` +You can also install `vdiff`, which provides Vimdiff-like functionality for Emacs. +``` emacs-lisp +(use-package vdiff + :ensure t + :defer t + :commands (vdiff-buffers + vdiff-buffers3 + vdiff-quit + vdiff-files + vdiff-files3) + :custom + (vdiff-auto-refine t) + (vdiff-only-highlight-refinements t)) +``` + ### Automatically compile Emacs Lisp code (auto-compile) The auto-compile package automates the byte-compilation of Emacs Lisp files, ensuring that your code runs more efficiently by converting it to byte-code. This process reduces the load time and execution time of your Emacs configuration and other Lisp files, leading to faster performance. Additionally, auto-compile helps maintain an up-to-date and optimized configuration by recompiling files automatically when they are saved, eliminating the need for manual compilation and minimizing potential issues caused by outdated byte-code. @@ -178,6 +193,8 @@ To activate gcmh-mode, add the following to the beginning of `~/.emacs.d/post-in :ensure t :hook (after-init . gcmh-mode) :custom + (gcmh-idle-delay 'auto) + (gcmh-auto-idle-delay-factor 10) (gcmh-low-cons-threshold minimal-emacs-gc-cons-threshold)) ``` diff --git a/early-init.el b/early-init.el index ea020c7..7fca81e 100644 --- a/early-init.el +++ b/early-init.el @@ -39,6 +39,8 @@ (set-language-environment "UTF-8") +(setq custom-theme-directory (expand-file-name "themes/" user-emacs-directory)) + ;; Set-language-environment sets default-input-method, which is unwanted. (setq default-input-method nil) diff --git a/init.el b/init.el index a89a04d..e3918b3 100644 --- a/init.el +++ b/init.el @@ -54,7 +54,10 @@ (require 'use-package)) ;;; Misc + +;; Allow nested minibuffers (setq enable-recursive-minibuffers t) + (setq custom-file (expand-file-name "custom.el" minimal-emacs--default-user-emacs-directory)) @@ -62,6 +65,29 @@ ;; switch-to-buffer runs pop-to-buffer-same-window instead (setq switch-to-buffer-obey-display-actions t) +;; Keep the cursor out of the read-only portions of the.minibuffer +(setq minibuffer-prompt-properties + '(read-only t intangible t cursor-intangible t face + minibuffer-prompt)) +(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + +(setq show-paren-delay 0.1 + show-paren-highlight-openparen t + show-paren-when-point-inside-paren t + show-paren-when-point-in-periphery t) + +(setq whitespace-line-column nil) ; whitespace-mode + +;; I reduced the default value of 9 to simplify the font-lock keyword, +;; aiming to improve performance. This package helps differentiate +;; nested delimiter pairs, particularly in languages with heavy use of +;; parentheses. +(setq rainbow-delimiters-max-face-count 5) + +;; Can be activated with `display-line-numbers-mode' +(setq-default display-line-numbers-width 3) +(setq-default display-line-numbers-widen t) + ;;; Files ;; Disable the warning "X and Y are the same file". Ignoring this warning is @@ -73,6 +99,27 @@ (setq find-file-visit-truename t vc-follow-symlinks t) +;; Skip confirmation prompts when creating a new file or buffer +(setq confirm-nonexistent-file-or-buffer nil) + +(setq uniquify-buffer-name-style 'forward) + +(setq mouse-yank-at-point t) + +(setq frame-title-format '("%b – Emacs") + icon-title-format frame-title-format) + +;; Prefer vertical splits over horizontal ones +(setq split-width-threshold 170 + split-height-threshold nil) + +;; The native border "uses" a pixel of the fringe on the rightmost +;; splits, whereas `window-divider` does not. +(setq window-divider-default-bottom-width 1 + window-divider-default-places t + window-divider-default-right-width 1) +(add-hook 'after-init-hook #'window-divider-mode) + ;;; Backup files ;; Avoid generating backups or lockfiles to prevent creating world-readable @@ -97,9 +144,9 @@ ;; auto-saved data. (setq auto-save-default t) -;; Do not auto-disable auto-save after deleting large chunks of text. The -;; purpose of auto-save is to provide a failsafe, and disabling it contradicts -;; this objective. +;; Do not auto-disable auto-save after deleting large chunks of +;; text. The purpose of auto-save is to provide a failsafe, and +;; disabling it contradicts this objective. (setq auto-save-include-big-deletions t) (setq auto-save-list-file-prefix @@ -111,9 +158,11 @@ (setq kill-buffer-delete-auto-save-files t) ;;; Auto revert -(setq auto-revert-stop-on-user-input nil - auto-revert-use-notify nil - revert-without-query (list ".") ; Do not prompt +;; Auto-revert in Emacs is a feature that automatically updates the +;; contents of a buffer to reflect changes made to the underlying file +;; on disk. +(setq revert-without-query (list ".") ; Do not prompt + auto-revert-stop-on-user-input nil auto-revert-verbose t) ;;; recentf @@ -121,6 +170,7 @@ ;; accessed files, making it easier to reopen files you have worked on ;; recently. (setq recentf-max-saved-items 300) ; default is 20 +(setq recentf-auto-cleanup 'mode) (add-hook 'after-init-hook #'recentf-mode) ;;; savehist @@ -129,8 +179,9 @@ ;;; Subr ;; Allow for shorter responses: "y" for yes and "n" for no. -(setq use-short-answers t) -(defalias #'yes-or-no-p 'y-or-n-p) +(if (boundp 'use-short-answers) + (setq use-short-answers t) + (advice-add #'yes-or-no-p :override #'y-or-n-p)) (defalias #'view-hello-file #'ignore) ; Never show the hello file ;;; Mule-util @@ -244,6 +295,15 @@ ;; Remove duplicates from the kill ring to reduce clutter (setq kill-do-not-save-duplicates t) +;;; ansi-color +(setq comint-prompt-read-only t) +(setq comint-buffer-maximum-size 2048) + +;;; compile +(setq compilation-always-kill t + compilation-ask-about-save nil + compilation-scroll-output 'first-error) + ;;; Load post-init.el (minimal-emacs-load-user-init "post-init.el")