Skip to content

feat: expose TabsVim_* public functions, remove all OOTB keybindings#11

Merged
jesse23 merged 4 commits into
devfrom
feat/expose-functions
Apr 5, 2026
Merged

feat: expose TabsVim_* public functions, remove all OOTB keybindings#11
jesse23 merged 4 commits into
devfrom
feat/expose-functions

Conversation

@jesse23
Copy link
Copy Markdown
Owner

@jesse23 jesse23 commented Apr 4, 2026

Summary

  • Removes all hard-coded keybindings from the plugin; only mouse drag-and-drop (bracketed-paste infrastructure) remains OOTB
  • Promotes 6 logic-heavy operations to a stable public TabsVim_* function API: ToggleHorizTerm, ToggleVertTerm, NewTabTerm, CloseOrHide, RenameBuffer, FzfOpenInTab
  • Simple native commands (:tabnew, :sp, :tabonly, etc.) are documented as direct vimrc mappings — no wrapper exposed
  • Adds ADR-004 and new key-binding SPEC documenting the public API, recommended vimrc wiring, and trade-off notes for g<number> and <C-]>

Test plan

  • Verify TabsVim_ToggleHorizTerm / TabsVim_ToggleVertTerm toggle persistent split terminals
  • Verify TabsVim_NewTabTerm opens terminal in a new tab with nobuflisted
  • Verify TabsVim_CloseOrHide prompts on last window, hides terminal, closes normal split
  • Verify TabsVim_RenameBuffer prompts and renames buffer
  • Verify TabsVim_FzfOpenInTab opens fzf with tabedit sink (requires fzf.vim)
  • Verify mouse drag-and-drop still opens files in new tab
  • Verify no stray keybindings are installed by the plugin

jesse23 and others added 3 commits April 4, 2026 16:43
Defines the decision to expose TabsVim_* public functions and remove
all OOTB keybindings except mouse DnD infrastructure. Documents the
full public function API, recommended vimrc wiring, and trade-off
notes for g<number>, <C-]>, and terminal navigation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Promotes functions with real logic to public API (ToggleHorizTerm,
ToggleVertTerm, NewTabTerm, CloseOrHide, RenameBuffer, FzfOpenInTab).
Removes all nnoremap/tnoremap bindings from the plugin — mouse DnD
infrastructure is the only OOTB behavior retained. Simple native
commands (tabnew, sp, tabonly, etc.) are documented as direct vimrc
mappings with no wrapper. Updates ADR-004 and key-binding SPEC.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors tabs.vim to stop installing user keymaps by default and instead exposes a small public TabsVim_* function API, with new documentation (SPEC + ADR) describing recommended user-side vimrc mappings and the rationale for removing hard-coded bindings.

Changes:

  • Removed all user-facing OOTB keybindings from plugin/tabs.vim and promoted several script-local operations to public TabsVim_* functions.
  • Added a new key-binding SPEC documenting the public API and suggested vimrc wiring patterns.
  • Added ADR-004 documenting the decision/trade-offs for keybinding cleanup.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
plugin/tabs.vim Removes hard-coded mappings and exposes public TabsVim_* functions for terminal/window/buffer operations and fzf integration.
docs/specs/key-binding.md New SPEC describing “no OOTB keybindings” posture, public function API, and recommended vimrc mappings.
docs/adrs/004.tabs-vim.keybinding-cleanup.md New ADR explaining why keybindings were removed and why a public function API is the preferred contract.
Comments suppressed due to low confidence (1)

plugin/tabs.vim:80

  • TabsVim_CloseOrHide() uses winnr('$') == 1 to decide whether to prompt and qall!. winnr('$') is per tab page, so this will incorrectly prompt to quit when closing the only window in a tab even if other tabs exist. Consider checking both tabpagenr('$') == 1 and winnr('$') == 1 (or an equivalent “last tab + last window” condition) before prompting/qall!, and otherwise just close the window/tab normally.
function! TabsVim_CloseOrHide() abort
  if winnr('$') == 1
    if confirm('Quit Vim?', "&Yes\n&No", 2) == 1
      qall!
    endif
    return
  endif

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/tabs.vim
Comment thread docs/specs/key-binding.md Outdated
Comment thread docs/specs/key-binding.md
Comment thread docs/specs/key-binding.md
Comment thread docs/specs/key-binding.md
Comment thread docs/specs/key-binding.md Outdated
Comment thread docs/adrs/004.tabs-vim.keybinding-cleanup.md
Comment thread docs/adrs/004.tabs-vim.keybinding-cleanup.md
Comment thread plugin/tabs.vim
- TabsVim_CloseOrHide: check tabpagenr('$')==1 && winnr('$')==1 before
  quit prompt so closing last window in a tab doesn't wrongly quit Vim
- TabsVim_CloseOrHide: only toggle-hide tracked terminal bufnrs; untracked
  terminals (e.g. tab terminals) now fall back to plain close
- TabsVim_FzfOpenInTab: guard against missing fzf.vim with clear warning
- key-binding SPEC: clarify "no user-facing keybindings" to avoid
  contradiction with internal F30/F31 DnD aliases
- key-binding SPEC: mark all features as done (✅)
- tabs.vim SPEC: add reference to key-binding SPEC in Related Specs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jesse23
Copy link
Copy Markdown
Owner Author

jesse23 commented Apr 4, 2026

Addressed all Copilot review comments in 770f02b:

plugin/tabs.vim:107TabsVim_FzfOpenInTab: added guard for exists('*fzf#vim#files') and exists('*fzf#vim#with_preview'); shows a clear WarningMsg and returns early if fzf.vim is not available.

plugin/tabs.vim:77TabsVim_CloseOrHide: untracked terminal buffers (e.g. tab terminals from TabsVim_NewTabTerm) now fall back to plain close instead of incorrectly toggling a split terminal. Only bufnrs matching s:term_bufnr or s:vterm_bufnr are toggle-hidden.

plugin/tabs.vim:80 (suppressed) — TabsVim_CloseOrHide: quit prompt now checks tabpagenr('$') == 1 && winnr('$') == 1 so closing the last window in a tab with other tabs open no longer prompts to quit Vim.

docs/specs/key-binding.md:21 — Rephrased to "no user-facing keybindings"; clarified that <F30>/<F31> are internal DnD aliases, not user-facing mappings.

docs/specs/key-binding.md:129 — Features table updated to ✅ since this PR implements all three items.

docs/adrs/004:55 — Updated docs/specs/tabs.vim.md to add a reference to key-binding.md in the Related Specs section, fulfilling what the ADR claimed.

docs/specs/key-binding.md:35,43,49 / docs/adrs/004:45 — The || table || comments appear to be false positives. The tables use standard GFM format (| col | col |) with correct separator rows. They render correctly on GitHub.

@jesse23 jesse23 merged commit b094bea into dev Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants