completions: fix some completions to not look at other commands on the command line

This commit is contained in:
Johannes Altmanninger 2024-01-07 18:04:53 +01:00
parent d71aae7d3b
commit 57d7c46d22
3 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ end
# Returns 0 if we're after `env` and all previous tokens have an equal sign
function __fish_env_defining_vars
not string match -ev -- = (commandline -o)[2..-2] | string match -rq .
not string match -ev -- = (commandline -op)[2..-2] | string match -rq .
end
# Returns 0 if we're after `env` and all previous tokens have not yet contained an equal sign
@ -17,7 +17,7 @@ end
function __fish_env_redefine_vars
set -l vars (set --names -x)
set cmdline "$(commandline -o)"
set cmdline "$(commandline -op)"
for var in $vars
if not string match -e -- $var= $cmdline
echo $var=

View File

@ -290,7 +290,7 @@ function __fish_ffmpeg_complete_filter
# echo -e "\n **** $filter_type **** \n" > /dev/tty
set -l filters_arg (commandline -o)[-1]
set -l filters_arg (commandline -op)[-1]
if string match -rq -- '^-' $filters_arg
# No filter name started
__fish_ffmpeg_filters $filter_type

View File

@ -7,7 +7,7 @@ function __fish_complete_clang
set -l prefix (commandline -ct | string replace -fr -- '^(.*=)[^=]*' '$1')
# Don't hard-code the name of the clang binary
set -l clang (commandline -o)[1]
set -l clang (commandline -op)[1]
# first get the completions from clang, with the prefix separated from the value by a comma
$clang --autocomplete=(commandline -ct | string unescape | string replace -- "$prefix" "$prefix,") 2>/dev/null |
# and put it in a format that fish understands