mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 08:41:13 +08:00
completions: don't treat token at cursor as flag
This commit is contained in:
parent
a35c3d4d10
commit
6feec60a8e
|
@ -16,7 +16,7 @@ end
|
|||
# Returns 0 if we're after `env` and all previous tokens have not yet contained an equal sign
|
||||
# Prevents `env` completions from completing payload completions.
|
||||
function __fish_env_not_yet_vars
|
||||
not string match -qe = (commandline -c)
|
||||
not string match -qe -- = (commandline -c)
|
||||
end
|
||||
|
||||
# Generate a list of possible variable names to redefine, excluding any already redefined.
|
||||
|
@ -43,7 +43,7 @@ end
|
|||
|
||||
# Generate a list of possible completions for the current variable name from history
|
||||
function __fish_env_values_from_history
|
||||
string match -rq "(?<name>.+)=(?<value>.*)" (commandline -ct); or return 1
|
||||
string match -rq -- "(?<name>.+)=(?<value>.*)" (commandline -ct); or return 1
|
||||
|
||||
# Caveat lector: very crude multi-word tokenization handling below!
|
||||
set -l rname (string escape --style=regex -- $name)
|
||||
|
|
|
@ -37,7 +37,7 @@ end
|
|||
#
|
||||
|
||||
# Inherit user/host completions from ssh
|
||||
complete -c scp -d Remote -n "__fish_no_scp_remote_specified; and not string match -e : (commandline -ct)" -a "(complete -C'ssh ' | string replace -r '\t.*' ':')"
|
||||
complete -c scp -d Remote -n "__fish_no_scp_remote_specified; and not string match -e -- : (commandline -ct)" -a "(complete -C'ssh ' | string replace -r '\t.*' ':')"
|
||||
|
||||
# Local path
|
||||
complete -c scp -d "Local Path" -n "not string match @ -- (commandline -ct)"
|
||||
|
|
|
@ -5,7 +5,7 @@ set -l runtime userparameter_reload \
|
|||
log_level_decrease=
|
||||
|
||||
function __fish_string_in_command -a ch
|
||||
string match -rq $ch (commandline)
|
||||
string match -rq -- $ch (commandline)
|
||||
end
|
||||
|
||||
function __fish_prepend -a prefix
|
||||
|
|
|
@ -9,7 +9,7 @@ set -l runtime config_cache_reload \
|
|||
log_level_decrease=
|
||||
|
||||
function __fish_string_in_command -a ch
|
||||
string match -rq $ch (commandline)
|
||||
string match -rq -- $ch (commandline)
|
||||
end
|
||||
|
||||
function __fish_prepend -a prefix
|
||||
|
|
|
@ -21,7 +21,7 @@ set -l runtime config_cache_reload \
|
|||
set -l scope rwlock mutex processing
|
||||
|
||||
function __fish_string_in_command -a ch
|
||||
string match -rq $ch (commandline)
|
||||
string match -rq -- $ch (commandline)
|
||||
end
|
||||
|
||||
function __fish_prepend -a prefix
|
||||
|
|
|
@ -30,7 +30,7 @@ function __npm_filtered_list_packages
|
|||
end
|
||||
|
||||
# Do not provide any completions if nothing has been entered yet to avoid long hang.
|
||||
if string match -rq . (commandline -ct)
|
||||
if string match -rq -- . (commandline -ct)
|
||||
# Filter the results here rather than in the C++ code due to #5267
|
||||
# `all-the-package-names` reads a billion line JSON file using node (slow) then prints
|
||||
# it all (slow) using node (slow). Directly parse the `names.json` file that ships with it instead.
|
||||
|
|
Loading…
Reference in New Issue
Block a user