[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit 8540a4c12a 068/244: supports inner text objec
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit 8540a4c12a 068/244: supports inner text object, v1.5.0 |
Date: |
Thu, 6 Jan 2022 02:58:50 -0500 (EST) |
branch: elpa/evil-matchit
commit 8540a4c12a9b4c2a81b12aa08aad1a7e1f82d477
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
supports inner text object, v1.5.0
---
README.org | 15 ++++++++-------
evil-matchit-pkg.el | 2 +-
evil-matchit.el | 43 ++++++++++++++++++++++++++++++++-----------
pkg.sh | 2 +-
4 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/README.org b/README.org
index 16b6249c26..ac933ff5cd 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v1.4.3)
+* evil-matchit (v1.5.0)
Vim [[http://www.vim.org/scripts/script.php?script_id=39][matchit.vim]] by
Benji Fisher ported into Emacs.
@@ -9,7 +9,8 @@ Many modern languages are supported:
- Python
- Java
- C++/C
-- Javascript, JSON
+- Javascript
+- JSON
- Perl
- Latex
- CMake
@@ -18,6 +19,8 @@ Many modern languages are supported:
- Bash
- Lua
- PHP
+- Fortran
+- SQL
- Laravel Blade Templating
- Vim script
- Emacs email (mesage-mode)
@@ -52,13 +55,11 @@ Alternatively, you can enable evil-matchit-mode along a
major mode by adding `tu
* Usage
Press "%" to jump inside between tags in evil-normal-mode. Please note
evil-matchit is smart enough to *detect the beginning of tag automatically*.
-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 equal the region when
you press "%" from evil-matchit.
-Inner text object or outer object is the same thing in evil-matchit.
+Press "va%" to select line(s) wrapped by tags including tags themselves. `M-x
evilmi-select-items` does the same thing.
-Press "va%" or "vi%" to select line(s) wrapped by tags. `M-x
evilmi-select-items` does the same thing.
-
-Press "da%" or "di%" to delete line(s) wrapped by tags. `M-x
evilmi-delete-items` does the same thing.
+Press "da%" to delete line(s) wrapped by tags including tags themselves. `M-x
evilmi-delete-items` does the same thing.
All commands support numeric argument like "3%", "5va%" or "9da%"
diff --git a/evil-matchit-pkg.el b/evil-matchit-pkg.el
index 73ad3fc7e2..937eaeed05 100644
--- a/evil-matchit-pkg.el
+++ b/evil-matchit-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-matchit" "1.4.3"
+(define-package "evil-matchit" "1.5.0"
"Vim matchit ported into Emacs (requires EVIL)")
diff --git a/evil-matchit.el b/evil-matchit.el
index 51f1802390..8e76a49c47 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.4.3
+;; Version: 1.5.0
;; Keywords: matchit vim evil
;; Package-Requires: ((evil "1.0.7"))
;;
@@ -176,7 +176,7 @@ If this flag is nil, then 50 means jump 50 times.")
'(ruby-mode))
)
-(defun evilmi--region-to-select-or-delete (NUM)
+(defun evilmi--region-to-select-or-delete (NUM &optional is-inner)
(let (where-to-jump-in-theory b e)
(save-excursion
(setq where-to-jump-in-theory (evilmi--operate-on-item NUM
'evilmi--push-mark))
@@ -184,21 +184,42 @@ If this flag is nil, then 50 means jump 50 times.")
(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
- ))
+
+ ;; for inner text object, forward a line at the beginning
+ (cond
+ (is-inner
+ (forward-line 1)
+ (setq b (line-beginning-position)))
+ (t
+ (if (string-match "[ \t]*" (buffer-substring-no-properties
(line-beginning-position) b))
+ (setq b (line-beginning-position))
+ ;; 1+ because the line feed
+ )))
+
+ ;; for inner text object, backward a line at the end
+ (when is-inner
+ (goto-char e)
+ (forward-line -1)
+ (setq e (line-end-position)))
+ )
(list b e)))
-(evil-define-text-object evilmi-text-object (&optional NUM begin end type)
- "text object describing the region selected when you press % from
evil-matchit"
+(evil-define-text-object evilmi-inner-text-object (&optional NUM begin end
type)
+ "Inner text object describing the region selected when you press % from
evil-matchit"
+ :type line
+ (let (selected-region)
+ (setq selected-region (evilmi--region-to-select-or-delete NUM t))
+ (evil-range (car selected-region) (cadr selected-region) 'line)))
+
+(evil-define-text-object evilmi-outer-text-object (&optional NUM begin end
type)
+ "Outer text object describing the region selected when you press % from
evil-matchit"
:type line
(let (selected-region)
(setq 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-text-object)
-(define-key evil-outer-text-objects-map "%" 'evilmi-text-object)
+(define-key evil-inner-text-objects-map "%" 'evilmi-inner-text-object)
+(define-key evil-outer-text-objects-map "%" 'evilmi-outer-text-object)
;;;###autoload
(defun evilmi-select-items (&optional NUM)
@@ -251,7 +272,7 @@ If this flag is nil, then 50 means jump 50 times.")
))
;;;###autoload
-(defun evilmi-version() (interactive) (message "1.4.3"))
+(defun evilmi-version() (interactive) (message "1.5.0"))
;;;###autoload
(define-minor-mode evil-matchit-mode
diff --git a/pkg.sh b/pkg.sh
index b5b6a61ace..37488d85e6 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-pkg=evil-matchit-1.4.3
+pkg=evil-matchit-1.5.0
mkdir $pkg
cp README.org $pkg
cp *.el $pkg
- [nongnu] elpa/evil-matchit 210155ee8f 030/244: update developer guide v1.2.1, (continued)
- [nongnu] elpa/evil-matchit 210155ee8f 030/244: update developer guide v1.2.1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 369eb7ca8c 032/244: minor typo in README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 694e6fba3d 045/244: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 13c528765e 050/244: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 642fcdaf52 051/244: README updated, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit b4163c71c3 038/244: support org-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 11ba040ab0 055/244: support json-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 5bc34a6bd5 060/244: minor ruby bug, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit fcf6b25407 063/244: fortran, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 338a10ccd6 066/244: fixed: by default shortcut % is disabled, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8540a4c12a 068/244: supports inner text object, v1.5.0,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 8b4db43dc2 075/244: Merge pull request #44 from thegreatape/master, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit af40d309c6 078/244: documentation, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 89fd968ac2 080/244: spacemacs use enh-ruby-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ff29cd2264 084/244: workaround issue in python-mode v2.0.2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 63846fc4c0 089/244: Add melpa badge, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 62d948743e 092/244: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 98c045d352 094/244: Merge pull request #61 from robbyoconnor/patch-2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 94e359e30c 095/244: Fix embedded major-mode detection in org-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit c675e740a7 101/244: can simple jump in latex-mode, #70, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 34c51f68fd 102/244: jump in diff-mode, ELPA Syncer, 2022/01/06