emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil-exchange 524a82a5ac 25/46: document improvement


From: ELPA Syncer
Subject: [nongnu] elpa/evil-exchange 524a82a5ac 25/46: document improvement
Date: Thu, 6 Jan 2022 03:59:52 -0500 (EST)

branch: elpa/evil-exchange
commit 524a82a5aca7032ac74a5cb5b3dda68e8e993aee
Author: Dewdrops <v_v_4474@126.com>
Commit: Dewdrops <v_v_4474@126.com>

    document improvement
---
 README.md        | 14 ++++++++++++++
 evil-exchange.el |  8 ++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 4a702e8830..34f69fb43f 100644
--- a/README.md
+++ b/README.md
@@ -40,3 +40,17 @@ Customization
 
 You can change the default bindings by customizing `evil-exchange-key` and/or 
`evil-exchange-cancel-key` BEFORE  `evil-exchange-install` is called.
 
+[Experienmental] Vim-compatible key bindings
+-------
+
+Due to the way how evil (and emacs) implements key bindings, `evil-exchange` 
can't be bound to `cx` (which is the default bindings of the original
+vim plugin) by customizing `evil-exchange-key` option. If you prefer the key 
bindings suggested by vim-exchange, you can try the settings below:
+
+```lisp
+(require 'evil-exchange)
+(evil-exchange-cx-install)
+```
+
+The `evil-exchange-cx-install` function tries to mimic the original vim 
plugin's behaviour, i.e. `cx` in normal state bound to `evil-exchange`,
+`cxc` in normal state bound to `evil-exchange-cancel`, and `X` in visual state 
bound to `evil-exchange`.
+
diff --git a/evil-exchange.el b/evil-exchange.el
index 7fc8154bee..9bc7a6e146 100644
--- a/evil-exchange.el
+++ b/evil-exchange.el
@@ -127,10 +127,10 @@
   ;; 2. call extract-fn with curr-beg and curr-end to extract curr-text.
   ;; 3. go to orig-beg and then call insert-fn with curr-text.
   ;; 4. go to curr-beg and then call insert-fn with orig-text.
-  ;; After step 2, curr-beg and curr-end (the same as orig-beg and orig-end)
-  ;; will point to the same position. So if orig-beg is at the same position of
-  ;; curr-end initially, orig-beg and curr-beg will point to the same position
-  ;; before step 3. Because curr-beg is a marker moved after insertion, the
+  ;; After step 2, the two markers of the same beg/end pair (curr or orig)
+  ;; will point to the same position. So if orig-beg points to the same 
position
+  ;; of curr-end initially, orig-beg and curr-beg will point to the same 
position
+  ;; before step 3. Because curr-beg is a marker which moves after insertion, 
the
   ;; insertion in step 3 will push it to the end of the newly inserted text,
   ;; thus resulting incorrect behaviour.
   ;; To fix this edge case, we swap two extracted texts before step 3 to



reply via email to

[Prev in Thread] Current Thread [Next in Thread]