Skip to content

Commit

Permalink
gt/gT = add goto Nth tab behavior
Browse files Browse the repository at this point in the history
As it does in vim.
  • Loading branch information
hlissner committed Jun 5, 2021
1 parent a2871e6 commit ea80826
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/editor/evil/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ directives. By default, this only recognizes C directives.")
:n "]w" #'+workspace/switch-right
:n "[w" #'+workspace/switch-left)
(:when (featurep! :ui tabs)
:n "gt" #'centaur-tabs-forward
:n "gT" #'centaur-tabs-backward)
:n "gt" #'+tabs:next-or-goto
:n "gT" #'+tabs:previous-or-got)

;; custom vim-unmpaired-esque keys
:m "]#" #'+evil/next-preproc-directive
Expand Down
18 changes: 18 additions & 0 deletions modules/ui/tabs/autoload.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
;;; ui/tabs/autoload.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil)

;;;###autoload (autoload '+tabs:next-or-goto "ui/tabs/autoload" nil t)
(evil-define-command +tabs:next-or-goto (index)
"Switch to the next tab, or to INDEXth tab if a count is given."
(interactive "<C>")
(if current-prefix-arg
(centaur-tabs-select-visible-nth-tab current-prefix-arg)
(centaur-tabs-forward)))

;;;###autoload (autoload '+tabs:previous-or-goto "ui/tabs/autoload" nil t)
(evil-define-command +tabs:previous-or-goto (index)
"Switch to the previous tab, or to INDEXth tab if a count is given."
(interactive "<C>")
(if current-prefix-arg
(centaur-tabs-select-visible-nth-tab current-prefix-arg)
(centaur-tabs-backward)))

0 comments on commit ea80826

Please sign in to comment.