summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbitraid <bitraid@protonmail.ch>2024-12-19 11:14:54 +0200
committerJunegunn Choi <junegunn.c@gmail.com>2024-12-19 20:50:04 +0900
commit3b0f9763800adbb82e3241baba0d3a1db4f52c6b (patch)
treefbd41fcfecc4ce47a5e9aac546785c6ea8a73786
parent7bd298b5360f36e17ae94340d0939c104500f7db (diff)
downloadfzf-3b0f9763800adbb82e3241baba0d3a1db4f52c6b.tar.gz
[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 `~/`.
-rw-r--r--shell/key-bindings.fish3
1 files changed, 3 insertions, 0 deletions
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index 06955b69..9a0dcc31 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -150,6 +150,9 @@ function fzf_key_bindings
set -l prefix (string match -r -- '^-[^\s=]+=' $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,
# so that after eval, the original string is returned, but with the
# variable names replaced by their values.