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

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

[nongnu] elpa/evil-matchit 8fa4c1390d 163/244: can change shortcut from


From: ELPA Syncer
Subject: [nongnu] elpa/evil-matchit 8fa4c1390d 163/244: can change shortcut from "%" to "m"
Date: Thu, 6 Jan 2022 02:58:58 -0500 (EST)

branch: elpa/evil-matchit
commit 8fa4c1390d82036f9d51750eb6d3f054785cb396
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    can change shortcut from "%" to "m"
---
 README.org      | 38 +++++++++++++++++++++++---------------
 evil-matchit.el | 27 ++++++++++++++++++++-------
 pkg.sh          |  2 +-
 3 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/README.org b/README.org
index 42cb71da89..37785caa15 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v2.2.9)
+* evil-matchit (v2.3.0)
 
 
[[http://melpa.org/#/evil-matchit][file:http://melpa.org/packages/evil-matchit-badge.svg]]
 
[[http://stable.melpa.org/#/evil-matchit][file:http://stable.melpa.org/packages/evil-matchit-badge.svg]]
 
@@ -39,7 +39,7 @@ Tested on Emacs 24.3, 24.4, 24.5, 25.1
 
 * Why use evil-matchit
 - No learning curve. Press "%" to jump. That's all!
-- Stable. Usage of  Evil API is minimized
+- Stable. Usage of Evil API is minimized
 - Perfect integration with Evil
 - Support any modern languages (html/java/c/c++/python/latex/javascript ...)
 - Powerful. If you mix jsp, freemarker, html, jquery template or any weird 
syntax into one file, it still works!
@@ -59,14 +59,14 @@ Insert below code into your ~/.emacs:
 (global-evil-matchit-mode 1)
 #+END_SRC
 
-Alternatively, you can enable evil-matchit-mode along a major mode by adding 
`turn-on-evil-matchit-mode' to the mode hook.
+Alternatively, you can enable evil-matchit-mode along a major mode by adding 
=turn-on-evil-matchit-mode= to the mode hook.
 
 * Usage
 Press "%" to jump inside between tag pair in normal mode or visual mode (you 
press "v" to switch to visual mode). Please note evil-matchit is smart enough 
to *detect the tag automatically*.
 
 Tag pair could be open/closed html tag, or character pair like "{}" "[]" "()", 
or the single/double quote(s) at the two ends of the string.
 
-Inner/outer text object "%" is also created. It roughly equal the region when 
you press "%" from evil-matchit.
+Inner/outer text object "%" is also created. It roughly equals the region when 
you press "%" from evil-matchit.
 
 Press "va%" to select line(s) wrapped by tags including tags themselves. `M-x 
evilmi-select-items` does the same thing.
 
@@ -74,7 +74,7 @@ Press "da%" to delete line(s) wrapped by tags including tags 
themselves. `M-x ev
 
 All commands support numeric argument like "3%", "5va%" or "9da%"
 
-"3%"  will jump to a line 3 percentage down the file. It's the default 
behavior in original evil-mode . You can `(setq evilmi-may-jump-by-percentage 
nil)` to turn off this feature. Then "3%" will jump 3 times.
+Pressing "3%" jumps to a line 3 percentage down the file. It's the default 
behavior in original =evil-mode=. You can `(setq evilmi-may-jump-by-percentage 
nil)` to turn off this feature. Then "3%" will jump 3 times.
 
 Please note *only "evil-visual-state" and "evil-normal-state" are officially 
supported*.
 
@@ -88,14 +88,14 @@ In order to apply three matching rules =evilmi-template=, 
=evilmi-simple=, and =
 #+begin_src elisp
 (evilmi-load-plugin-rules '(mhtml-mode) '(template simple html))
 #+end_src
-** Use evilmi-select-items instead press '%' in evil-visual-state
-evilmi-select-items is more robust and provides more functionality. It works 
even when evil-mode is not loaded. 
+** Use evilmi-select-items instead press "%" in evil-visual-state
+evilmi-select-items is more robust and provides more functionality. It works 
even when =evil-mode= is not loaded.
 
 So you'd better stick to evilmi-select-items if possible.
 ** Add new tags into existing languages
 Use ruby as an example.
 
-If you want to add more tags into ruby, you can do two thing:
+If you want to add more tags into ruby, you can do two things:
 - You need define the regular expression to extract keyword
 - You need define the open/middle/closed tags
 
@@ -117,16 +117,24 @@ So you setup in ~/.emacs is as below:
 #+end_src
 
 ** Re-define keybinding
-You can define your own key bindings instead using evil-matchit default key 
binding.
-
 All you need to do is to define function evilmi-customize-keybinding before 
turning on evil-match-mode:
+
+The shortcut =%= is defined in =evilmi-shortcut=. It's the name of text object 
and shortcut of =evilmi-jump-items=. Some people prefer set it
+to "m".
+
+Change keybinding of =evilmi-jump-items= *and* name of the text object,
+#+begin_src elisp
+(setq evilmi-shortcut "m")
+(global-evil-matchit-mode 1)
+#+end_src
+
+Change keybinding *only*,
 #+BEGIN_SRC elisp
 (defun evilmi-customize-keybinding ()
   (evil-define-key 'normal evil-matchit-mode-map
     "%" 'evilmi-jump-items))
 (global-evil-matchit-mode 1)
 #+END_SRC
-
 ** Jump between the two end of the "string"
 Please note the definition of "string" could be *customized* by user.
 
@@ -136,12 +144,12 @@ Here is the setup to jump between the two ends of the C 
comment:
 #+begin_src elisp
 (setq evilmi-quote-chars (string-to-list "'\"/"))
 #+end_src
-** Match case sensitive tags?
+** Match case-sensitive tags?
 It's decided by the Emacs global variable "case-fold-search". You need not 
care about it because the major mode will set this flag automatically.
 ** Python
 You can turn on =evilmi-always-simple-jump= to match brackets at first.
 
-Thus you disable our *advanced algorithm* which I highly recommend.
+Thus, you disable our *advanced algorithm* which I highly recommend.
 
 Some people may prefer simpler algorithm in =python-mode=.
 * Developer guide
@@ -186,7 +194,7 @@ Place above code into your =~/.emacs=, after the line 
"(global-evil-matchit-mode
 ** Use SDK
 For example, it only takes 3 steps to create a new rule =script= to match tags 
in script like Ruby/Lua/Bash/VimScript,
 
-Step 1, create  =evil-matchit-script.el=,
+Step 1, create =evil-matchit-script.el=,
 #+BEGIN_SRC elisp
 (require 'evil-matchit-sdk)
 
@@ -219,7 +227,7 @@ The forth *optional* column defines the relationship 
between open and close tags
 (provide 'evil-matchit-script)
 #+END_SRC
 
-Step 2, make sure the directory of =evil-matchit-script.el=  is add into 
=load-path=.
+Step 2, make sure the directory of =evil-matchit-script.el=  is added into 
=load-path=.
 
 Step 3, add below code to =~/.emacs.=,
 #+BEGIN_SRC lisp
diff --git a/evil-matchit.el b/evil-matchit.el
index 3f0c8e4073..cd41ec66cb 100644
--- a/evil-matchit.el
+++ b/evil-matchit.el
@@ -4,7 +4,7 @@
 
 ;; Author: Chen Bin <chenbin.sh@gmail.com>
 ;; URL: http://github.com/redguardtoo/evil-matchit
-;; Version: 2.2.9
+;; Version: 2.3.0
 ;; Keywords: matchit vim evil
 ;; Package-Requires: ((evil "1.2.0") (emacs "24.4"))
 ;;
@@ -31,7 +31,16 @@
 ;;
 ;; This program emulates matchit.vim by Benji Fisher.
 ;; Add `(global-evil-matchit-mode 1)' into Emacs setup.
-;; Then press % to match items.
+;; Then press % or `evilmi-jump-items' to jump between then matched pair.
+;; Text object "%" is also provided.
+;;
+;; The shortcut "%" is defined in `evilmi-shortcut'. It's both the name of
+;; text object and shortcut of `evilmi-jump-items'. Some people prefer set it
+;; to "m". Here is sample setup:
+;;
+;;   (setq evilmi-shortcut "m")
+;;   (global-evil-matchit-mode 1)
+;;
 ;; See https://github.com/redguardtoo/evil-matchit/ for help.
 ;;
 ;; This program requires EVIL (http://gitorious.org/evil)
@@ -51,6 +60,10 @@
 For example, `50%' jumps to 50 percentage of buffer.
 If nil, `50%' jumps 50 times.")
 
+(defvar evilmi-shortcut "%"
+  "The keybinding of `evilmi-jump-items' and then text object shortcut.
+Some people prefer using \"m\" instead.")
+
 (defvar evilmi-always-simple-jump nil
   "`major-mode' like `python-mode' use optimized algorithm by default.
 If it's t, use simple jump.")
@@ -389,8 +402,8 @@ If IS-FORWARD is t, jump forward; or else jump backward."
   (let ((selected-region (evilmi--region-to-select-or-delete num)))
     (evil-range (car selected-region) (cadr selected-region) 'line)))
 
-(define-key evil-inner-text-objects-map "%" 'evilmi-inner-text-object)
-(define-key evil-outer-text-objects-map "%" 'evilmi-outer-text-object)
+(define-key evil-inner-text-objects-map evilmi-shortcut 
'evilmi-inner-text-object)
+(define-key evil-outer-text-objects-map evilmi-shortcut 
'evilmi-outer-text-object)
 
 ;;;###autoload
 (defun evilmi-select-items (&optional num)
@@ -442,7 +455,7 @@ If IS-FORWARD is t, jump forward; or else jump backward."
 ;;;###autoload
 (defun evilmi-version()
   (interactive)
-  (message "2.2.9"))
+  (message "2.3.0"))
 
 ;;;###autoload
 (define-minor-mode evil-matchit-mode
@@ -455,8 +468,8 @@ If IS-FORWARD is t, jump forward; or else jump backward."
       ;; use user's own key bindings
       (evilmi-customize-keybinding)
     ;; else use default key bindings
-    (evil-define-key 'normal evil-matchit-mode-map "%" 'evilmi-jump-items)
-    (evil-define-key 'visual evil-matchit-mode-map "%" 'evilmi-jump-items))
+    (evil-define-key 'normal evil-matchit-mode-map evilmi-shortcut 
'evilmi-jump-items)
+    (evil-define-key 'visual evil-matchit-mode-map evilmi-shortcut 
'evilmi-jump-items))
 
   (evil-normalize-keymaps))
 
diff --git a/pkg.sh b/pkg.sh
index 2fef271baf..0ad20f310f 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 name=evil-matchit
-version=2.2.9
+version=2.3.0
 pkg=$name-$version
 mkdir $pkg
 cp README.org $pkg



reply via email to

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