| update value { str replace "\"" "\\\"" | $"($in)" }
This seems to not work properly. If you try to tab complete and fish returns file paths, it'll insert one double quote into the line and fish --complete will error out. You have to manually fix the quote. For example, if I'm trying to open a PDF with zathura, and I type
zathura (there is a space here)
and hit tab, it'll insert a quote
and then fish --complete will complain about the unpaired quote. If you manually add the quote
Then completion works as expected. Or if you already begin typing a file path
It will work too. Only when you type a command, a space right after, and then hit tab, it'll insert the single unpaired quote and break.
This snippet that I got from a comment in this issue has worked much better for me so far.
let fish_completer = {|spans|
fish --command $'complete --escape "--do-complete=($spans | str join " ")"'
| $"value(char tab)description(char newline)" + $in
| from tsv --flexible --no-infer
| each {|i|
if '\' in $i.value {
$i | merge {'value': $"\"($i.value | str replace -a '\' '')\""}
} else {$i}
}
}
Originally posted by @youwen5 in #1844 (comment)
This seems to not work properly. If you try to tab complete and fish returns file paths, it'll insert one double quote into the line and
fish --completewill error out. You have to manually fix the quote. For example, if I'm trying to open a PDF with zathura, and I typeand hit tab, it'll insert a quote
and then
fish --completewill complain about the unpaired quote. If you manually add the quoteThen completion works as expected. Or if you already begin typing a file path
It will work too. Only when you type a command, a space right after, and then hit tab, it'll insert the single unpaired quote and break.
This snippet that I got from a comment in this issue has worked much better for me so far.
Originally posted by @youwen5 in #1844 (comment)