;; Add melpa
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)

;; Add straight
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        (or (bound-and-true-p straight-base-dir)
            user-emacs-directory)))
      (bootstrap-version 7))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

;; Set theme
(straight-use-package 'catppuccin-theme)
(load-theme 'catppuccin :no-confirm)

;; Evil
(unless (package-installed-p 'evil)
  (package-install 'evil))

(require 'evil)
(evil-mode 1)

;; VTerm
(use-package vterm
    :ensure t)

(add-hook 'vterm-mode-hook (lambda () (setq evil-default-state 'emacs)))

;; Nix Mode
(unless (package-installed-p 'nix-mode)
  (package-install 'nix-mode))

;; Remove bars
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

;; Remove startup message
(setq inhibit-startup-message t)

;; Display line number
(global-display-line-numbers-mode 1)
(setq display-line-numbers-type 'relative)

;; Keybinds
(keymap-global-set "C-x t" 'vterm)

