148 lines
4.9 KiB
EmacsLisp

;; -*- lexical-binding: t -*-
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(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))
(straight-use-package 'doom-themes)
(setq custom-safe-themes t)
(custom-set-variables
'(custom-enabled-themes '(doom-palenight)))
(custom-set-faces
'(dashboard-items-face ((t (:inherit widget-button :weight normal)))))
(set-face-attribute 'default nil :family "Fira Code Nerd Font Mono" :height 120)
(setq-default c-basic-offset 4) ;; This is annoying
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq-default line-spacing 5)
(setq indent-line-function #'indent-relative)
(set-default 'truncate-lines t)
(set-default 'truncate-partial-width-windows nil)
(setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t)
(setq evil-want-Y-yank-to-eol t)
(setq evil-disable-insert-state-bindings t)
(setq evil-echo-state nil)
(straight-use-package 'evil)
(straight-use-package 'evil-collection)
(evil-mode t)
(evil-collection-init)
;; TODO: We need 3 bindings; 1.) close buffer 2.) close window 3.) close buffer and window
;; To disable a keybinding just bind it to nil
(evil-set-leader nil (kbd "C-SPC"))
(evil-set-leader 'normal (kbd "SPC"))
(evil-global-set-key 'insert (kbd "C-w") #'evil-delete-backward-word)
(evil-global-set-key 'normal (kbd "C-s") #'save-buffer)
(straight-use-package 'all-the-icons-completion)
(straight-use-package '(vertico :files (:defaults "extensions/*")
:includes (vertico-indexed
vertico-repeat
vertico-directory)))
(vertico-mode)
(define-key vertico-map (kbd "C-w") #'vertico-directory-delete-word)
(vertico-indexed-mode)
(setq vertico-count 17
vertico-resize nil
vertico-cycle t)
(require 'savehist)
(savehist-mode)
(add-hook 'minibuffer-setup-hook #'vertico-repeat-save)
(add-to-list 'savehist-additional-variables 'vertico-repeat-history)
(straight-use-package 'vertico-directory)
(defun embark-which-key-indicator ()
"An embark indicator that displays keymaps using which-key.
The which-key help message will show the type and value of the
current target followed by an ellipsis if there are further
targets."
(lambda (&optional keymap targets prefix)
(if (null keymap)
(which-key--hide-popup-ignore-command)
(which-key--show-keymap
(if (eq (plist-get (car targets) :type) 'embark-become)
"Become"
(format "Act on %s '%s'%s"
(plist-get (car targets) :type)
(embark--truncate-target (plist-get (car targets) :target))
(if (cdr targets) "" "")))
(if prefix
(pcase (lookup-key keymap prefix 'accept-default)
((and (pred keymapp) km) km)
(_ (key-binding prefix 'accept-default)))
keymap)
nil nil t (lambda (binding)
(not (string-suffix-p "-argument" (cdr binding))))))))
(setq embark-indicators
'(embark-which-key-indicator
embark-highlight-indicator
embark-isearch-highlight-indicator))
(defun embark-hide-which-key-indicator (fn &rest args)
"Hide the which-key indicator immediately when using the completing-read prompter."
(which-key--hide-popup-ignore-command)
(let ((embark-indicators
(remq #'embark-which-key-indicator embark-indicators)))
(apply fn args)))
(advice-add #'embark-completing-read-prompter
:around #'embark-hide-which-key-indicator)
(global-set-key (kbd "C-'") #'embark-act)
(straight-use-package 'embark-consult)
(straight-use-package 'marginalia)
(setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
(setq marginalia-align 'right)
(setq marginalia-max-relative-age most-positive-fixnum)
(marginalia-mode)
(define-key minibuffer-local-map (kbd "M-A") #'marginalia-cycle)
(require 'all-the-icons-completion)
(all-the-icons-completion-mode)
(all-the-icons-completion-marginalia-setup)
(add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
(straight-use-package 'orderless)
(setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles basic partial-completion))))
(straight-use-package 'magit)
(defun joe/magit-kill-buffers (param)
"Restore window configuration and kill all Magit buffers."
(let ((buffers (magit-mode-get-buffers)))
(magit-restore-window-configuration)
(mapc #'kill-buffer buffers))
(kill-emacs))
(setq magit-bury-buffer-function #'joe/magit-kill-buffers)
(setq magit-clone-set-remote.pushDefault t)
(setq magit-clone-default-directory "~/Development/")