Skip to content

Instantly share code, notes, and snippets.

@bebyx
Last active October 8, 2026 15:56
Show Gist options
  • Select an option

  • Save bebyx/dde98ee12184cc72fda0f54ccf0988da to your computer and use it in GitHub Desktop.

Select an option

Save bebyx/dde98ee12184cc72fda0f54ccf0988da to your computer and use it in GitHub Desktop.
minimal_init.el
;;; init.el --- Personal Emacs configuration -*- lexical-binding: t; -*-
;; Basic Emacs configuration with minimal UI and key bindings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(message "Emacs initialized with %s" (emacs-version))
(setq emacs-startup-time (current-time))
;;; Code:
;; Keep automatically generated settings separate.
(setq custom-file
(expand-file-name "custom.el" user-emacs-directory))
(load custom-file 'noerror 'nomessage)
;; Basic behaviour.
(setq visible-bell t)
(cua-mode 1)
(column-number-mode 1)
(size-indication-mode 1)
(fringe-mode 14)
;; Minimal interface.
(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(tab-bar-mode -1)
;; Keep the menu bar for now, it is useful while relearning Emacs.
(menu-bar-mode 1)
;; Display line numbers only when editing code, including Emacs Lisp.
(add-hook 'prog-mode-hook #'display-line-numbers-mode)
;; Escape closes prompts and minibuffers.
(global-set-key (kbd "<escape>") #'keyboard-escape-quit)
;; Use a font, falling back if Cascadia Mono is unavailable.
;; Use a font only when it is available.
(when (find-font (font-spec :family "Cascadia Mono"))
(set-face-attribute 'default nil
:family "Cascadia Mono"
:height 180))
;; Remember useful state between sessions.
(savehist-mode 1)
(save-place-mode 1)
(recentf-mode 1)
(desktop-save-mode 1)
;; Reload files changed by external programs.
(global-auto-revert-mode 1)
;; Use the more capable built-in buffer list.
(global-set-key (kbd "C-x C-b") #'ibuffer)
;; Use PowerShell 7 for interactive shell buffers.
(setq explicit-shell-file-name "pwsh.exe")
(setq shell-file-name "pwsh.exe")
(setq shell-command-switch "-Command")
(require 'calendar)
;; Start the week on Monday and use day/month/year dates.
(setq calendar-week-start-day 1)
(calendar-set-date-style 'european)
;; Vienna: approximate coordinates for sunrise/sunset calculations.
(setq calendar-latitude 48.2
calendar-longitude 16.4
calendar-location-name "Wien")
;; Highlight today's date.
(add-hook 'calendar-today-visible-hook #'calendar-mark-today)
;; Store the diary in the Emacs configuration directory.
(setq diary-file (expand-file-name "diary" user-emacs-directory)
calendar-mark-diary-entries-flag t)
(which-key-mode 1)
;; Add MELPA
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")
t)
;; Beautiful dark theme.
(use-package solarized-theme
:ensure t
:init
(setq solarized-distinct-fringe-background t)
:config
(load-theme 'solarized-dark-high-contrast))
(use-package rainbow-delimiters
:ensure t
:hook ((emacs-lisp-mode . rainbow-delimiters-mode)
(scheme-mode . rainbow-delimiters-mode)))
;; Keep Emacs keybindings working with the Ukrainian keyboard layout.
(use-package reverse-im
:ensure t
:custom
(reverse-im-input-methods '("ukrainian-computer"))
:config
(reverse-im-mode 1))
;; Show minibuffer completion candidates vertically.
(use-package vertico
:ensure t
:init
(vertico-mode 1))
;; Add helpful annotations to minibuffer candidates.
(use-package marginalia
:ensure t
:init
(marginalia-mode 1))
(use-package markdown-mode
:ensure t
:mode (("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:config
(setq markdown-fontify-code-blocks-natively t))
(use-package terraform-mode
:ensure t
:mode ("\\.tf\\'" "\\.tfvars\\'"))
(use-package hcl-mode
:ensure t
:mode "\\.hcl\\'")
(use-package magit
:ensure t
:bind (("C-x g" . magit-status)))
;; Mark uncommitted changes beside the affected lines.
(use-package diff-hl
:ensure t
:config
(global-diff-hl-mode 1)
(add-hook 'dired-mode-hook #'diff-hl-dired-mode)
(add-hook 'magit-post-refresh-hook
#'diff-hl-magit-post-refresh))
(use-package treemacs
:ensure t
:bind (("C-c t" . treemacs))
:custom
(treemacs-width 30)
:config
(treemacs-git-mode 'simple)
(treemacs-filewatch-mode 1))
(use-package treemacs-magit
:ensure t
:after (treemacs magit))
(provide 'init)
;;; init.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment