From f1ceadc2d0aa4d707c9ae166c2c7f31094150c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Gonz=C3=A1lez=20Moratona?= Date: Mon, 31 Aug 2026 00:45:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Fix=20#5045:=20add=20optional=20?= =?UTF-8?q?tab=20argument=20to=20:tabmove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tabmove now accepts a second, optional argument selecting which tab to move (resolved via tabFromIndex), defaulting to the current tab. This makes `ex.execute_ex_on_completion_args tabmove -1` operate on the tab selected in the buffer list instead of always the active one. --- src/excmds.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/excmds.ts b/src/excmds.ts index c3e0f184..6b8b2fda 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -3338,7 +3338,7 @@ export async function undo(item = "recent"): Promise { } /** - * Move the current tab to be just in front of the index specified. + * Move a tab, defaulting to the current one, to be just in front of the index specified. * * Known bug: This supports relative movement with `tabmove +pos` and `tabmove -pos`, but autocomplete doesn't know that yet and will override positive and negative indexes. * @@ -3349,10 +3349,12 @@ export async function undo(item = "recent"): Promise { * @param index New index for the current tab. * * 1,start,^ are aliases for the first index. 0,end,$ are aliases for the last index. + * + * @param tabToMove Which tab to move. Defaults to the current tab. */ //#background -export async function tabmove(index = "$") { - const aTab = await activeTab() +export async function tabmove(index = "$", tabToMove?: string) { + const aTab = await tabFromIndex(tabToMove) if (index === "#") { const previousTab = await prevActiveTab() if (previousTab.index - aTab.index === 1) {