Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions completions/man
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ _man()
fi

# shellcheck disable=SC2053
if [[ $prev != $mansect ]]; then
# File based completion for the rest, prepending ./ if needed
if [[ $prev != $mansect && -z ${COMPREPLY-} ]]; then
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could instead loop through the completions found before start below and check and remove duplicates from file based ones, but that'd be very slow when there are lots of man page completions from man path (e.g. man <TAB> gives 9000+ on the system I'm looking at).

# File based completion, prepending ./ if needed
# (man 1.6f needs that for man pages in current dir)
local i start=${#COMPREPLY[@]}
local i
_filedir "$manext"
for ((i = start; i < ${#COMPREPLY[@]}; i++)); do
for i in "${!COMPREPLY[@]}"; do
[[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}
done
fi
Expand Down