dotfiles/emacs/init.el

299 lines
9.8 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))
(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)
'(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)
'(package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")))
'(package-selected-packages
'(org-crypt tree-sitter-langs tree-sitter centaur-tabs dashboard page-break-lines clipetty 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))
(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.
'(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))))
'(fringe ((t (:background "brightgreen" :foreground "black"))))
'(header-line ((t (:inherit mode-line :foreground "color-127"))))
'(highlight ((t (:background "brightgreen" :foreground "black"))))
'(isearch ((t (:background "black" :foreground "brightmagenta"))))
'(lazy-highlight ((t (:background "black" :foreground "blue" :inverse-video t))))
'(line-number ((t (:background "blue" :foreground "black"))))
'(line-number-major-tick ((t (:background "grey75" :foreground "black" :weight bold))))
'(magit-blame-heading ((t (:extend t :background "brightgreen" :foreground "black"))))
'(magit-diff-context-highlight ((t (:extend t :background "brightgreen" :foreground "black"))))
'(magit-diff-file-heading-selection ((t (:inherit magit-diff-file-heading-highlight :extend t :foreground "red"))))
'(magit-diff-hunk-heading ((t (:extend t :background "brightgreen" :foreground "black"))))
'(magit-diff-hunk-heading-highlight ((t (:extend t :background "brightgreen" :foreground "black"))))
'(magit-diff-hunk-heading-selection ((t (:inherit magit-diff-hunk-heading-highlight :extend t :foreground "brightred"))))
'(magit-header-line ((t (:background "brightyellow" :foreground "black" :weight bold))))
'(magit-section-highlight ((t (:extend t :background "brightgreen" :foreground "black" :slant italic))))
'(mode-line ((t (:background "brightblue" :foreground "brightwhite" :box nil))))
'(mode-line-buffer-id ((t (:foreground "white"))))
'(region ((t (:extend t :background "brightyellow" :foreground "black"))))
'(tooltip ((t (:background "brightgreen" :foreground "black")))))
;; 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-oceanicnext t))
;; 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))
;; ;; Clipetty (clipboard stuff)
;; (use-package clipetty
;; :ensure t
;; :hook (after-init . global-clipetty-mode))
;; 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 l") '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 "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))
;; Don't use system clipboard by default
(setq-default
interprogram-cut-function nil
interprogram-paste-function nil
x-select-enable-clipboard nil)
(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)
;; Extra things
; (global-whitespace-mode 1)
; (progn
;; Make whitespace-mode with very basic background coloring for whitespaces.
;; http://ergoemacs.org/emacs/whitespace-mode.html
; (setq whitespace-style (quote (face spaces tabs newline space-mark tab-mark newline-mark )))
;; Make whitespace-mode and whitespace-newline-mode use “¶” for end of line char and “▷” for tab.
; (setq whitespace-display-mappings
;; all numbers are unicode codepoint in decimal. e.g. (insert-char 182 1)
; (quote (
; (space-mark 32 [183] [46]) ; SPACE 32 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
; (newline-mark 10 [182 10]) ; LINE FEED,
; (tab-mark 9 [8614]) ; tab
; )
; )
; )
; )