Skip to content
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

Show manpage for command under cursor in __fish_man_page #9020

Merged
merged 1 commit into from Jun 17, 2022
Merged

Show manpage for command under cursor in __fish_man_page #9020

merged 1 commit into from Jun 17, 2022

Conversation

newsch
Copy link
Contributor

@newsch newsch commented Jun 16, 2022

Description

This lets you check the manpage for a leading command by moving
the cursor over it, matching the behavior of tab complete.

It also lets you select the man page for the base of a two-part command
like string match.

I added the additional regex case because
commandline -t returns an empty string when the cursor is after a
space, e.g. at the end of 'sudo ', which the later checks don't handle.

This diagram shows the manpage picked for different cursor positions:

> sudo -Es time git commit -m foo
  +-------++---++--++------------+
  |       ||   ||  ||            |
  |       ||   ||  |+------------+
  |       ||   ||  |  git-commit
  |       ||   |+--+
  |       ||   | git
  |       |+---+
  |       | time
  +-------+
     sudo

asciicast

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

This commit lets you check the manpage for a leading command by moving
the cursor over it, matching the behavior of tab complete.

It also lets you select the man page for the base of a two-part command
like `string match`.

The additional regex case is added because
`commandline -t` returns an empty string when the cursor is after a
space, e.g. at the end of 'sudo ', which the later checks don't handle.

This diagram shows the manpage picked for different cursor positions:

    > sudo -Es time git commit -m foo
      +-------++---++--++------------+
      |       ||   ||  ||            |
      |       ||   ||  |+------------+
      |       ||   ||  |  git-commit
      |       ||   |+--+
      |       ||   | git
      |       |+---+
      |       | time
      +-------+
         sudo
@krobelus krobelus merged commit a605bcb into fish-shell:master Jun 17, 2022
@krobelus krobelus added this to the fish 3.6.0 milestone Jun 17, 2022
krobelus added a commit that referenced this pull request Jun 17, 2022
@krobelus
Copy link
Member

great change, thanks!

@newsch newsch deleted the man-show-current branch June 19, 2022 18:39
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants