;;; init.el -*- lexical-binding: t; -*-
   (setq inhibit-startup-message t)

    (scroll-bar-mode -1)
    (tool-bar-mode -1)
    (tooltip-mode -1)
    (set-fringe-mode 10)

    (menu-bar-mode -1)
    (blink-cursor-mode -1)
    (column-number-mode +1)

(if (string-equal (system-name) "chris-linuxlaptop")
    (set-face-attribute 'default nil :font "VictorMono Nerd Font" :height 240)
    (set-face-attribute 'default nil :font "VictorMono Nerd Font" :height 120))
  (setq display-line-numbers-type 'relative)

(global-set-key (kbd "<escape>") 'keyboard-escape-quit)

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

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

(straight-use-package 'use-package)

(use-package command-log-mode)

(use-package all-the-icons)

(use-package doom-modeline
  :ensure t
  :init
  (doom-modeline-mode 1)
  (setq doom-modeline-height 35
        doom-modeline-bar-width 3
        all-the-icons-scale-factor 0.9))

(use-package doom-themes
  :ensure t
  :init (load-theme 'doom-snazzy t))

(use-package rainbow-delimiters
  :hook (prog-mode . rainbow-delimiters-mode))

(use-package which-key
  :init (which-key-mode)
  :config
  (setq which-key-idle-delay 0.3))

(use-package evil
  :init
  (setq evil-want-integration t
        evil-want-keybinding nil
        evil-want-C-i-jump nil
        evil-want-C-u-scroll t
        evil-want-C-u-delete t)
  :config
  (evil-mode +1))

(use-package evil-collection
  :after evil
  :config (evil-collection-init))

(use-package general
  :init
  (general-evil-setup)
  :config
  (general-create-definer chris/leader-keys
    :keymaps '(normal visual emacs)
    :prefix "SPC")
  (chris/leader-keys
   "b" '(:ignore t :which-key "buffer")
   "t" '(:ignore t :which-key "toggle")
   "f" '(:ignore t :which-key "file")
   "w" '(:ignore t :which-key "window")
   "s" '(:ignore t :which-key "search")
   "o" '(:ignore t :which-key "open")
   "bs" '(consult-buffer :which-key "buffer search")
   "tt" '(consult-theme :which-key "choose theme")
   "ff" '(find-file :which-key "find file")
   "fs" '(save-buffer :which-key "save")
   "od" '(dired-jump :which-key "dired jump")
   "ss" '(consult-line :which-key "consult search")
   "ww" '(other-window :which-key "other window")
   ))

(use-package evil-escape
  :after evil
:init (evil-escape-mode +1)
:config (setq evil-escape-key-sequence "fd"))

(use-package selectrum
  :init
  (selectrum-mode +1)
  :config
  (general-define-key
   :keymaps 'selectrum-minibuffer-map
   "C-j" 'selectrum-next-candidate
   "C-k" 'selectrum-previous-candidate
   "C-S-j" 'selectrum-goto-end
   "C-S-k" 'selectrum-goto-beginning
   "TAB" 'selectrum-insert-current-candidate))

(use-package prescient
  :config
  (prescient-persist-mode +1))

(use-package consult)

;; Enable richer annotations using the Marginalia package
(use-package marginalia
  :bind (:map minibuffer-local-map
         ("C-M-a" . marginalia-cycle)
         ;; :map embark-general-map
         ;;     ("A" . marginalia-cycle)
         )

  ;; The :init configuration is always executed (Not lazy!)
  :init

  ;; Must be in the :init section of use-package such that the mode gets
  ;; enabled right away. Note that this forces loading the package.
  (marginalia-mode)

  ;; When using Selectrum, ensure that Selectrum is refreshed when cycling annotations.
  (advice-add #'marginalia-cycle :after
              (lambda () (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))))

  ;; Prefer richer, more heavy, annotations over the lighter default variant.
  (setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)))

(use-package helpful
  :config
  )

(use-package org
  :config
  (setq org-startup-indented t)
  (defun chris/org-babel-tangle-config ()
    (when (string-equal (buffer-file-name)
                        (expand-file-name "~/.personal-emacs/init.org"))
    (let ((org-confirm-babel-evaluate nil))
    (org-babel-tangle))))

  (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config))))

(use-package magit
    :commands (magit-status magit-get-current-branch)
  :custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))