diff options
| author | Andrew Zhou <andrewfzhou@gmail.com> | 2020-10-11 22:58:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-12 12:58:37 +0900 |
| commit | 6c9adea0d3eec72af9999ce291259c86ad8788e2 (patch) | |
| tree | 2648943be9ea061450213f8a0e2dc4485633ce98 /shell/key-bindings.fish | |
| parent | fc7630a66d8b07ec90603f7919f8aadf891783ac (diff) | |
| download | fzf-6c9adea0d3eec72af9999ce291259c86ad8788e2.tar.gz | |
[fish] Fix parser handling of option-like args (#2208)
Fixes error when option-like args are parsed (e.g. "-1").
Diffstat (limited to 'shell/key-bindings.fish')
| -rw-r--r-- | shell/key-bindings.fish | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish index 73a07334..ff922e01 100644 --- a/shell/key-bindings.fish +++ b/shell/key-bindings.fish @@ -127,12 +127,12 @@ function fzf_key_bindings else set dir (__fzf_get_dir $commandline) - if [ "$dir" = "." -a (string sub -l 1 $commandline) != '.' ] + if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ] # if $dir is "." but commandline is not a relative path, this means no file path found set fzf_query $commandline else # Also remove trailing slash after dir, to "split" input properly - set fzf_query (string replace -r "^$dir/?" '' "$commandline") + set fzf_query (string replace -r "^$dir/?" -- '' "$commandline") end end @@ -144,15 +144,15 @@ function fzf_key_bindings set dir $argv # Strip all trailing slashes. Ignore if $dir is root dir (/) - if [ (string length $dir) -gt 1 ] - set dir (string replace -r '/*$' '' $dir) + if [ (string length -- $dir) -gt 1 ] + set dir (string replace -r '/*$' -- '' $dir) end # Iteratively check if dir exists and strip tail end of path while [ ! -d "$dir" ] # If path is absolute, this can keep going until ends up at / # If path is relative, this can keep going until entire input is consumed, dirname returns "." - set dir (dirname "$dir") + set dir (dirname -- "$dir") end echo $dir |
