feat(term): open terminals in normal mode, hardcode q as close#324
Merged
barrettruth merged 1 commit intomainfrom Apr 19, 2026
Merged
feat(term): open terminals in normal mode, hardcode q as close#324barrettruth merged 1 commit intomainfrom
barrettruth merged 1 commit intomainfrom
Conversation
Forge terminal buffers (CI watch, checks live-tail) previously opened with startinsert, which put the cursor in terminal mode. The q keymap was wired in normal mode only, so q pressed immediately after the terminal opened was sent to the underlying shell instead of closing the buffer — a consistent UX wart reported in #310. Flip the default so term.open stays in normal mode unless startinsert is explicitly requested. This makes the q close keymap (and the existing gx browse and <cr> enter keymaps) work immediately without any <C-\><C-n> dance. For the commands we actually run (gh run watch, glab ci trace, etc.) the terminal is a passive stream — users are reading, not typing — so normal mode is the right default. Also hardcode q as the close key for terminal, static log, and summary buffers. Let users configure step/error navigation, browse, and refresh via keys.log; close is conventional and across enough of vim (quickfix/help/messages/diffview/trouble) that making it a config knob added surface area without real value. keys.log.close is removed from defaults, validation, and the forge.LogViewerKeys annotation. The existing startinsert = false callsite in ops.lua is dropped since false is now the default. Closes #310
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Forge's terminal buffers (CI watch, checks live-tail) opened with `startinsert`, leaving the cursor in terminal mode. The `q` close keymap was only registered in normal mode, so pressing `q` right after the buffer opened sent a literal `q` to the underlying shell instead of closing the buffer — users had to `<C-\>q` to get out. The `keys.log.close` config key also existed as a customization point for an action ("close this viewer") that has a strong cross-vim convention (`q` in quickfix, help, diffview, trouble, fugitive) and doesn't benefit from being tunable.
Solution
Flip `term.open`'s default so terminals open in normal mode; callers that genuinely need insert mode can still pass `startinsert = true`. Hardcode `q` as the close key across terminal, static log, and summary buffers, and remove `keys.log.close` from config defaults, validation, and the `forge.LogViewerKeys` annotation. The rest of `keys.log` (navigation, browse, refresh) stays configurable since those are forge-specific and less conventional. Tests cover the new default (no insert unless requested) and verify `q` actually closes the buffer.