Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand user home when using tilde #16

Merged
merged 1 commit into from
Aug 9, 2022
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
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