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

(defun my/copy-char ()
  (interactive)
  "Puts a unicode character into the clipboard."
  (kill-new
   (make-string 1
		(read-char-by-name "Copy character (Unicode or hex):"))))

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

(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)

(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)

(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)

(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 ring-bell-function 'ignore)

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

(use-package diminish)

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

(use-package emacs
  :hook
  ((prog-mode . electric-pair-mode))
  :bind
  (("C-x C-c" . nil)
   ("C-x R" . restart-emacs)
   ("C-c c c" . calc)
   ("C-c c f" . full-calc)
   ("C-x 8 S-<return>" . my/copy-char)))

(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
  :diminish which-key-mode
  :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")))

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

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

