Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion functions/_fifc.fish
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ function _fifc
# We use eval hack because wrapping source command
# inside a function cause some delay before fzf to show up
eval $cmd | while read -l token
set -a result (string escape -- $token)
# string escape will escape '~' if present (at the begenning of path).
# so we need to exclude it from escaping
if string match --quiet '~*' -- $token
set -a result (string join -- "" "~" (string sub --start 2 -- $token | string escape))
Comment on lines +54 to +55
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix accounts for 99% use cases, but it doesn't completely fix the problem, for example ~root won't work.

else
set -a result (string escape -- $token)
end
# Perform extraction if needed
if test -n "$_fifc_extract_regex"
set result[-1] (string match --regex --groups-only -- "$_fifc_extract_regex" "$token")
Expand Down