fish: Fix escaping of ~ in trim_trailing_slashes

master
Pierre Neidhardt 2017-05-23 17:48:46 +02:00
parent 3e2691b0d3
commit b8794f4f1a
1 changed files with 8 additions and 1 deletions

View File

@ -4,7 +4,14 @@ function trim_trailing_slashes --description "Trim trailing slashes of all comma
set -l list (commandline -o)
commandline -r ""
for i in $list
commandline -i -- (string escape (string replace -r '/$' '' $i))
set i (string replace -r '/$' '' $i)
set -l prefix (string sub -s 1 -l 1 -- $i)
switch $prefix
case '~'
commandline -t -- (string sub -s 2 (string escape -n -- $i))
case '*'
commandline -t -- (string escape -- $i)
end
commandline -i -- ' '
end
end