.emacs.d/init.el
2025-06-10 10:44:45 +02:00

134 lines
3.6 KiB
EmacsLisp

;;; -*- lexical-binding: t -*-
;; supress nativecomp warnings
(setq native-comp-async-report-warnings-errors 'silent)
;; I use custom vars for local config, so let's put them to separate
;; file, where it's easier for git to ignore it
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)
;; straight.el bootstrap
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
;; compile angel
(use-package compile-angel
:when (native-comp-available-p)
:straight t
:demand t
:config
(setq compile-angel-verbose t)
(compile-angel-on-load-mode))
;;; basic interface stuff
(menu-bar-mode 1)
(global-display-line-numbers-mode -1)
(column-number-mode 1)
(setq inhibit-startup-screen t)
(setq-default indicate-buffer-boundaries 'left)
(setq auto-save-default nil)
(setq visible-bell t)
;; TODO Proper graphical setup
(add-hook 'after-make-frame-functions
#'(lambda (frame)
(toggle-scroll-bar -1)
(tool-bar-mode -1)))
;;; improvements to compilation buffer
(require 'compile)
(setq compilation-scroll-output t)
(require 'ansi-color)
(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
;;; override default annoyances
;; I'm the only cowboy on this mainframe
;; (setq create-lockfiles nil)
;; X is dead
(setq inhibit-x-resources t)
;; use ibuffer instead of standard buffer list
(global-set-key (kbd "C-x C-b") 'ibuffer)
(fset 'yes-or-no-p 'y-or-n-p)
(setq confirm-nonexistent-file-or-buffer nil)
;; let's delete a tab as a whole...
(setq backward-delete-char-untabify-method 'nil)
;;; identation holywar contribution
(setq-default indent-tabs-mode 'nil)
;; highlight the parens
(setq show-paren-delay 0)
(show-paren-mode 1)
;; follow symlinks to version-controlled files
(setq vc-follow-symlinks t)
;; backup management
(setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;; default frame size
(add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 107))
(if (eq system-type 'gnu/linux)
(pixel-scroll-precision-mode t))
;; Stolen from https://github.com/rexim/dotfiles
(defun rc/duplicate-line ()
"Duplicate current line"
(interactive)
(let ((column (- (point) (point-at-bol)))
(line (let ((s (thing-at-point 'line t)))
(if s (string-remove-suffix "\n" s) ""))))
(move-end-of-line 1)
(newline)
(insert line)
(move-beginning-of-line 1)
(forward-char column)))
(global-set-key (kbd "C-,") 'rc/duplicate-line)
;; faster window switch
(global-set-key (kbd "C-;") #'other-window)
;; my personal keymap
(define-prefix-command 'oxamap)
(global-set-key (kbd "C-z") 'oxamap)
;; bind compile
(define-key 'oxamap (kbd "c") 'compile)
;;; tabs hooks
(defun tabs-yay ()
"Function to enable tab indentation in buffer."
(setq indent-tabs-mode t))
(add-hook 'c-mode-hook 'tabs-yay)
;;; Monday is the fist day of the week
(require 'calendar)
(setq calendar-week-start-day 1)
(custom-set-variables
'(whitespace-style
(quote
(face tabs spaces trailing space-before-tab newline indentation empty space-after-tab tab-mark))))
(load "~/.emacs.d/packages")