mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Fix man autocomplete when a section is set
This commit is contained in:
parent
4414d5c888
commit
3792fb086a
1 changed files with 10 additions and 2 deletions
|
@ -15,6 +15,12 @@ function __fish_complete_man
|
||||||
set -e prev[1]
|
set -e prev[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set -l exclude_fish_commands
|
||||||
|
# Only include fish commands when section is empty or 1
|
||||||
|
if test -z "$section" -o "$section" = "1"
|
||||||
|
set -e exclude_fish_commands
|
||||||
|
end
|
||||||
|
|
||||||
set section $section"[^)]*"
|
set section $section"[^)]*"
|
||||||
# If we don't have a token but a section, list all pages for that section.
|
# If we don't have a token but a section, list all pages for that section.
|
||||||
# Don't do it for all sections because that would be overwhelming.
|
# Don't do it for all sections because that would be overwhelming.
|
||||||
|
@ -63,8 +69,10 @@ function __fish_complete_man
|
||||||
'
|
'
|
||||||
|
|
||||||
# Fish commands are not given by apropos
|
# Fish commands are not given by apropos
|
||||||
|
if not set -ql exclude_fish_commands
|
||||||
set -l files $__fish_datadir/man/man1/*.1
|
set -l files $__fish_datadir/man/man1/*.1
|
||||||
string replace -r '.*/([^/]+)\.1$' '$1\t1: fish command' -- $files
|
string replace -r '.*/([^/]+)\.1$' '$1\t1: fish command' -- $files
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue