dotfiles/emacs/init.el
Anthony Cicchetti 0e810099ab No tabs
2021-02-05 12:31:50 -05:00

292 lines
8.9 KiB
EmacsLisp

(setq gc-cons-threshold (* 100 1024 1024))
(require 'package)
(add-to-list 'package-archives
'(
"melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
'("org" . "https://orgmode.org/elpa/")
t)
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(use-package no-littering
:ensure t
:config
(require 'recentf)
(add-to-list 'recentf-exclude no-littering-var-directory)
(add-to-list 'recentf-exclude no-littering-etc-directory))
(require 'use-package-ensure)
(setq use-package-always-ensure t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(async-bytecomp-package-mode t)
'(delete-selection-mode nil)
'(display-line-numbers 'visual)
'(display-line-numbers-current-absolute t)
'(display-line-numbers-grow-only t)
'(display-line-numbers-type 'visual)
'(display-line-numbers-width-start t)
'(evil-cross-lines t)
'(global-whitespace-mode t)
'(indent-tabs-mode nil)
'(package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")))
'(package-selected-packages
'(flycheck origami groovy-mode avy editorconfig org-crypt tree-sitter-langs tree-sitter centaur-tabs dashboard page-break-lines wakatime-mode super-save ox-pandoc evil-surround evil-collection undo-tree toc-org evil-org org-plus-contrib evil-goggles evil-expat evil-commentary auto-package-update lispy smartparens which-key git-gutter rainbow-delimiters auto-complete-distel auto-complete evil magit evil-magit))
'(ring-bell-function 'ignore)
'(undo-tree-auto-save-history t)
'(undo-tree-history-directory-alist '(("." . "~/.undohist-emacs")))
'(undo-tree-visualizer-diff t)
'(undo-tree-visualizer-timestamps t)
'(whitespace-style
'(face tabs spaces newline space-mark tab-mark newline-mark)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :extend nil :stipple nil :background "#322931" :foreground "#b9b5b8" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 160 :width normal :foundry "nil" :family "Iosevka Custom"))))
'(evil-goggles-change-face ((t (:inherit diff-removed))))
'(evil-goggles-delete-face ((t (:inherit diff-removed))))
'(evil-goggles-paste-face ((t (:inherit diff-added))))
'(evil-goggles-undo-redo-add-face ((t (:inherit diff-added))))
'(evil-goggles-undo-redo-change-face ((t (:inherit diff-changed))))
'(evil-goggles-undo-redo-remove-face ((t (:inherit diff-removed))))
'(evil-goggles-yank-face ((t (:inherit diff-changed))))
'(italic ((t (:slant italic :family "Dank Mono"))))
'(whitespace-tab ((t (:inherit default :foreground "#65737d")))))
;; auto-package-update
(use-package auto-package-update
:ensure t
:config
(setq auto-package-update-delete-old-versions t)
(auto-package-update-maybe))
;; Autocomplete
(use-package auto-complete
:config (global-auto-complete-mode t))
;; Theme
(use-package base16-theme
:config (load-theme 'base16-hopscotch t))
(global-prettify-symbols-mode +1)
;; Undo-tree
(use-package undo-tree
:config
(global-undo-tree-mode))
;; EVIL
(use-package evil
:ensure t
:init
(setq evil-want-keybinding nil)
:config
(evil-mode 1))
(use-package evil-collection
:after evil
:ensure t
:config
(evil-collection-init))
(use-package evil-commentary
:ensure t)
(use-package evil-expat
:ensure t)
(use-package evil-goggles
:ensure t
:config
(evil-goggles-mode)
;; optionally use diff-mode's faces; as a result, deleted text
;; will be highlighed with `diff-removed` face which is typically
;; some red color (as defined by the color theme)
;; other faces such as `diff-added` will be used for other actions
(evil-goggles-use-diff-faces))
(use-package evil-surround
:after evil
:ensure t
:config
(global-evil-surround-mode 1))
(use-package evil-org
:after (evil org)
:config
(add-hook 'org-mode-hook 'evil-org-mode)
(add-hook 'evil-org-mode-hook (lambda () (evil-org-set-key-theme)))
(require 'evil-org-agenda)
(evil-org-agenda-set-keys))
(evil-set-leader 'normal (kbd "SPC"))
(evil-define-key 'normal 'global (kbd "C-k") 'evil-scroll-up)
(evil-define-key 'normal 'global (kbd "C-j") 'evil-scroll-down)
(evil-define-key 'normal 'global (kbd "<leader>l") 'evil-window-right)
(evil-define-key 'normal 'global (kbd "<leader>h") 'evil-window-left)
(evil-define-key 'normal 'global (kbd "<leader>j") 'evil-window-down)
(evil-define-key 'normal 'global (kbd "<leader>k") 'evil-window-up)
(evil-define-key 'normal 'global (kbd "<leader>i") 'help)
(evil-define-key 'normal 'global (kbd "gc") 'evil-commentary)
(evil-define-key 'normal 'global (kbd "<leader>u") 'undo-tree-visualize)
;; Avy
(use-package avy
:config
(evil-define-key 'normal 'global (kbd "<leader>a") 'avy-goto-char-timer))
;; Magit
(use-package magit
:config
(evil-define-key 'normal 'global (kbd "<leader>g") 'magit-file-dispatch)
(evil-define-key 'normal 'global (kbd "<leader>r") 'magit-status))
;; Lispy
(use-package lispy
:config (add-hook 'emacs-lisp-mode-hook (lambda () (lispy-mode 1))))
;; smartparens
(use-package smartparens
:config (smartparens-global-mode t))
;; which-key
(use-package which-key
:config (which-key-mode))
;; Git gutter
(use-package git-gutter
:config (global-git-gutter-mode +1))
;; Rainbow Delims
(use-package rainbow-delimiters
:config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
;; Super Save
(use-package super-save
:config
(super-save-mode +1))
;; EditorConfig
(use-package editorconfig
:ensure t
:config
(editorconfig-mode 1))
;; Wakatime
;; (use-package wakatime-mode
;; :hook (after-init . global-wakatime-mode))
;; Groovy-mode
(use-package groovy-mode
)
;; Origamimode
(use-package origami
:ensure evil
:config (global-origami-mode t)
(evil-define-key 'normal 'global (kbd "<leader> f o") 'origami-open-node)
(evil-define-key 'normal 'global (kbd "<leader> f c") 'origami-close-node)
(evil-define-key 'normal 'global (kbd "<leader> f O") 'origami-open-all-nodes)
(evil-define-key 'normal 'global (kbd "<leader> f C") 'origami-close-all-nodes)
(evil-define-key 'normal 'global (kbd "<leader> f t") 'origami-show-only-node))
;; Page-break-lines
(use-package page-break-lines
:ensure t
:config (global-page-break-lines-mode 1))
;; Dashboard
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook)
(setq dashboard-banner-logo-title "Welcome to Emacs Dashboard")
(setq dashboard-center-content t))
(if (not (string-match "^aarch64-.*" system-configuration))
(progn
;; Tree-sitter
(use-package tree-sitter
:config
(global-tree-sitter-mode)
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
;; Tree-sitter-langs
(use-package tree-sitter-langs
:after (tree-sitter)))
())
;; Org Mode
(use-package org
:mode (("\\.org$" . org-mode))
:ensure org-plus-contrib
:config
(evil-define-key 'normal 'global (kbd "<leader> SPC s") 'org-store-link)
(evil-define-key 'normal 'global (kbd "<leader> SPC a") 'org-agenda)
(evil-define-key 'normal 'global (kbd "<leader> SPC c") 'org-capture)
(evil-define-key 'normal 'global (kbd "<leader> SPC l") 'org-insert-link)
(evil-define-key 'normal 'global (kbd "g [") 'org-open-at-point)
)
(use-package epa-file
:ensure nil
:config
(setq epa-file-encrypt-to '("anthony@anthonycicchetti.com"))
:custom
(epa-file-select-keys 'silent))
(use-package org-crypt
:ensure nil ;; included with org-mode
:after org
:config
(org-crypt-use-before-save-magic)
(setq org-tags-exclude-from-inheritance (quote ("crypt")))
:custom
(org-crypt-key "anthony@anthonycicchetti.com"))
(use-package toc-org
:after (org)
:config
(add-hook 'org-mode-hook 'toc-org-mode)
(add-hook 'markdown-mode-hook 'toc-org-mode))
(use-package ox-pandoc
:after (org))
(use-package flycheck
:init (global-flycheck-mode))
(setq cider-font-lock-dynamically '(macro core function var))
;; These don't work yet?
;; (define-key evil-insert-state-map (kbd "C-\\") 'cider-eval-defun-up-to-point)
;; (define-key evil-normal-state-map (kbd "C-\\") 'cider-eval-defun-up-to-point)
(progn
(setq whitespace-style (quote (face spaces tabs newline space-mark tab-mark newline-mark )))
(setq whitespace-display-mappings
(quote (
(space-mark 32 [8227] [183] [46])
(newline-mark 10 [172 10] [182 10])
(tab-mark 9 [8594 32 32 32] [8614])))))