New package: fzf-0.9.7.1

This commit is contained in:
Dominik Honnef 2015-04-17 23:44:53 +02:00
parent 382449cb6e
commit 53ae445e44
6 changed files with 86 additions and 0 deletions

2
srcpkgs/fzf/INSTALL.msg Normal file
View file

@ -0,0 +1,2 @@
For key bindings, source the appropriate file(s) from
/usr/share/doc/fzf

View file

@ -0,0 +1,3 @@
cd "${$(command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
-o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m):-.}"
zle reset-prompt

View file

@ -0,0 +1,27 @@
fzf-file-widget_fsel() {
command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | sed 1d | cut -b3- | fzf -m | while read item; do
printf '%q ' "$item"
done
echo
}
fzf-file-widget() {
if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then
local height
height=${FZF_TMUX_HEIGHT:-40%}
if [[ $height =~ %$ ]]; then
height="-p ${height%\%}"
else
height="-l $height"
fi
tmux split-window $height "cd $(printf %q "$PWD"); tmux send-keys -t $TMUX_PANE \"\$(fzf-file-widget_fsel)\"'"
else
LBUFFER="${LBUFFER}$(fzf-file-widget_fsel)"
zle redisplay
fi
}
fzf-file-widget "$@"

View file

@ -0,0 +1,7 @@
local selected
if selected=$(fc -l 1 | fzf +s --tac +m -n2..,.. --toggle-sort=ctrl-r -q "$LBUFFER"); then
num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g')
LBUFFER=!$num
zle expand-history
fi
zle redisplay

View file

@ -0,0 +1,11 @@
autoload -Uz fzf-file-widget
autoload -Uz fzf-cd-widget
autoload -Uz fzf-history-widget
zle -N fzf-file-widget
zle -N fzf-cd-widget
zle -N fzf-history-widget
bindkey '^T' fzf-file-widget
bindkey '\ec' fzf-cd-widget
bindkey '^R' fzf-history-widget

36
srcpkgs/fzf/template Normal file
View file

@ -0,0 +1,36 @@
# Template file for 'fzf'
pkgname=fzf
version=0.9.7.1
_version=0.9.7-1
wrksrc=${pkgname}-${_version}/src
revision=1
build_style=go
go_import_path="github.com/junegunn/fzf/src"
go_package="github.com/junegunn/fzf/src/fzf"
maintainer="Dominik Honnef <dominik@honnef.co>"
hostmakedepends=git
makedepends=ncurses-devel
license="MIT"
homepage="https://github.com/junegunn/fzf"
short_desc="A command-line fuzzy finder"
distfiles="https://github.com/junegunn/fzf/archive/${_version}.tar.gz"
checksum=38fa16c41e861af6ad87e7ff655188559775a2979254d76198c435d198e15fb4
# Needs cgo to build, which doesn't work when cross-compiling.
nocross=yes
post_install() {
cd ${wrksrc}/..
vbin bin/fzf-tmux
vman man/man1/fzf.1
sed -i -e 's#source ~/\.fzf\.bash; ##' shell/key-bindings.bash
vinstall plugin/fzf.vim 644 usr/share/vim/vimfiles/plugin
vinstall shell/completion.bash 644 usr/share/bash-completion/completions fzf
vinstall ${FILESDIR}/fzf-file-widget 644 usr/share/zsh/site-functions
vinstall ${FILESDIR}/fzf-cd-widget 644 usr/share/zsh/site-functions
vinstall ${FILESDIR}/fzf-history-widget 644 usr/share/zsh/site-functions
vinstall ${FILESDIR}/key-bindings.zsh 644 usr/share/doc/fzf
vinstall shell/key-bindings.bash 644 usr/share/doc/fzf
vinstall shell/key-bindings.fish 644 usr/share/doc/fzf
}