summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-05-30 10:23:45 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-05-31 16:57:35 +0900
commit7405925952fc5fe3966c92b7e3793345d700b91c (patch)
tree5c7b16b8bde09e3d6176d0d0796661e3106f6a94 /shell
parent3afd543a7e1491f26e7831fcb19e83b5fb9ce4ec (diff)
downloadfzf-7405925952fc5fe3966c92b7e3793345d700b91c.tar.gz
[bash] Indent multi-line history entries
Diffstat (limited to 'shell')
-rw-r--r--shell/key-bindings.bash4
1 files changed, 2 insertions, 2 deletions
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash
index 265e11e0..5218febe 100644
--- a/shell/key-bindings.bash
+++ b/shell/key-bindings.bash
@@ -57,7 +57,7 @@ __fzf_cd__() {
if command -v perl > /dev/null; then
__fzf_history__() {
local output script
- script='BEGIN { getc; $/ = "\n\t"; $HISTCOUNT = $ENV{last_hist} + 1 } s/^[ *]//; print $HISTCOUNT - $. . "\t$_" if !$seen{$_}++'
+ script='BEGIN { getc; $/ = "\n\t"; $HISTCOUNT = $ENV{last_hist} + 1 } s/^[ *]//; s/\n/\n\t/gm; print $HISTCOUNT - $. . "\t$_" if !$seen{$_}++'
output=$(
set +o pipefail
builtin fc -lnr -2147483648 |
@@ -65,7 +65,7 @@ if command -v perl > /dev/null; then
FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line ${FZF_CTRL_R_OPTS-} +m --read0") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) --query "$READLINE_LINE"
) || return
- READLINE_LINE=${output#*$'\t'}
+ READLINE_LINE=$(command perl -pe 's/^\d*\t//' <<< "$output")
if [[ -z "$READLINE_POINT" ]]; then
echo "$READLINE_LINE"
else