Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement tabmove #1776

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,15 @@ the right edge."
(message "%s: hscroll-margin = %d" this-command hscroll-margin))
(evil-scroll-column-left (- dist-from-right-edge (abs (* 2 hscroll-margin))))))

(when (featurep 'tab-bar)
(evil-define-command evil-tab-move (index-or-offset relative)
"Move the current tab to INDEX-OR-OFFSET. Treat as offset if
RELATIVE is non-nil."
(interactive "<+N>")
(if relative
(tab-bar-move-tab index-or-offset)
(tab-bar-move-tab-to index-or-offset))))

(evil-define-command evil-scroll-start-column ()
"Scroll the window to position the cursor at the start (left side) of the screen.
Warn if `hscroll-margin' > 0, as cursor will be `hscroll-margin' chars from
Expand Down
1 change: 1 addition & 0 deletions evil-maps.el
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ included in `evil-insert-state-bindings' by default."
(evil-ex-define-cmd "red[o]" 'evil-redo)

(when (featurep 'tab-bar)
(evil-ex-define-cmd "tabm[ove]" 'evil-tab-move)
(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)
Expand Down
20 changes: 20 additions & 0 deletions evil-types.el
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,26 @@ If visual state is inactive then those values are nil."
((evil-ex-p) nil)
(t 1))))

(evil-define-interactive-code "<+N>" ()
"Prefix argument or ex-arg, converted to number. Allow prefixing
the number with +/- to indicate that this should be treated as
a relative value instead of absolute."
(list
(cond
(current-prefix-arg (prefix-numeric-value current-prefix-arg))
((and evil-ex-argument (evil-ex-p))
(cond
;; Required, since `string-to-number' parses these as 0.
((string-equal evil-ex-argument "+") 1)
((string-equal evil-ex-argument "-") -1)
(t (string-to-number evil-ex-argument))))
((evil-ex-p) nil)
(t 1))
(cond
((and evil-ex-argument (evil-ex-p))
(memq (string-to-char evil-ex-argument) '(?- ?+)))
(t nil))))

(evil-define-interactive-code "<f>"
"Ex file argument."
:ex-arg file
Expand Down