feat: add editor tabs
This commit is contained in:
+19
-2
@@ -17,6 +17,7 @@ Default controls and editing behavior. For custom bindings, see [configuration](
|
||||
| Normal | `h`/`j`/`k`/`l` or arrows move every caret; `0`/`$` or Home/End |
|
||||
| Normal | `_` splits above/below; `\|` splits left/right; the new pane inherits the current buffer and view |
|
||||
| Normal | Option/Alt+h/j/k/l focuses the neighboring pane left/down/up/right |
|
||||
| Normal | Ctrl+Option/Alt+h/l switches to the previous/next tab, wrapping at either end |
|
||||
| Normal | `w`/`b`/`e` move every caret to next word start, previous/current word start, word end; `W`/`B`/`E` for whitespace-delimited WORDs |
|
||||
| Normal, Visual | `f<char>` seeks forward on the current line; `F<char>` seeks backward; `2fx` finds the second `x` after each caret |
|
||||
| Normal | `gf` follows a Markdown file link or heading fragment at the primary caret |
|
||||
@@ -194,8 +195,9 @@ Closing a pane gives its space to its sibling:
|
||||
| --- | --- | --- |
|
||||
| Clean buffer displayed only here | Close pane and buffer | Same |
|
||||
| Dirty buffer displayed only here | Refuse; save or force-close explicitly | Discard edits and close pane and buffer |
|
||||
| Buffer also displayed in another pane | Close only this pane; retain the buffer and edits | Same |
|
||||
| Last workspace pane | Quit only if every open buffer is clean, including hidden buffers | Quit without saving |
|
||||
| Buffer also displayed in another pane or tab | Close only this pane; retain the buffer and edits | Same |
|
||||
| Last pane in a tab, with other tabs open | Close the tab using the same shared-buffer and unsaved-change rules | Same, discarding only exclusively displayed edits |
|
||||
| Last pane in the last tab | Quit only if every open buffer is clean, including hidden buffers | Quit without saving |
|
||||
|
||||
There is no default close-pane binding. Option must send Alt/Meta in the terminal; on macOS, configure the terminal's Option-key behavior if it instead produces special characters. These bindings do not replace existing Ctrl+j or uppercase motion/edit bindings.
|
||||
|
||||
@@ -205,6 +207,21 @@ Floating windows overlay the entire editor, above all workspace panes. File pick
|
||||
|
||||
Diff comparisons reuse the split geometry and directional-focus engine. Option/Alt navigation moves between Before, After, and Files first, then to a neighboring workspace pane when there is no internal target in that direction. Splitting a diff text view creates an ordinary sibling showing the same buffer; historical snapshots remain read-only, including after the comparison closes.
|
||||
|
||||
## Tabs
|
||||
|
||||
Use `:tab.new` to open the current buffer in a new, focused tab with one pane. Each tab preserves its split layout, focused pane, explorer, and comparison. Buffers and undo/redo history remain shared; carets, selections, searches, wrapping, and scroll positions are independent views. Opening a historical diff buffer in a tab keeps it read-only, even after the source comparison closes.
|
||||
|
||||
| Canonical command | Typed action | Behavior |
|
||||
| --- | --- | --- |
|
||||
| `:tab.new` | `config.core.tab.new` | Open the current buffer in a new tab |
|
||||
| `:tab.previous` / `:tab.next` | `config.core.tab.previous` / `config.core.tab.next` | Switch tabs, wrapping at either end; Ctrl+Option/Alt+h/l in Normal |
|
||||
| `:tab.close` | `config.core.tab.close` | Close the current tab and all its panes, protecting unsaved changes |
|
||||
| `:tab.force_close` | `config.core.tab.force_close` | Explicitly discard exclusively displayed edits and close the tab |
|
||||
|
||||
Multiple tabs show a top row with numbered filenames, dirty markers, and an active-tab highlight. Narrow terminals keep the active tab visible. New/close actions have no default keybinding; for example, `config.bind "leader t", config.core.tab.new`.
|
||||
|
||||
Closing a tab refuses dirty buffers whose final displayed owner would disappear, including a comparison's working and return buffers. Buffers displayed in another tab remain open with their edits, even on force-close. Other hidden buffers remain loaded. Closing the last tab quits only if every open buffer is clean; force-close quits without saving.
|
||||
|
||||
## Buffers
|
||||
|
||||
Each buffer retains its shared text, path, saved state, and undo/redo history. View state is retained separately for each pane and buffer. Caret-following adjusts that view's offsets as needed; mouse-wheel scrolling can temporarily detach it from the caret. Clipboard fragments, bindings, plugin hosts, and plugin retirement remain session-wide. Plugin context and effects refer to the focused pane's active buffer.
|
||||
|
||||
Reference in New Issue
Block a user