From dc3957ce79cdcbcd4314700db11ef0fc32d3363c Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 15 Jan 2017 15:06:37 +0900 Subject: [PATCH] [completion] Add preview window to kill completion --- shell/completion.bash | 2 +- shell/completion.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/completion.bash b/shell/completion.bash index d17bb19..86f8e15 100644 --- a/shell/completion.bash +++ b/shell/completion.bash @@ -216,7 +216,7 @@ _fzf_complete_kill() { local selected fzf fzf="$(__fzfcmd_complete)" - selected=$(ps -ef | sed 1d | FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" $fzf -m | awk '{print $2}' | tr '\n' ' ') + selected=$(ps -ef | sed 1d | FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap --min-height 15 $FZF_COMPLETION_OPTS" $fzf -m | awk '{print $2}' | tr '\n' ' ') printf '\e[5n' if [ -n "$selected" ]; then diff --git a/shell/completion.zsh b/shell/completion.zsh index d32eff1..9a33a14 100644 --- a/shell/completion.zsh +++ b/shell/completion.zsh @@ -164,7 +164,7 @@ fzf-completion() { # Kill completion (do not require trigger sequence) if [ $cmd = kill -a ${LBUFFER[-1]} = ' ' ]; then fzf="$(__fzfcmd_complete)" - matches=$(ps -ef | sed 1d | FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" ${=fzf} -m | awk '{print $2}' | tr '\n' ' ') + matches=$(ps -ef | sed 1d | FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap --min-height 15 $FZF_COMPLETION_OPTS" ${=fzf} -m | awk '{print $2}' | tr '\n' ' ') if [ -n "$matches" ]; then LBUFFER="$LBUFFER$matches" fi