[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil d6d2e5d2b1: tabs: Go to nth tab when tab-next is pref
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil d6d2e5d2b1: tabs: Go to nth tab when tab-next is prefixed |
Date: |
Mon, 28 Aug 2023 09:59:09 -0400 (EDT) |
branch: elpa/evil
commit d6d2e5d2b170eb0ab3bec488868702009a0ee3b6
Author: Ankit Pandey <anpandey@protonmail.com>
Commit: Axel Forsman <axelsfor@gmail.com>
tabs: Go to nth tab when tab-next is prefixed
This emulates the behavior of vim, where {N}gt goes to the Nth tab,
but {N}gT goes back N tabs.
---
evil-commands.el | 12 ++++++++++++
evil-maps.el | 6 +++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/evil-commands.el b/evil-commands.el
index 3d625a791e..2198a0c4c7 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -4782,6 +4782,18 @@ and redisplay the current buffer there."
:repeat nil
(evil-move-window 'below))
+;;; Tab commands
+
+(evil-define-command evil-tab-next (arg)
+ "Switch to the next tab.
+If ARG is non-nil, parse ARG as an index and go to the tab at that
+index."
+ :repeat nil
+ (interactive "<c>")
+ (if arg
+ (tab-bar-select-tab arg)
+ (tab-bar-switch-to-next-tab)))
+
;;; Mouse handling
;; Large parts of this code are taken from mouse.el which is
diff --git a/evil-maps.el b/evil-maps.el
index f263a63ee4..2834d5a87f 100644
--- a/evil-maps.el
+++ b/evil-maps.el
@@ -189,8 +189,8 @@
(define-key evil-window-map [C-right] 'evil-window-right)
(when (featurep 'tab-bar)
- (define-key evil-motion-state-map "gt" 'tab-bar-switch-to-next-tab)
- (define-key evil-window-map "gt" 'tab-bar-switch-to-next-tab)
+ (define-key evil-motion-state-map "gt" 'evil-tab-next)
+ (define-key evil-window-map "gt" 'evil-tab-next)
(define-key evil-motion-state-map "gT" 'tab-bar-switch-to-prev-tab)
(define-key evil-window-map "gT" 'tab-bar-switch-to-prev-tab))
@@ -588,7 +588,7 @@ included in `evil-insert-state-bindings' by default."
(evil-ex-define-cmd "tabnew" 'tab-bar-new-tab)
(evil-ex-define-cmd "tabc[lose]" 'tab-bar-close-tab)
(evil-ex-define-cmd "tabo[nly]" 'tab-bar-close-other-tabs)
- (evil-ex-define-cmd "tabn[ext]" 'tab-bar-switch-to-next-tab)
+ (evil-ex-define-cmd "tabn[ext]" 'evil-tab-next)
(evil-ex-define-cmd "tabp[revious]" 'tab-bar-switch-to-prev-tab))
;; Command-line editing
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil d6d2e5d2b1: tabs: Go to nth tab when tab-next is prefixed,
ELPA Syncer <=