summaryrefslogtreecommitdiff
path: root/modules/diff-config.el
diff options
context:
space:
mode:
Diffstat (limited to 'modules/diff-config.el')
-rw-r--r--modules/diff-config.el53
1 files changed, 53 insertions, 0 deletions
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.