(defun my/load-config-file (filename)
  (load-file (expand-file-name filename user-emacs-directory)))
(my/load-config-file "straight-bootstrap.el")

(straight-use-package 'org)		; org complains about this for some reason

(setopt inhibit-splash-screen t)
(setopt make-backup-files nil)
(setopt auto-save-default nil)
(setopt create-lockfiles nil)

(setopt initial-major-mode 'fundamental-mode)

(setopt auto-revert-avoid-polling t)
(setopt auto-revert-interval 5)
(setopt auto-revert-check-vc-info t)
(global-auto-revert-mode)

(windmove-default-keybindings 'control)

(setopt sentence-end-double-space nil)
(cua-mode 1)

(menu-bar-mode -1)

(setopt enable-recursive-minibuffers t)
(setopt completion-cycle-threshold 1)
(setopt completions-detailed t)
(setopt tab-always-indent 'complete)

(setopt completion-auto-help 'always)
(setopt completions-max-height 20)
(setopt completions-format 'one-column)
(setopt completion-auto-select 'second-tab)
(setopt kill-whole-line t)

(keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete)

(setopt line-number-mode t)
(setopt column-number-mode t)

(setopt x-underline-at-descent-line nil)
(setopt switch-to-buffer-obey-display-actions t)

(setopt mouse-wheel-tilt-scroll t)
(setopt mouse-wheel-flip-direction t)

(blink-cursor-mode -1)
(pixel-scroll-precision-mode)

(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'text-mode-hook 'display-line-numbers-mode)
(setopt display-line-numbers-width 3)

(add-hook 'text-mode-hook 'visual-line-mode)

(let ((hl-line-hooks '(text-mode-hook prog-mode-hook)))
  (mapc (lambda (hook) (add-hook hook 'hl-line-mode)) hl-line-hooks))

(setopt tab-bar-show 1)

(add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append)
(add-to-list 'tab-bar-format 'tab-bar-format-global 'append)

(setopt straight-use-package-by-default t)

(use-package gcmh
  :config
  (gcmh-mode 1))

(use-package emacs
  :hook
  ((prog-mode . electric-pair-mode))
  :bind
  (("C-c c c" . calc)
   ("C-c c f" . full-calc))
  :config
  (load-theme 'modus-operandi-tinted t))

(use-package consult
  :bind
  (("C-x b" . consult-buffer)
   ("C-s"   . consult-line)))

(use-package orderless
  :custom
  (completion-styles '(orderless))
  (completion-category-overrides '((file (styles partial-completion)))))

(use-package which-key
  :config
  (which-key-mode))

(use-package marginalia
  :config
  (marginalia-mode))

(use-package vertico
  :init
  (vertico-mode))

(use-package eat
  :custom
  (eat-term-name "xterm")
  :bind
  (("C-c t" . eat))
  :config
  (eat-eshell-mode)
  (eat-eshell-visual-command-mode))

(use-package no-littering
  :custom
  (custom-file (no-littering-expand-etc-file-name "custom.el")))

(use-package org-publish-rss
  :straight (org-publish-rss :type git :host nil
			     :repo "https://git.sr.ht/~taingram/org-publish-rss"))

(my/load-config-file "writing.el")
(my/load-config-file "code.el")
