Added fzf in tmux pane
This commit is contained in:
parent
eb80eab3a5
commit
706b959e24
1 changed files with 20 additions and 8 deletions
28
zsh/zshrc
28
zsh/zshrc
|
@ -5,6 +5,7 @@ SAVEHIST=10000
|
|||
setopt extendedglob nomatch notify histignorespace histignorealldups histnofunctions histnostore histverify incappendhistory
|
||||
unsetopt autocd beep
|
||||
bindkey -v
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
#keybindings
|
||||
|
||||
|
@ -80,16 +81,27 @@ function _send_to_pane {
|
|||
}
|
||||
compctl -K _send_to_pane send-to-pane
|
||||
|
||||
function fzf_hist() {
|
||||
local sed_cmd
|
||||
if [[ $(uname -s) == "Darwin" ]]; then
|
||||
sed_cmd=(sed -E)
|
||||
else
|
||||
sed_cmd=(sed -r)
|
||||
# the following lines sourced from the fzf distribution files
|
||||
export FZF_TMUX=1
|
||||
|
||||
fzf-history-widget() {
|
||||
local selected num
|
||||
setopt localoptions noglobsubst noposixbuiltins pipefail 2> /dev/null
|
||||
selected=( $(fc -rl 1 |
|
||||
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" fzf-tmux -d40%) )
|
||||
local ret=$?
|
||||
if [ -n "$selected" ]; then
|
||||
num=$selected[1]
|
||||
if [ -n "$num" ]; then
|
||||
zle vi-fetch-history -n $num
|
||||
fi
|
||||
print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | $sed_cmd 's/ *[0-9]*\*? *//' | $sed_cmd 's/\\/\\\\/g')
|
||||
fi
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
bindkey -s "\C-r" "\eifzf_hist\n"
|
||||
zle -N fzf-history-widget
|
||||
bindkey '^R' fzf-history-widget
|
||||
### END FZF DISTRIBUTION SOURCE
|
||||
|
||||
function _just() {
|
||||
reply=($(just --summary))
|
||||
|
|
Loading…
Add table
Reference in a new issue