Skip to content

Add GNU "less" style navigation to --pager view #101

@andrewwillowen

Description

@andrewwillowen

Proposed Enhancement

I propose adding some of the basic GNU less navigation shortcuts to the --pager view.

Background

I enjoy the formatting and syntax highlighting that the rich CLI provides and want to use the --pager option to be able to quickly navigate the document while maintaining the rich display.

I use GNU less for most of my document paging needs and so found myself instinctively trying to use its navigation shortcuts in the --pager view, which of course failed. The current navigation shortcuts for the --pager view feel clunky, as well as incomplete. (Seems loosely inspired by vi, which is fine, but I prefer less over vi when I need to page through a large document because of the single-key navigation commands.)

Changes

Looks like the changes need to be applied to the pager.PagerApp.on_key() method. Since the existing shortcuts don't collide with the less shortcuts, can simply add additional elif statements, which means the prior functionality will be maintained (and not break other people's muscle memory).

Corresponding PR inbound shortly.

Additional context

Ideally, as suggested in #19 (comment) , it would be great to have several of the more common navigation keybindings available with the --pager view. Perhaps with a set of --pager-<bindings-scheme> options, e.g., --pager-emacs or --pager-vi? That seems like a more extensive set of changes than what I'm proposing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions