From 81a790a42be7b3338037d3b54a6ce306021ba08a Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 5 Feb 2021 15:32:14 +0300 Subject: [PATCH] tmux instead of zsh widget --- bin/bin/tmux-git-extractor.sh | 13 +++++++++++++ tmux/.tmux.conf | 6 ++++++ zsh/.zshrc | 19 ------------------- 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100755 bin/bin/tmux-git-extractor.sh diff --git a/bin/bin/tmux-git-extractor.sh b/bin/bin/tmux-git-extractor.sh new file mode 100755 index 0000000..8cf1488 --- /dev/null +++ b/bin/bin/tmux-git-extractor.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +tmux has-session -t git-extractor && tmux kill-session -t git-extractor || : +tmux new-session -d -s git-extractor -c "$1" ' + git status --short | fzf -m --preview="" | while read item ; do + item=`echo $item | cut -w -f2-` + echo -n "$item " + done | read data + tmux set-buffer "$data" + tmux detach +' +tmux set-option -t git-extractor status off +exec tmux attach-session -t git-extractor diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 1d414d3..a107fe2 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -65,6 +65,12 @@ bind-key o { delete-buffer } +bind-key O { + display-popup -KE -w 100% -R "~/bin/tmux-git-extractor.sh '#{pane_current_path}'" + paste-buffer + delete-buffer +} + bind-key Y { capture-pane -J -S - -E - save-buffer /tmp/tmux-buffer diff --git a/zsh/.zshrc b/zsh/.zshrc index 9f6f834..27a1bde 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -223,24 +223,5 @@ _fzf_find() { export FZF_CTRL_T_COMMAND="_fzf_find -o -type f -print -o -type l -print" export FZF_ALT_C_COMMAND=_fzf_find -_fzf_git_status() { - local item - git status --short | fzf -m --preview="" | while read item ; do - item=`echo $item | cut -w -f2-` - echo -n "$item " - done - local ret=$? - print - return $ret -} -fzf-git-status-widget() { - LBUFFER="${LBUFFER}$(_fzf_git_status)" - local ret=$? - zle reset-prompt - return $ret -} -zle -N fzf-git-status-widget -bindkey "^Y" fzf-git-status-widget - . ~/work/fzf/shell/key-bindings.zsh # }}} -- 2.44.0