Add peco / peco functions
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c9e79a2ca1
commit
aa49fc68e1
3 changed files with 16 additions and 0 deletions
|
@ -50,5 +50,8 @@ source ${HOME}/.zsh/config-git.zsh
|
|||
## Load local-config if available
|
||||
[ -e ${HOME}/.zsh/local-config.zsh ] && source ${HOME}/.zsh/local-config.zsh
|
||||
|
||||
## Load peco functions
|
||||
source ${HOME}/.zsh/peco.sh
|
||||
|
||||
## Clean PATH from duplicates
|
||||
PATH=$(${HOME}/bin/path-dedup.py)
|
||||
|
|
12
.zsh/peco.sh
Normal file
12
.zsh/peco.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
# select history
|
||||
function exists { which $1 &> /dev/null }
|
||||
function peco-select-history() {
|
||||
local tac
|
||||
exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
|
||||
BUFFER=$(fc -l -n 1 | eval $tac | peco --query "$LBUFFER")
|
||||
CURSOR=$#BUFFER # move cursor
|
||||
zle -R -c # refresh
|
||||
}
|
||||
|
||||
zle -N peco-select-history
|
||||
bindkey '^R' peco-select-history
|
|
@ -29,6 +29,7 @@ INSTALLS=(
|
|||
'github.com/Luzifer/slugify'
|
||||
'github.com/Luzifer/str2hex'
|
||||
'github.com/Luzifer/worktime'
|
||||
'github.com/peco/peco/cmd/peco'
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue