[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit 0be04f960f 049/244: use text objects v1.3.2
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit 0be04f960f 049/244: use text objects v1.3.2 |
Date: |
Thu, 6 Jan 2022 02:58:48 -0500 (EST) |
branch: elpa/evil-matchit
commit 0be04f960f71c2cb91d9ed684904e3acc5609dde
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
use text objects v1.3.2
---
README.org | 16 ++++++++------
evil-matchit-pkg.el | 2 +-
evil-matchit.el | 60 ++++++++++++++++++++---------------------------------
3 files changed, 34 insertions(+), 44 deletions(-)
diff --git a/README.org b/README.org
index b1737b7cf2..222d668b27 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v1.3.1)
+* evil-matchit (v1.3.2)
Vim [[http://www.vim.org/scripts/script.php?script_id=39][matchit.vim]] by
Benji Fisher ported into Emacs.
@@ -22,7 +22,7 @@ Most modern languages are supported:
This package uses Evil as its vi layer!
-* Why use evil-matchit
+* Why use evil-matchit
- No learning curve. Press "%" to jump between matched tags. That's all!
- Stable! The ONLY dependency is evil-mode. So it should work in any major
modes (web-mode, html-mode ...).
- Support any modern languages (html/java/c/c++/python/latex/javascript ...).
@@ -49,11 +49,15 @@ Alternatively, you can enable evil-matchit-mode along a
major mode by adding `tu
* Usage
Press "%" to jump inside item(s) between tags in evil-normal-mode whose
command name is "evilmi-jump-items". Please note that you *DO NOT* need move
cursor above the tag before jumping, evil-matchit is smart enough to *detect
the beginning of tag automatically*.
-Press ",si" to select item(s) wrapped by tags in evil-normal-mode whose
command name is "evilmi-select-items".
+Text object "%" is also created. It roughly equal the region when you press
"%" from evil-matchit. Its basic unit is line.
-Press ",di" to delete item(s) wrapped by tags in evil-normal-mode whose
command name is "evilmi-delete-items".
+Please note inner text object or outer object is the same thing in
evil-matchit.
-All commands support numeric argument like "3%", "5,si" or "9,di"
+Press "va%" or "vi%" to select line(s) wrapped by tags.
+
+Press "da%" or "di%" to delete line(s) wrapped by tags.
+
+All commands support numeric argument like "3%", "5va%" or "9da%"
* Advanced tips
** Support more major modes
@@ -188,7 +192,7 @@ Basically you just need:
** Share your code to the world
Tweak your code a little bit to make it a plugin and ask me to merge it into
upstream.
-Please check "evil-matchit-latext.el" for technical details about plugin.
+Please check "evil-matchit-latex.el" for technical details about plugin.
Key points about code quality of plugin:
- minimum dependency. For example, if your plugin for html template files is
only some web-mode API wrapper, it will break when user don't have web-mode
diff --git a/evil-matchit-pkg.el b/evil-matchit-pkg.el
index 53bccb9aac..16b99b3935 100644
--- a/evil-matchit-pkg.el
+++ b/evil-matchit-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-matchit" "1.3.1"
+(define-package "evil-matchit" "1.3.2"
"Vim matchit ported into Emacs (requires EVIL)")
diff --git a/evil-matchit.el b/evil-matchit.el
index 5692d2b332..1175ced7f1 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: 1.3.1
+;; Version: 1.3.2
;; Keywords: matchit vim evil
;; Package-Requires: ((evil "1.0.7"))
;;
@@ -152,6 +152,25 @@
'(lua-mode ruby-mode vimrc-mode))
)
+(evil-define-text-object evilmi-text-object (&optional NUM begin end type)
+ "text object describling the region selected when you press % from
evil-matchit"
+ :type line
+ (let (where-to-jump-in-theory b e)
+ (save-excursion
+ (setq where-to-jump-in-theory (evilmi--operate-on-item NUM
'evilmi--push-mark))
+ (if where-to-jump-in-theory (goto-char where-to-jump-in-theory))
+ (setq b (region-beginning))
+ (setq e (region-end))
+ (goto-char b)
+ (when (string-match "[ \t]*" (buffer-substring-no-properties
(line-beginning-position) b))
+ (setq b (line-beginning-position))
+ ;; 1+ because the line feed
+ ))
+ (evil-range b e 'line)))
+
+(define-key evil-inner-text-objects-map "%" 'evilmi-text-object)
+(define-key evil-outer-text-objects-map "%" 'evilmi-text-object)
+
;;;###autoload
(defun evilmi-jump-items (&optional NUM)
"jump between item/tag(s)"
@@ -162,36 +181,7 @@
))
;;;###autoload
-(defun evilmi-select-items (&optional NUM)
- "select item/tag(s)"
- (interactive "p")
- (let (where-to-jump-in-theory )
- (setq where-to-jump-in-theory (evilmi--operate-on-item NUM
'evilmi--push-mark))
- (if where-to-jump-in-theory (goto-char where-to-jump-in-theory))
- )
- )
-
-;;;###autoload
-(defun evilmi-delete-items (&optional NUM)
- "delete item/tag(s)"
- (interactive "p")
- (let (where-to-jump-in-theory )
- (setq where-to-jump-in-theory (evilmi--operate-on-item NUM
'evilmi--push-mark))
- (if where-to-jump-in-theory (goto-char where-to-jump-in-theory))
- (save-excursion
- (let ((b (region-beginning))
- (e (region-end)))
- (goto-char b)
- (when (string-match "[ \t]*" (buffer-substring-no-properties
(line-beginning-position) b))
- (setq b (line-beginning-position))
- ;; 1+ because the line feed
- (kill-region b (1+ e))
- )))
- ;; need some hook here
- ))
-
-;;;###autoload
-(defun evilmi-version() (interactive) (message "1.3.1"))
+(defun evilmi-version() (interactive) (message "1.3.2"))
;;;###autoload
(define-minor-mode evil-matchit-mode
@@ -200,14 +190,10 @@
(if (fboundp 'evilmi-customize-keybinding)
(evilmi-customize-keybinding)
(evil-define-key 'normal evil-matchit-mode-map
- "%" 'evilmi-jump-items
- ",si" 'evilmi-select-items
- ",di" 'evilmi-delete-items
- )
+ "%" 'evilmi-jump-items)
)
(evil-normalize-keymaps)
- (evilmi-init-plugins)
- )
+ (evilmi-init-plugins))
;;;###autoload
(defun turn-on-evil-matchit-mode ()
- [nongnu] elpa/evil-matchit 73bef5fb56 134/244: Merge pull request #84 from dsdshcym/83-elixir-support, (continued)
- [nongnu] elpa/evil-matchit 73bef5fb56 134/244: Merge pull request #84 from dsdshcym/83-elixir-support, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8123eef094 146/244: Merge pull request #88 from Khady/master, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3f49ee9d17 140/244: improve ocaml, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8d6bd9187d 154/244: [chen] update doc, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2143844e2b 170/244: support js2-jsx-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit e941c695f3 173/244: Add [ and { as well., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit c04f8f480c 164/244: Match Ruby's begin also when it's not on the beginning of the line, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit d779aedaf1 195/244: clean code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit dead63c7d0 194/244: add unit test, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 80dc731ab7 237/244: clean code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 0be04f960f 049/244: use text objects v1.3.2,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 62cef4f91a 077/244: replace evil-jump-items v2.0, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 6390e9e06c 216/244: Silence byte-compiler, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ae8fddea39 207/244: clean code, tdd for markdown, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 0fd65c463b 226/244: clean code&doc, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ceec6a63b0 236/244: better algorithm to match bracket/brace in javascript, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8c4f516265 238/244: Support matlab-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 82c80786e5 240/244: jump between merge conflict markers, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 5c43939d01 212/244: Merge pull request #126 from neojski/more-ocaml-tests, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit cdb9b90381 229/244: extra json support, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit d005e0465e 223/244: Merge pull request #130 from nbfalcon/bugfix/evilmi-sdk-simple-jump-whitespace, ELPA Syncer, 2022/01/06