Some emacs improvements

This commit is contained in:
Emmet
2024-12-06 10:32:01 -06:00
parent 09708e1b37
commit ad598b4322
2 changed files with 67 additions and 4 deletions

View File

@@ -21,6 +21,8 @@
python python-mode python python-mode
]; ];
}) })
fira-code
nerd-fonts.fira-code
]; ];
home.file.".config/emacs/init.el".source = ./init.el; home.file.".config/emacs/init.el".source = ./init.el;
home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors { home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors {

View File

@@ -23,9 +23,39 @@
(set-fringe-mode 10) ; Give some breathing room (set-fringe-mode 10) ; Give some breathing room
(blink-cursor-mode 0) ; No blinking (blink-cursor-mode 0) ; No blinking
(global-hl-line-mode) ; Where am I? (global-hl-line-mode) ; Where am I?
(pixel-scroll-precision-mode 1) ; This is kinda epic
; (Somewhat) precision scrolling
(pixel-scroll-mode 1)
(pixel-scroll-precision-mode 1)
(setq touch-screen-precision-scroll t)
;; Mouse & Smooth Scroll
;; Scroll one line at a time (less "jumpy" than defaults)
(when (display-graphic-p)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))
mouse-wheel-progressive-speed nil))
(setq scroll-step 1
scroll-margin 1
scroll-conservatively 101)
(global-visual-line-mode 1) ; Visual lines make more sense (global-visual-line-mode 1) ; Visual lines make more sense
;; Garbage collection to speed things up
(add-hook 'after-init-hook
#'(lambda ()
(setq gc-cons-threshold 120000)))
(add-hook 'focus-out-hook 'garbage-collect)
;; auto revert buffers
(setq global-auto-revert-mode t)
(setq auto-revert-use-notify t)
;; For camelCase
(global-subword-mode 1)
;; ripgrep as grep
(setq grep-command "rg -nS --no-heading "
grep-use-null-device nil)
;; I prefer visual lines ;; I prefer visual lines
(setq display-line-numbers-type 'visual (setq display-line-numbers-type 'visual
line-move-visual t) line-move-visual t)
@@ -35,12 +65,13 @@
(set-frame-parameter nil 'alpha-background 85) (set-frame-parameter nil 'alpha-background 85)
(add-to-list 'default-frame-alist '(alpha-background . 85)) (add-to-list 'default-frame-alist '(alpha-background . 85))
(add-to-list 'default-frame-alist '(inhibit-double-buffering . t))
;; Make ESC quit prompts ;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(setq scroll-preserve-screen-position t) (setq scroll-preserve-screen-position nil)
(setq scroll-conservatively 101) (setq redisplay-skip-fontification-on-input t)
(require 'use-package) (require 'use-package)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
@@ -185,7 +216,37 @@
(setq initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name))) (setq initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
(dashboard-setup-startup-hook) (dashboard-setup-startup-hook)
(set-face-attribute 'default nil :height 150) ; Bigger text (set-face-attribute 'default nil :height 150) ; Bigger text
(set-face-attribute 'default nil :family "Intel One Mono")) (when (window-system)
(set-frame-font "FiraCode Nerd Font"))
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
(35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
(36 . ".\\(?:>\\)")
(37 . ".\\(?:\\(?:%%\\)\\|%\\)")
(38 . ".\\(?:\\(?:&&\\)\\|&\\)")
(42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
(43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
(45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
(46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
(47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
(48 . ".\\(?:x[a-zA-Z]\\)")
(58 . ".\\(?:::\\|[:=]\\)")
(59 . ".\\(?:;;\\|;\\)")
(60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
(61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
(62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
(63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
(91 . ".\\(?:]\\)")
(92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
(94 . ".\\(?:=\\)")
(119 . ".\\(?:ww\\)")
(123 . ".\\(?:-\\)")
(124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
(126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)")
)
))
(dolist (char-regexp alist)
(set-char-table-range composition-function-table (car char-regexp)
`([,(cdr char-regexp) 0 font-shape-gstring])))))
; Fix stupid backup confirmations ; Fix stupid backup confirmations
(setq backup-directory-alist '("." "~/.emacs.d/cache/backups")) (setq backup-directory-alist '("." "~/.emacs.d/cache/backups"))