mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:57:30 +08:00
completions: fix some completions to not look at other commands on the command line
This commit is contained in:
parent
d71aae7d3b
commit
57d7c46d22
|
@ -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=
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user