From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- modules/diff-config.el | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 modules/diff-config.el (limited to 'modules/diff-config.el') diff --git a/modules/diff-config.el b/modules/diff-config.el new file mode 100644 index 00000000..aaef8dbf --- /dev/null +++ b/modules/diff-config.el @@ -0,0 +1,53 @@ +;;; ediff-config.el --- diff Configuration -*- lexical-binding: t; -*- + +;;; Commentary: +;; highly useful setup for configuring ediff +;; https://oremacs.com/2015/01/17/setting-up-ediff/ + +;;; Code: + +;; -------------------------------- Csetq Macro -------------------------------- +;; a macro that allows a setq for custom variables. uses the variable's set +;; property without writing customizations to emacs init. + +(defmacro csetq (variable value) + `(funcall (or (get ',variable 'custom-set) + 'set-default) + ',variable ,value)) + +;; ------------------------------- Ediff Settings ------------------------------ +;; ediff configuration. note the dired-ediff-files function in dirvish. + +;; lose the control panel +(csetq ediff-window-setup-function 'ediff-setup-windows-plain) + +;; only split horizontally +(csetq ediff-split-window-function 'split-window-horizontally) + +;; ignore whitespace in diffs +(csetq ediff-diff-options "-w") + +;; only highlight the current diff: +(setq-default ediff-highlight-all-diffs 'nil) + +;; use j and k for next and previous diffs +(defun cj/ediff-hook () + (ediff-setup-keymap) + (define-key ediff-mode-map "j" 'ediff-next-difference) + (define-key ediff-mode-map "k" 'ediff-previous-difference)) +(add-hook 'ediff-mode-hook 'cj/ediff-hook) + +;; restore the window setup after quitting +(winner-mode) +(add-hook 'ediff-after-quit-hook-internal 'winner-undo) + +;; ----------------------------------- Ztree ----------------------------------- +;; diff two directories + +(use-package ztree + :defer .5 + :bind + ("C-c D" . ztree-diff)) + +(provide 'diff-config) +;;; diff-config.el ends here. -- cgit v1.2.3