Skip to content

BrandonShega/.emacs.d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

General Settings

Personal

(setq user-full-name "Brandon Shega"
      user-mail-address "[email protected]"
      epa-file-encrypt-to user-mail-address)

Settings

(blink-cursor-mode 0)
(scroll-bar-mode 0)
(tool-bar-mode 0)
(tooltip-mode 0)
(setq inhibit-startup-screen t)
(cd "~/")

Functions

(defun find-config ()
  "Edit config org file"
  (interactive)
  (find-file (expand-file-name "config.org" user-emacs-directory)))

Package Management

Straight.el

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

Use Package

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

Theme

Load the current theme of the day

(use-package doom-themes
  :config
  (load-theme 'doom-dracula t))

(use-package seoul256-theme
  :disabled
  :config
  (load-theme 'seoul256 t))

Packages

General

Evil Leader

(use-package evil-leader
  :init (setq evil-want-C-u-scroll t)
  :config
  (global-evil-leader-mode)
  (evil-leader/set-leader "<SPC>"))

Evil

Evil is an extensible vi layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions.

(use-package evil
  :after evil-leader
  :config
  (evil-mode 1))

General

(use-package general)

Projectile

(use-package projectile
  :config
  (setq projectile-completion-system 'ivy)
  (projectile-mode +1))

Ivy

(use-package counsel
  :init
  (general-def
    [remap apropos]                    #'counsel-apropos
    [remap bookmark-jump]              #'counsel-bookmark
    [remap compile]                    #'+ivy/compile
    [remap describe-bindings]          #'counsel-descbinds
    [remap describe-face]              #'counsel-faces
    [remap describe-function]          #'counsel-describe-function
    [remap describe-variable]          #'counsel-describe-variable
    [remap evil-ex-registers]          #'counsel-evil-registers
    [remap evil-show-marks]            #'counsel-mark-ring
    [remap execute-extended-command]   #'counsel-M-x
    [remap find-file]                  #'counsel-find-file
    [remap find-library]               #'counsel-find-library
    [remap imenu]                      #'counsel-imenu
    [remap info-lookup-symbol]         #'counsel-info-lookup-symbol
    [remap load-theme]                 #'counsel-load-theme
    [remap locate]                     #'counsel-locate
    [remap org-goto]                   #'counsel-org-goto
    [remap org-set-tags-command]       #'counsel-org-tag
    [remap projectile-compile-project] #'+ivy/project-compile
    [remap recentf-open-files]         #'counsel-recentf
    [remap set-variable]               #'counsel-set-variable
    [remap swiper]                     #'counsel-grep-or-swiper
    [remap unicode-chars-list-chars]   #'counsel-unicode-char
    [remap yank-pop]                   #'counsel-yank-pop)
  :config
  (setf (alist-get 't ivy-format-functions-alist) #'ivy-format-function-line)
  (setq ivy-use-virtual-buffers t
	ivy-re-builders-alist
	`((counsel-rf . ivy--regex-plus)
	  (swiper . ivy--regex-plus)
	  (swiper-isearch . ivy--regex-plus)
	  (t . ivy--regex-plus))
	ivy-more-chars-alist
	`((counsel-rg . 1)
	  (counsel-search . 2)
	  (t . 3))
	ivy-magic-slash-non-match-action nil
	ivy-use-virtual-buffers nil
	ivy-virual-abbreviate 'full
	ivy-use-selectable-prompt t
	counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)"
	ivy-height 17
	ivy-fixed-height-minibuffer t
	ivy-wrap t
	ivy-count-format "%d/%d ")
  (ivy-mode t))

(use-package ivy-rich
  :after ivy
  :config
  (ivy-rich-mode +1))

(use-package counsel-projectile
  :init
  (general-def
    [remap projectile-find-file]        #'counsel-projectile-find-file
    [remap projectile-find-dir]         #'counsel-projectile-find-dir
    [remap projectile-switch-to-buffer] #'counsel-projectile-switch-to-buffer
    [remap projectile-grep]             #'counsel-projectile-grep
    [remap projectile-ag]               #'counsel-projectile-ag
    [remap projectile-switch-project]   #'counsel-projectile-switch-project))

(use-package flx
  :init (setq ivy-flx-limit 10000))

(use-package all-the-icons-ivy
  :init (add-hook 'after-init-hook 'all-the-icons-ivy-setup)
  :after ivy
  :config
  (setq all-the-icons-ivy-file-commands
   '(counsel-find-file
     counsel-recentf
     counsel-projectile
     counsel-projectile-find-file
     counsel-projectile-find-dir)))

Which Key

Emacs package that displays available keybindings in popup

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

Magit

(use-package magit
  :config
  (setq magit-diff-refine-hunk t
	magit-save-repository-buffers nil
	magit-git-executable (executable-find magit-git-executable)))

LSP

(use-package lsp-mode
  :hook
  ((typescript-mode . lsp-deferred)
   (js2-mode . lsp-deferred)
   (web-mode . lsp-deferred)
   (lsp-mode . lsp-enable-which-key-integration))
  :commands lsp lsp-deferred)

(use-package lsp-ui
  :commands lsp-ui-mode)

(use-package lsp-ivy
  :commands lsp-ivy-workspace-symbol)

(use-package dap-mode)

Display

Doom Modeline

(use-package doom-modeline
  :config
  (doom-modeline-mode 1))

All the icons

(use-package all-the-icons)

Rainbow Delimiters

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

Languages

CSS

(use-package css-mode
  :ensure nil
  :custom (css-indent-offset 2))

(use-package scss-mode
  :ensure nil
  :preface
  (defun me/scss-set-comment-style ()
    (setq-local comment-end "")
    (setq-local comment-start "//"))
  :mode ("\\.sass\\'" "\\.scss\\'")
  :hook (scss-mode . me/scss-set-comment-style))

HTML

(use-package emmet-mode
  :hook (css-mode web-mode html-mode)
  :config
  (setq emmet-move-cursor-between-quotes t))

(use-package web-mode
  :mode "\\.[px]?html?\\'"
  :config
  (setq web-mode-enable-html-entities-fortification t
	web-mode-auto-close-style 1))

Javascript

(use-package js
  :ensure nil
  :custom
  (js-indent-level 2))

(use-package js2-mode
  :ensure nil
  :mode "\\.js\\'")

(use-package json-mode
  :mode "\\.json\\'"
  :preface
  (defun me/json-set-indent-level ()
    (setq-local js-indent-level 2))
  :hook (json-mode . me/json-set-indent-level))

(use-package prettier-js
  :config
  :hook js2-mode)

(use-package js-doc)

Markdown

(use-package markdown-mode
  :commands (markdown-mode gfm-mode)
  :mode (("README\\.md\\'" . gfm-mode)
	 ("\\.md\\'" . markdown-mode)
	 ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "multimarkdown"))

Typescript

(use-package typescript-mode)

Misc

(use-package toc-org
  :hook ((org-mode markdown-mode) . toc-org-mode))

(use-package ox-gfm
  :after org)

Keybindings

Minimap configuration

(defvar +default-minibuffer-maps
  (append '(minibuffer-local-map
	    minibuffer-local-ns-map
	    minibuffer-local-completion-map
	    minibuffer-local-must-match-map
	    minibuffer-local-isearch-map
	    read-expression-map
	    ivy-minibuffer-map
	    ivy-switch-buffer-map)))
(general-define-key
 :keymaps +default-minibuffer-maps
 [escape] 'abort-recursive-edit
 "C-j" 'next-line
 "C-k" 'previous-line)

Leader Keybinds

;; <leader>
(general-def
  :prefix "SPC"
  :states '(normal visual emacs)
  :keymaps 'override
  ";" 'eval-expression
  ":" 'execute-extended-command
  "X" 'org-capture
  "." 'find-file
  "," 'switch-to-buffer
  "*" 'counsel-rg
  "SPC" 'projectile-find-file
  "TAB" 'mode-line-other-buffer
  ;; <leader> b --- buffers
  "b" '(:ignore t :wk "buffers")
  "bb" 'switch-to-buffer
  "b[" 'previous-buffer
  "b]" 'next-buffer
  "bk" 'kill-this-buffer
  "bn" 'next-buffer
  "bp" 'previous-buffer
  ;; <leader> f --- files
  "f" '(:ignore t :wk "files")
  "ff" 'find-file
  "fd" 'dired
  "fr" 'recentf-open-files
  "fR" 'projectile-recentf
  "fs" 'save-buffer
  "fp" 'find-config
  ;; <leader> g --- git
  "g" '(:ignore t :wk "git")
  "g/" 'magit-dispatch
  "gg" 'magit-status
  "gB" 'magit-blame-addition
  "gF" 'magit-fetch
  "gL" 'magit-log
  "gS" 'magit-stage-file
  "gU" 'magit-unstage-file
  "gc" '(:ignore t :wk "create")
  "gcr" 'magit-init
  "gcR" 'magit-clone
  "gcc" 'magit-commit-crate
  "gci" 'forge-create-issue
  "gcp" 'forge-create-pullreq
  "gf" '(:ignore t :wk "find")
  "gff" 'magit-find-file
  "gfg" 'magit-find-git-config-file
  "gfc" 'magit-show-commit
  "gfi" 'forge-visit-issue
  "gfp" 'forge-visit-pullreq
  "gl" '(:ignore t :wk "list")
  "glr" 'magit-list-repositories
  "gls" 'magit-list-submodules
  "gli" 'forge-list-issues
  "glp" 'forge-list-pullreqs
  "gln" 'forge-list-notifications
  "go" '(:ignore t :wk "open in browser")
  "gor" 'forge-browse-remote
  "goc" 'forge-browse-commit
  "goi" 'forge-browse-issue
  "gop" 'forge-browse-pullreq
  "goI" 'forge-browse-issues
  "goP" 'forge-browse-pullreqs
  ;; <leader> h --- help
  "h" '(:ignore t :wk "help")
  "hi" 'info
  "hl" 'counsel-find-library
  "hI" 'info-display-manual
  "hd" '(:ignore t :wk "describe")
  "hdB" 'evil-collection-describe-bindings
  "hdc" 'describe-char
  "hdf" 'counsel-describe-function
  "hdg" 'general-describe-keybindings
  "hdk" 'describe-key
  "hdm" 'describe-mode
  "hdp" 'describe-package
  "hds" 'counsel-info-lookup-symbol
  "hdt" 'describe-theme
  "hdu" 'counsel-unicode-char
  "hdv" 'counsel-describe-variable
  ;; <leader> p --- projects
  "p" '(:ignore t :wk "projects")
  "pp" 'projectile-switch-project)

About

My personal Emacs configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published