-
Notifications
You must be signed in to change notification settings - Fork 0
feat: expose TabsVim_* public functions and ecosystem support #12
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # 005. Ecosystem Support — FlogInTab and Ecosystem Buffer Close | ||
|
|
||
| **SPEC:** ecosystem-support | ||
| **Status:** Accepted | ||
| **Last Updated:** 2026-04-05 | ||
|
|
||
| --- | ||
|
|
||
| ## Decision | ||
|
|
||
| Add two ecosystem integration features to `plugin/tabs.vim`: | ||
|
|
||
| 1. **`TabsVim_FlogInTab()`** — opens vim-flog's full-repo git log in a new tab via `Flogsplit -open-cmd=tabedit -all`. Guards with `exists(':Flogsplit')` and emits a warning if vim-flog is not loaded. Exposed as a `TabsVim_*` function (rather than a vimrc one-liner) for the same discoverability reason as `TabsVim_FzfOpenInTab()` — users exploring the API should not need to inspect vim-flog's command syntax. | ||
|
|
||
| 2. **`g:tabs_vim_tabclose_types` autocmd** — reads a user-supplied list of tokens at plugin load time and installs buffer-local `q` → `:tabclose` mappings for matching filetypes or conditions. Default is empty (no OOTB behavior). Supported tokens: `'floggraph'`, `'git'`, `'diff'`; any other string is treated as a `FileType` name. | ||
|
|
||
| --- | ||
|
|
||
| ## Context | ||
|
|
||
| Users who open ecosystem tool outputs (flog graph, fugitive commit view, vimdiff) in tabs consistently need two things: | ||
|
|
||
| 1. A single command to open the tool in a new tab (the same pattern `TabsVim_FzfOpenInTab()` already established for fzf). | ||
| 2. A `q` binding to close the whole tab when done — the "modal overlay" mental model. | ||
|
|
||
| Without plugin support, users must write three separate augroups in their vimrc, each guarding a different filetype or buffer condition. This is boilerplate that belongs in the plugin because: | ||
| - It is tab-scoped behavior (`:tabclose`, not `:q` or `:close`) | ||
| - The same pattern repeats identically for every ecosystem tool | ||
| - It is discoverable — users looking for tab integrations will find it here | ||
|
|
||
| The `diff` condition (`WinEnter` + `&diff`) requires special handling (not a FileType) but is common enough to be a first-class supported token. | ||
|
|
||
| --- | ||
|
|
||
| ## Considered Options | ||
|
|
||
| | Option | Pros | Cons | | ||
| |--------|------|------| | ||
| | **`g:tabs_vim_tabclose_types` list, default empty** *(chosen)* | Opt-in; consistent with ADR-004 (no OOTB bindings); name reflects buffer types not just filetypes | Requires one vimrc line to activate | | ||
| | Always-on autocmd for hardcoded filetypes | Zero config | Imposes behavior on users who manage their own `q` bindings for these tools | | ||
| | No autocmd; document pattern in key-binding.md | Zero plugin complexity | Users copy the same boilerplate repeatedly; no discoverability | | ||
| | Per-tool boolean flags (`g:tabs_vim_flog_close`, etc.) | Granular opt-in | Proliferates config variables for a single repeated pattern | | ||
|
|
||
| The list-based approach keeps one config axis while remaining extensible. Any filetype string works, so users with tools not listed here (e.g. `'fugitiveblame'`, `'GV'`) can add them without plugin changes. | ||
|
|
||
| --- | ||
|
|
||
| ## Consequences | ||
|
|
||
| - `TabsVim_FlogInTab()` is added to the Public Function API in `key-binding.md` under a new "Git Integration" section. | ||
| - `g:tabs_vim_tabclose_types` is documented in both `ecosystem-support.md` and the recommended vimrc block in `key-binding.md`. | ||
| - The plugin continues to install zero OOTB keybindings (ADR-004 is not affected); the autocmd only fires if the user sets `g:tabs_vim_tabclose_types`. | ||
| - Users with existing manual augroups for `q` → `:tabclose` can migrate to the config or leave their vimrc unchanged — both work. | ||
| - `diff` handling uses `WinEnter` + `&diff` guard (matching the existing vimrc pattern) rather than a filetype, since vimdiff buffers don't have a dedicated filetype. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # SPEC: Ecosystem Support | ||
|
|
||
| **Last Updated:** 2026-04-05 | ||
|
|
||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Defines tab-aware integration functions for common Vim ecosystem plugins. The plugin already exposes `TabsVim_FzfOpenInTab()` for fzf. This spec extends that pattern to cover vim-flog (git log viewer) and establishes a configurable autocmd for binding `q` → `:tabclose` in ecosystem tool buffers (flog graph, fugitive, vimdiff). | ||
|
|
||
| The common workflow: open a tool's output in a dedicated tab, then press `q` to close the whole tab when done — the same mental model as a modal overlay. Without plugin support, users must replicate three separate augroups across their vimrc. | ||
|
|
||
| **Persona:** Vim/Neovim users with fzf, vim-flog, and/or vim-fugitive in their setup who open those tools' outputs in tabs. | ||
|
|
||
| --- | ||
|
|
||
| ## Features | ||
|
|
||
| | Feature | Description | ADR | Done? | | ||
| |---------|-------------|-----|-------| | ||
| | **`TabsVim_FlogInTab()`** | Open vim-flog git log in a new tab (`Flogsplit -open-cmd=tabedit -all`) | ADR-005 | ⬜ | | ||
| | **Ecosystem buffer close** | `g:tabs_vim_tabclose_types` list: buffer types/conditions that get `q` → `:tabclose` auto-wired | ADR-005 | ⬜ | | ||
|
|
||
| --- | ||
|
|
||
| ## Public Function API | ||
|
|
||
| ### Git Integration | ||
|
|
||
| | Function | Description | | ||
| |----------|-------------| | ||
| | `TabsVim_FlogInTab()` | Open vim-flog full-repo git log in a new tab (requires vim-flog) | | ||
|
|
||
| ### Ecosystem Buffer Close | ||
|
|
||
| No function — controlled by config only (see below). | ||
|
|
||
| --- | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### `g:tabs_vim_tabclose_types` | ||
|
|
||
| A list of buffer type tokens. For each entry the plugin installs a buffer-local `q` → `:tabclose` mapping. Default is empty (no OOTB behavior). | ||
|
|
||
| ```vim | ||
| " opt-in example — must be set before the plugin loads (i.e. before plug#end()) | ||
| let g:tabs_vim_tabclose_types = ['floggraph', 'git', 'diff'] | ||
| ``` | ||
|
|
||
| Supported entry values: | ||
|
|
||
| | Value | Trigger condition | Typical source | | ||
| |-------|-------------------|----------------| | ||
| | `'floggraph'` | `FileType floggraph` | vim-flog graph buffer | | ||
| | `'git'` | `FileType git` | vim-fugitive commit/status buffer | | ||
| | `'diff'` | `WinEnter` with `&diff` set | vimdiff / `Gdiffsplit` | | ||
|
|
||
| Users may pass any valid `FileType` name to cover other tools (e.g. `'fugitiveblame'`). | ||
|
|
||
| --- | ||
|
|
||
| ## Recommended vimrc Wiring | ||
|
|
||
| ```vim | ||
| " ── Git log ────────────────────────────────────────────────────────────────── | ||
| nnoremap <silent> <leader>gg :call TabsVim_FlogInTab()<CR> | ||
|
|
||
| " ── Ecosystem buffer close (q → :tabclose) ─────────────────────────────────── | ||
| let g:tabs_vim_tabclose_types = ['floggraph', 'git', 'diff'] | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Related | ||
|
|
||
| - [key-binding.md](key-binding.md) — full public function API and vimrc wiring reference | ||
| - ADR-005 — decision record for this spec | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.