diff options
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r-- | .emacs.d/init.el | 190 |
1 files changed, 36 insertions, 154 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 248abcb..c0fd0fa 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1,111 +1,35 @@ +;; package.el +(require 'package) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) -;; Do not persist customizations -(setq custom-file (make-temp-file "emacs-custom-")) - -;; Place backups in ~/.backups/ directory, like a civilized program. -;; ------ (if (file-directory-p "~/.backup") (setq backup-directory-alist '(("." . "~/.backup"))) (message "Directory does not exist: ~/.backup")) -(filesets-init) - -(setq backup-by-copying t ; Don't delink hardlinks - delete-old-versions t ; Clean up the backups - version-control t ; Use version numbers on backups, - kept-new-versions 3 ; keep some new versions - kept-old-versions 2) ; and some old ones, too - -;; --------- -;; Generic keybindings -;; --------- -(global-set-key (kbd "C-c d") 'diff-buffer-with-file) -(global-set-key (kbd "C-c R") 'revert-buffer) -(global-set-key (kbd "C-c w") 'whitespace-cleanup) - -(global-set-key (kbd "C-c b s") 'bookmark-set) -(global-set-key (kbd "C-c b j") 'bookmark-jump) - -(global-set-key (kbd "<f12>") 'compile) - -(defun help/insert-em-dash () - "Inserts an EM-DASH (not a HYPEN, not an N-DASH)" - (interactive) - (insert "—")) - -(global-set-key (kbd "C--") #'help/insert-em-dash) - -;; ------ -;; General config -;; ------ - -(setq fill-column 79) - -;; Make sure that pressing middle mouse button pastes right at point, -;; not where the mouse cursor is. -(setq mouse-yank-at-point t) - -(setq column-number-mode 1) -(setq line-number-mode 1) -(setq-default indent-tabs-mode nil) -(setq-default tab-width 4) - -(setq-default c-basic-offset 4) - -;; ------ -;; Initialize environment -;; ------ +(setq + backup-by-copying t ; Don't delink hardlinks + delete-old-versions t ; Clean up the backups + kept-new-versions 3 ; keep some new versions + kept-old-versions 2 ; and some old ones, too + version-control t) ; Use version numbers on backups -(setenv "TMPDIR" (concat (getenv "HOME") "/tmp")) -(add-hook 'after-init-hook #'server-start) - -;; ------ -;; Helper for compilation. -;; ------ -;; Close the compilation window if there was no error at all. -(defun compilation-exit-autoclose (status code msg) - ;; If M-x compile exists with a 0 - (when (and (eq status 'exit) (zerop code)) - ;; then bury the *compilation* buffer, so that C-x b doesn't go there - (bury-buffer) - ;; and delete the *compilation* window - (delete-window (get-buffer-window (get-buffer "*compilation*")))) - ;; Always return the anticipated result of compilation-exit-message-function - (cons msg code)) +;; Do not persist customizations +(setq custom-file (make-temp-file "emacs-custom-")) -;; Specify my function (maybe I should have done a lambda function) -(setq compilation-exit-message-function 'compilation-exit-autoclose) -(setq compilation-read-command nil) +(setq fill-column 79) ; Wrap lines +(setq mouse-yank-at-point t) ; Do not follow mouse curors when mouse-yanking -;; Themes -(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") +(setq-default indent-tabs-mode nil) ; No tabs when indenting +(setq-default tab-width 4) ; How many spaces a tab represents -;; Remove scratch message (setq initial-scratch-message "") -;; Ask y or n instead of yes or no (defalias 'yes-or-no-p 'y-or-n-p) -;; Fancier buffer selection -(global-set-key (kbd "C-x C-b") 'bs-show) - -;;; Stefan Monnier <foo at acm.org>. It is the opposite of fill-paragraph -(defun unfill-paragraph (&optional region) - "Takes a multi-line paragraph and makes it into a single line of text." - (interactive (progn (barf-if-buffer-read-only) '(t))) - (let ((fill-column (point-max)) - ;; This would override `fill-column' if it's an integer. - (emacs-lisp-docstring-fill-column t)) - (fill-paragraph nil region))) - -;; Handy key definition -(define-key global-map "\M-Q" 'unfill-paragraph) - ;; Only flash the mode line (setq ring-bell-function (lambda () @@ -119,87 +43,45 @@ (setq show-paren-delay 0) (show-paren-mode 1) -;; Save what you enter into minibuffer prompts -(setq history-length 25) -(savehist-mode 1) - -;; Remember and restore cursor information -(save-place-mode 1) - -;; Desktop -(setq desktop-path `(,user-emacs-directory)) -(setq desktop-base-file-name "desktop") -(desktop-save-mode 1) +(savehist-mode 1) ; Save histories, including minibuffer -;; Set this to t if you don't understand what it means -(setq vc-follow-symlinks nil) +(save-place-mode 1) ; Remember and restore cursor information -;; dired -(use-package dired-preview - :ensure t - :config +(setq auto-save-no-message t) ; Do not print a message when auto-saving - (setq dired-preview-delay 0.3) - (setq dired-preview-max-size (expt 2 20)) - (setq dired-preview-ignored-extensions-regexp - (concat "\\." - "\\(mkv\\|webm\\|mp4\\|mp3\\|ogg\\|m4a" - "\\|gz\\|zst\\|tar\\|xz\\|rar\\|zip" - "\\|iso\\|epub\\|pdf\\)")) +(pixel-scroll-precision-mode 1) ; Precision scrolling - (dired-preview-global-mode 1)) +;; Server +(require 'server) +(setq server-client-instructions nil) ; Keep it quiet when opening an ec -(add-hook 'dired-mode-hook #'dired-hide-details-mode) +(unless (server-running-p) + (server-start)) -(setq dired-guess-shell-alist-user - '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open") - ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open") - (".*" "xdg-open"))) - -;;; Icons -(use-package nerd-icons :ensure t ) -(use-package nerd-icons-dired :ensure t - :config - (add-hook 'dired-mode-hook #'nerd-icons-dired-mode) - ) - -(dolist (path '("~/.emacs.d/rul-lisp/config" "~/.emacs.d/rul-lisp/packages")) +(dolist (path '("~/.emacs.d/rul-lisp/packages")) (add-to-list 'load-path path)) -(pixel-scroll-precision-mode 1) +(when-let* ((file (locate-user-emacs-file "rul-pre-init.el")) + ((file-exists-p file))) + (load-file file)) +(require 'rul-themes) +(require 'rul-bindings) (require 'rul-completion) -(require 'rul-prog) -(require 'rul-elfeed) +(require 'rul-fm) +(require 'rul-fonts) +(require 'rul-io) +(require 'rul-mail) (require 'rul-modeline) -(require 'rul-media) (require 'rul-org) +(require 'rul-prog) +(require 'rul-terminals) +(require 'rul-vc) (require 'rul-wm) (require 'rul-write) -(load-file "~/.emacs.d/rul-init.d/fonts.el") -(load-file "~/.emacs.d/rul-init.d/themes.el") - -;; Init parts (will be deprecated in favor of packages) -(load-file "~/.emacs.d/rul-init.d/auto-fill.el") -(load-file "~/.emacs.d/rul-init.d/flycheck.el") -(load-file "~/.emacs.d/rul-init.d/flyspell.el") -(load-file "~/.emacs.d/rul-init.d/go-lang.el") -(load-file "~/.emacs.d/rul-init.d/hydra.el") -(load-file "~/.emacs.d/rul-init.d/ibuffer.el") -(load-file "~/.emacs.d/rul-init.d/imenu.el") -(load-file "~/.emacs.d/rul-init.d/latex.el") -(load-file "~/.emacs.d/rul-init.d/logos.el") -(load-file "~/.emacs.d/rul-init.d/magit.el") -(load-file "~/.emacs.d/rul-init.d/mail-mode.el") -(load-file "~/.emacs.d/rul-init.d/markdown.el") -(load-file "~/.emacs.d/rul-init.d/notmuch.el") -(load-file "~/.emacs.d/rul-init.d/vterm.el") -(load-file "~/.emacs.d/rul-init.d/which-key.el") - (when-let* ((file (locate-user-emacs-file "rul-post-init.el")) ((file-exists-p file))) (load-file file)) ;; init.el ends here -(put 'dired-find-alternate-file 'disabled nil) |