diff --git a/fzf-marks.plugin.zsh b/fzf-marks.plugin.zsh index 16364b5..2c1732d 100644 --- a/fzf-marks.plugin.zsh +++ b/fzf-marks.plugin.zsh @@ -34,7 +34,7 @@ if [[ -z "${FZF_MARKS_COMMAND}" ]] ; then MINIMUM_VERSION=16001 if [[ $FZF_VERSION -gt $MINIMUM_VERSION ]]; then - FZF_MARKS_COMMAND="fzf --height 40% --reverse --header='ctrl-y:jump, ctrl-t:toggle, ctrl-d:delete'" + FZF_MARKS_COMMAND="fzf --height 40% --reverse --header='ctrl-y:jump, ctrl-t:toggle, ctrl-d:delete, ctrl-k:paste'" elif [[ ${FZF_TMUX:-1} -eq 1 ]]; then FZF_MARKS_COMMAND="fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" else @@ -96,7 +96,7 @@ function fzm { local lines key lines=$(_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ --ansi \ - --expect="${FZF_MARKS_DELETE:-ctrl-d}" \ + --expect="${FZF_MARKS_DELETE:-ctrl-d},${FZM_MARKS_PASTE:-ctrl-k}" \ --multi \ --bind=ctrl-y:accept,ctrl-t:toggle \ --query="\"$*\"" \ @@ -111,6 +111,10 @@ function fzm { if [[ $key == "${FZF_MARKS_DELETE:-ctrl-d}" ]]; then dmark "-->-->-->" "$(sed 1d <<< "$lines")" + elif [[ $key == "${FZF_MARKS_PASTE:-ctrl-k}" ]]; then + directory=$(tail -1 <<< "$lines" | sed 's/.*: \(.*\)$/\1/' | sed "s#^~#${HOME}#") + LBUFFER="${LBUFFER}$directory" + zle reset-prompt > /dev/null 2>&1 || echo $directory else jump "-->-->-->" "$(tail -1 <<< "${lines}")" fi @@ -157,7 +161,6 @@ function dmark { zle && zle reset-prompt } -zle -N jump zle -N dmark zle -N fzm