summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2019-09-16 15:53:19 +0200
committerAlan Pearce2019-09-16 15:53:19 +0200
commitb233e9bc5e1e8df16066650e8962347703d3b0f6 (patch)
treefec795109928777f22154fb4ee1508ede7fc963f
parentf6f4b93d53a16f5bdbf9cf53d3410688c58bd510 (diff)
downloadnixfiles-b233e9bc5e1e8df16066650e8962347703d3b0f6.tar.lz
nixfiles-b233e9bc5e1e8df16066650e8962347703d3b0f6.tar.zst
nixfiles-b233e9bc5e1e8df16066650e8962347703d3b0f6.zip
Emacs: add smerge hydra
-rw-r--r--emacs/.emacs.d/main.el40
1 files changed, 40 insertions, 0 deletions
diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el
index f08c83b7..e13a81d0 100644
--- a/emacs/.emacs.d/main.el
+++ b/emacs/.emacs.d/main.el
@@ -173,6 +173,46 @@ With two prefix arguments, write out the day and month name."
             (ivy-mode +1)))
 (use-package ivy-hydra)
 
+(use-package smerge-mode
+  :after hydra
+  :config
+  (defhydra unpackaged/smerge-hydra
+    (:color pink :hint nil :post (smerge-auto-leave))
+    "
+^Move^       ^Keep^               ^Diff^                 ^Other^
+^^-----------^^-------------------^^---------------------^^-------
+_n_ext       _b_ase               _<_: upper/base        _C_ombine
+_p_rev       _u_pper              _=_: upper/lower       _r_esolve
+^^           _l_ower              _>_: base/lower        _k_ill current
+^^           _a_ll                _R_efine
+^^           _RET_: current       _E_diff
+"
+    ("n" smerge-next)
+    ("p" smerge-prev)
+    ("b" smerge-keep-base)
+    ("u" smerge-keep-upper)
+    ("l" smerge-keep-lower)
+    ("a" smerge-keep-all)
+    ("RET" smerge-keep-current)
+    ("\C-m" smerge-keep-current)
+    ("<" smerge-diff-base-upper)
+    ("=" smerge-diff-upper-lower)
+    (">" smerge-diff-base-lower)
+    ("R" smerge-refine)
+    ("E" smerge-ediff)
+    ("C" smerge-combine-with-next)
+    ("r" smerge-resolve)
+    ("k" smerge-kill-current)
+    ("w" (lambda ()
+            (interactive)
+            (save-buffer)
+            (bury-buffer))
+     "Save and bury buffer" :color blue)
+    ("q" nil "cancel" :color blue))
+  :hook (magit-diff-visit-file . (lambda ()
+                                   (when smerge-mode
+                                     (unpackaged/smerge-hydra/body)))))
+
 (use-package swiper
   :general ([remap isearch-forward] #'swiper-isearch))