charmbracelet / charmbracelet/glow

File list: add a reachable "open" key symmetric with h/left back navigation

Open Beginner friendly
#1,024 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
27.3k
Forks
762
Avg merge
3m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**

In the TUI file list, opening the selected document is bound to `enter` only. Going back from a document to the list is bound to `h`, `left`, and `delete` (`ui/ui.go`). For anyone navigating with hjkl this is asymmetric: `h` takes you back, but there is no "forward" key to open — you have to reach for `enter`.

This was raised before in #254 and closed. At that time the objection was that `h`/`l` are used for prev/next page in the file browser, so `l` could not be remapped to "open". That is still true today: the list passes keys to `bubbles/paginator`, whose default keymap binds `h`/`left`/`pgup` to PrevPage and `l`/`right`/`pgdown` to NextPage.

**Describe the solution you'd like**

Add `space` as an "open document" key in the file list, alongside `enter`. `space` is currently unused in the list view, and @meowgorithm already suggested it in #254:

```go
// ui/stash.go, handleDocumentBrowsing
case keyEnter, " ":
```

`space` is easier to reach than `enter` and does not collide with paginator paging.

**Describe alternatives you've considered**

- `l` / `right` to open, but only when the list fits on a single page (no paging to conflict with). This restores the hjkl symmetry in the common case, at the cost of a context-dependent binding.
- A full configurable keymap (#850, PR #917), which is a much larger change.

**Additional context**

glow 3.0.0. Happy to send a PR for the `space` binding if that is acceptable.

Contributor guide

Open the contributing guide

Research direction

Start in ui/stash.go at handleDocumentBrowsing, where the existing enter binding opens the selected document. Check the surrounding file-list handling and ui/ui.go navigation bindings to confirm that space is unused and does not conflict with paginator keys. Done means pressing space opens the selected document just like enter.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.