[fish] Enable home dir expansion of leading ~/

Enable expanding to user's home directory, when pressing <Ctrl-T> or
<Alt-C>, and the current command line token starts with `~/`.
This commit is contained in:
bitraid 2024-12-19 11:14:54 +02:00 committed by Junegunn Choi
parent 7bd298b536
commit 3b0f976380

View File

@ -150,6 +150,9 @@ function fzf_key_bindings
set -l prefix (string match -r -- '^-[^\s=]+=' $commandline) set -l prefix (string match -r -- '^-[^\s=]+=' $commandline)
set commandline (string replace -- "$prefix" '' $commandline) set commandline (string replace -- "$prefix" '' $commandline)
# Enable home directory expansion of leading ~/
set commandline (string replace -r -- '^~/' '\$HOME/' $commandline)
# escape special characters, except for the $ sign of valid variable names, # escape special characters, except for the $ sign of valid variable names,
# so that after eval, the original string is returned, but with the # so that after eval, the original string is returned, but with the
# variable names replaced by their values. # variable names replaced by their values.