Ash RuDral1 downloadsOpens new tabs, via the command palette or your configured hotkey, directly next to the active tab instead of at the end of the tab strip.
Makes new tabs — from the "+" button, the command palette, or your configured "New tab" hotkey — open directly next to the active tab, instead of at the end of the tab strip.
.obsidian/plugins/.new-tab-here.manifest.json and main.js into that folder.No build step needed — main.js is plain JS that Obsidian loads directly.
There are two independent interception paths, because Obsidian's core "New tab" command turned out to be reachable in ways that don't all go through the same code path:
executeCommandById on the "New tab"
command. The command is located dynamically (by id, with a name-based
fallback) so a future Obsidian rename doesn't disable this. Both
callback and checkCallback are wrapped, since it's not guaranteed
which one a given Obsidian version uses.keydown listener on document (capture
phase) that fires before Obsidian's own key handling. This exists
because pressing the "New tab" hotkey doesn't reliably route through the
patched command object the way palette invocation does — Obsidian
appears to resolve some core hotkeys through a lower-level keymap. The
listener reads your actual configured hotkey for "New tab" (custom or
default) via Obsidian's hotkey manager, so it keeps working if you ever
rebind it, falling back to Ctrl/Cmd+T only if that lookup isn't
available.Both paths call the same placement logic:
Workspace.createLeafInParent(parent, index)
API to insert the new leaf directly at the correct position — no
after-the-fact shuffling needed.type: 'empty')
and focus it.Rather than building an independent new-tab feature with its own hotkey, this hooks the single command Obsidian already uses for every "New tab" trigger, plus a hotkey-level safety net for the one trigger that doesn't reliably go through that command. That keeps the change scoped: only "New tab" behavior is touched, and core's own tab-creation, history, and session logic still does the actual work.
try/catch. Worst case, a tab
opens at the end (core's default) rather than the plugin breaking tab
creation or corrupting your layout.The fallback reposition path (only used if createLeafInParent fails)
depends on undocumented internals (WorkspaceTabs.children,
WorkspaceLeaf.tabHeaderEl). A major Obsidian UI rewrite could disable
just that fallback; the primary createLeafInParent path is public API and
much less likely to be affected.
See CONTRIBUTING.md for how to build, release, and submit changes to this plugin.