fish: Add 'trim_trailing_slashes' function and bind it
parent
faf05f1915
commit
ba12fbd8ca
|
@ -5,4 +5,5 @@ function fish_user_key_bindings
|
||||||
end
|
end
|
||||||
|
|
||||||
bind \el downcase-word
|
bind \el downcase-word
|
||||||
|
bind \cw trim_trailing_slashes
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
# This is useful for rsync when folders have slashes automatically appended to
|
||||||
|
# them (e.g. with fzf completion).
|
||||||
|
function trim_trailing_slashes --description "Trim trailing slashes of all commandline tokens"
|
||||||
|
set -l list (commandline -o)
|
||||||
|
commandline -r ""
|
||||||
|
for i in $list
|
||||||
|
commandline -i -- (string escape (string replace -r '/$' '' $i))
|
||||||
|
commandline -i -- ' '
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue