From be864cb978851cb27d627bfffea96451983ea64c Mon Sep 17 00:00:00 2001 From: Anthony Cicchetti Date: Sun, 13 Dec 2020 12:55:00 -0500 Subject: [PATCH] emacs --- emacs/init.el | 74 ++++++++++++++++++++++++++++++++++++++++++--------- zsh/zshrc | 4 +-- 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 5f43ddc..91139b5 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -2,9 +2,11 @@ (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) -(package-refresh-contents) +(unless package-archive-contents + (package-refresh-contents)) (defvar my-packages '( + use-package lispy smartparens which-key @@ -13,9 +15,10 @@ auto-complete-distel auto-complete evil - magit - base16-theme evil-collection + evil-surround + base16-theme + magit undo-tree which-key )) @@ -24,6 +27,8 @@ (when (not (package-installed-p p)) (package-install p))) +(require 'use-package) + (load-theme 'base16-oceanicnext t) (which-key-mode) @@ -33,7 +38,7 @@ ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(package-selected-packages - '(lispy smartparens which-key git-gutter rainbow-delimiters auto-complete-distel auto-complete evil magit evil-magit)) + '(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)) '(undo-tree-auto-save-history t) '(undo-tree-history-directory-alist '(("." . "~/.undohist-emacs"))) '(undo-tree-visualizer-diff t) @@ -43,7 +48,20 @@ ;; 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))))) + +;; auto-package-update +(use-package auto-package-update + :ensure t + :config + (setq auto-package-update-delete-old-versions t) + (auto-package-update-maybe)) ;; Undo-tree (global-undo-tree-mode) @@ -53,22 +71,54 @@ (global-auto-complete-mode t) ;; EVIL -(setq evil-want-keybinding nil) -(require 'evil) -(evil-collection-init) +(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)) + (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 "l") 'evil-window-right) (evil-define-key 'normal 'global (kbd "h") 'evil-window-left) -(evil-define-key 'normal 'global (kbd "j") 'evil-window-up) -(evil-define-key 'normal 'global (kbd "k") 'evil-window-down) +(evil-define-key 'normal 'global (kbd "j") 'evil-window-down) +(evil-define-key 'normal 'global (kbd "k") 'evil-window-up) (evil-define-key 'normal 'global (kbd "i") 'help) -(evil-mode 1) +(evil-define-key 'normal 'global (kbd "gc") 'evil-commentary) ;; Rainbow Delims (add-hook 'prog-mode-hook #'rainbow-delimiters-mode) -(show-paren-mode) ;; Git gutter (global-git-gutter-mode +1) diff --git a/zsh/zshrc b/zsh/zshrc index 78f146f..d90f137 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -36,8 +36,8 @@ zle -N down-line-or-beginning-search export COMPLETION_WAITING_DOTS="true" -export VISUAL='vim' -export EDITOR='vim' +export VISUAL='edit' +export EDITOR='edit' path=("$HOME/bin" "$HOME/go/bin" $path) zstyle ':znap:*' auto-compile no