mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
completions: fix some completions to not look at other commands on the command line
This commit is contained in:
parent
d71aae7d3b
commit
57d7c46d22
3 changed files with 4 additions and 4 deletions
|
@ -5,7 +5,7 @@ end
|
||||||
|
|
||||||
# Returns 0 if we're after `env` and all previous tokens have an equal sign
|
# Returns 0 if we're after `env` and all previous tokens have an equal sign
|
||||||
function __fish_env_defining_vars
|
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
|
end
|
||||||
|
|
||||||
# Returns 0 if we're after `env` and all previous tokens have not yet contained an equal sign
|
# 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
|
function __fish_env_redefine_vars
|
||||||
set -l vars (set --names -x)
|
set -l vars (set --names -x)
|
||||||
|
|
||||||
set cmdline "$(commandline -o)"
|
set cmdline "$(commandline -op)"
|
||||||
for var in $vars
|
for var in $vars
|
||||||
if not string match -e -- $var= $cmdline
|
if not string match -e -- $var= $cmdline
|
||||||
echo $var=
|
echo $var=
|
||||||
|
|
|
@ -290,7 +290,7 @@ function __fish_ffmpeg_complete_filter
|
||||||
|
|
||||||
# echo -e "\n **** $filter_type **** \n" > /dev/tty
|
# 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
|
if string match -rq -- '^-' $filters_arg
|
||||||
# No filter name started
|
# No filter name started
|
||||||
__fish_ffmpeg_filters $filter_type
|
__fish_ffmpeg_filters $filter_type
|
||||||
|
|
|
@ -7,7 +7,7 @@ function __fish_complete_clang
|
||||||
set -l prefix (commandline -ct | string replace -fr -- '^(.*=)[^=]*' '$1')
|
set -l prefix (commandline -ct | string replace -fr -- '^(.*=)[^=]*' '$1')
|
||||||
|
|
||||||
# Don't hard-code the name of the clang binary
|
# 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
|
# 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 |
|
$clang --autocomplete=(commandline -ct | string unescape | string replace -- "$prefix" "$prefix,") 2>/dev/null |
|
||||||
# and put it in a format that fish understands
|
# and put it in a format that fish understands
|
||||||
|
|
Loading…
Reference in a new issue