 ;; Automatically update buffers if file content on disk has changes
 (global-auto-revert-mode t)
 
-;; Hilight the current line
-;; (global-hl-line-mode 1)
-
-;;; ————— Disable unnecessary UI elements —————
-
 ;; Don't show the menu bar, except on macOS. On macOS the menu bar doesn't take
 ;; up any additional screen real estate, so there's no harm in keeping it.
 (when (not (eq system-type 'darwin))

(setq-default inhibit-startup-message t)

;; Don't put 'customize' config in init.el; git it another file
(setq-default custom-file "~/.config/emacs/custom-file.el")

;; 72 is too narrow
(setq-default fill-column 80)

;; TODO: Don't use hard tabs? I haven't had this set and haven't noticed any
;; issues. I think most modes are sane and use spaces. Is this necessary?
; (setq-default indent-tabs-mode nil)

;; Don't litter backup files everywhere. Contain them to a directory in .config
(setq-default backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))))

  (setq company-idle-delay 0.3)
  (global-company-mode t))

;;; ---------- Completion ----------

(unless (package-installed-p 'vertico)
  (package-install 'vertico))

(vertico-mode t)

(unless (package-installed-p 'consult)
  (package-install 'consult))

(global-set-key [rebind switch-to-buffer] #'consult-buffer)

(setq read-buffer-completion-ignore-case t
      read-file-name-completion-ignore-case t
      completion-ignore-case t)

;;; ---------- LSP support ----------

(unless (package-installed-p 'eglot)
  (package-install 'eglot))

(add-hook 'prog-mode-hook #'eglot-ensure)

(add-hook 'prog-mode-hook #'flymake-mode)

;;; ---------- Source control ----------

(unless (package-installed-p 'magit)
  (package-install 'magit))

(global-set-key (kbd "C-c g") #'magit-status)

(unless (package-installed-p 'diff-hl)
  (package-install 'diff-hl))

(add-hook 'prog-mode-hook #'diff-hl-mode)

;;; ---------- Markdown support ----------

(unless (package-installed-p 'markdown-mode)
  (package-install 'markdown-mode))

(line-number-mode 1)

