mirror of
https://github.com/junegunn/fzf.git
synced 2025-07-31 04:02:01 -07:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e87a85a179 | ||
|
11407bf656 | ||
|
c82fb3c9b9 | ||
|
309e1d8619 | ||
|
c2db67c1c0 | ||
|
9526594905 | ||
|
3d74d277aa | ||
|
fc274c2ba4 | ||
|
ce43ea9f42 | ||
|
21da02fac2 | ||
|
19569bd5c5 | ||
|
afa25d8c57 | ||
|
1ba7acf4bd | ||
|
a847fe8754 | ||
|
5bb18b6441 | ||
|
876c233a26 |
@@ -1,6 +1,12 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
0.16.5
|
||||
------
|
||||
- Minor bug fixes
|
||||
- Added `toggle-preview-wrap` action
|
||||
- Built with Go 1.8
|
||||
|
||||
0.16.4
|
||||
------
|
||||
- Added `--border` option to draw border above and below the finder
|
||||
|
@@ -138,6 +138,7 @@ cleanup() {
|
||||
|
||||
# Remove temp window if we were zoomed
|
||||
if [[ -n "$zoomed" ]]; then
|
||||
tmux display-message -p "#{window_id}" > /dev/null
|
||||
tmux swap-pane -t $original_window \; \
|
||||
select-window -t $original_window \; \
|
||||
kill-window -t $tmp_window \; \
|
||||
|
83
install
83
install
@@ -2,7 +2,7 @@
|
||||
|
||||
set -u
|
||||
|
||||
version=0.16.4
|
||||
version=0.16.5
|
||||
auto_completion=
|
||||
key_bindings=
|
||||
update_config=2
|
||||
@@ -158,80 +158,9 @@ case "$archi" in
|
||||
FreeBSD\ *86) download fzf-$version-freebsd_${binary_arch:-386} ;;
|
||||
OpenBSD\ *64) download fzf-$version-openbsd_${binary_arch:-amd64} ;;
|
||||
OpenBSD\ *86) download fzf-$version-openbsd_${binary_arch:-386} ;;
|
||||
*) binary_available=0 binary_error=1 ;;
|
||||
*) binary_available=0 binary_error=1 ;;
|
||||
esac
|
||||
|
||||
install_ruby_fzf() {
|
||||
if [ -z "$allow_legacy" ]; then
|
||||
ask "Do you want to install legacy Ruby version instead?" && exit 1
|
||||
fi
|
||||
echo "Installing legacy Ruby version ..."
|
||||
|
||||
# ruby executable
|
||||
echo -n "Checking Ruby executable ... "
|
||||
ruby=$(command -v ruby)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ruby executable not found !!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# System ruby is preferred
|
||||
system_ruby=/usr/bin/ruby
|
||||
if [ -x $system_ruby ] && [ $system_ruby != "$ruby" ]; then
|
||||
$system_ruby --disable-gems -rcurses -e0 2> /dev/null
|
||||
[ $? -eq 0 ] && ruby=$system_ruby
|
||||
fi
|
||||
|
||||
echo "OK ($ruby)"
|
||||
|
||||
# Curses-support
|
||||
echo -n "Checking Curses support ... "
|
||||
"$ruby" -rcurses -e0 2> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Not found"
|
||||
echo "Installing 'curses' gem ... "
|
||||
if (( EUID )); then
|
||||
/usr/bin/env gem install curses --user-install
|
||||
else
|
||||
/usr/bin/env gem install curses
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo "Failed to install 'curses' gem."
|
||||
if [[ $(uname -r) =~ 'ARCH' ]]; then
|
||||
echo "Make sure that base-devel package group is installed."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ruby version
|
||||
echo -n "Checking Ruby version ... "
|
||||
"$ruby" -e 'exit RUBY_VERSION >= "1.9"'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ">= 1.9"
|
||||
"$ruby" --disable-gems -rcurses -e0 2> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
fzf_cmd="$ruby --disable-gems $fzf_base/fzf"
|
||||
else
|
||||
fzf_cmd="$ruby $fzf_base/fzf"
|
||||
fi
|
||||
else
|
||||
echo "< 1.9"
|
||||
fzf_cmd="$ruby $fzf_base/fzf"
|
||||
fi
|
||||
|
||||
# Create fzf script
|
||||
echo -n "Creating wrapper script for fzf ... "
|
||||
rm -f "$fzf_base"/bin/fzf
|
||||
echo "#!/bin/sh" > "$fzf_base"/bin/fzf
|
||||
echo "$fzf_cmd \"\$@\"" >> "$fzf_base"/bin/fzf
|
||||
chmod +x "$fzf_base"/bin/fzf
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
cd "$fzf_base"
|
||||
if [ -n "$binary_error" ]; then
|
||||
if [ $binary_available -eq 0 ]; then
|
||||
@@ -249,12 +178,12 @@ if [ -n "$binary_error" ]; then
|
||||
echo "OK"
|
||||
cp "$GOPATH/bin/fzf" "$fzf_base/bin/"
|
||||
else
|
||||
echo "Failed to build binary ..."
|
||||
install_ruby_fzf
|
||||
echo "Failed to build binary. Installation failed."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "go executable not found. Cannot build binary ..."
|
||||
install_ruby_fzf
|
||||
echo "go executable not found. Installation failed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
..
|
||||
.TH fzf-tmux 1 "Feb 2017" "fzf 0.16.4" "fzf-tmux - open fzf in tmux split pane"
|
||||
.TH fzf-tmux 1 "Feb 2017" "fzf 0.16.5" "fzf-tmux - open fzf in tmux split pane"
|
||||
|
||||
.SH NAME
|
||||
fzf-tmux - open fzf in tmux split pane
|
||||
|
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
..
|
||||
.TH fzf 1 "Feb 2017" "fzf 0.16.4" "fzf - a command-line fuzzy finder"
|
||||
.TH fzf 1 "Feb 2017" "fzf 0.16.5" "fzf - a command-line fuzzy finder"
|
||||
|
||||
.SH NAME
|
||||
fzf - a command-line fuzzy finder
|
||||
@@ -500,6 +500,7 @@ e.g. \fBfzf --bind=ctrl-j:accept,ctrl-k:kill-line\fR
|
||||
\fBtoggle-in\fR (\fB--reverse\fR ? \fBtoggle+up\fR : \fBtoggle+down\fR)
|
||||
\fBtoggle-out\fR (\fB--reverse\fR ? \fBtoggle+down\fR : \fBtoggle+up\fR)
|
||||
\fBtoggle-preview\fR
|
||||
\fBtoggle-preview-wrap\fR
|
||||
\fBtoggle-sort\fR
|
||||
\fBtoggle+up\fR \fIbtab (shift-tab)\fR
|
||||
\fBunix-line-discard\fR \fIctrl-u\fR
|
||||
|
@@ -291,9 +291,9 @@ try
|
||||
endtry
|
||||
|
||||
if !has_key(dict, 'source') && !empty($FZF_DEFAULT_COMMAND)
|
||||
let temps.source = tempname()
|
||||
call writefile(split($FZF_DEFAULT_COMMAND, "\n"), temps.source)
|
||||
let dict.source = (empty($SHELL) ? &shell : $SHELL) . ' ' . s:shellesc(temps.source)
|
||||
let temps.source = tempname().(s:is_win ? '.bat' : '')
|
||||
call writefile((s:is_win ? ['@echo off'] : []) + split($FZF_DEFAULT_COMMAND, "\n"), temps.source)
|
||||
let dict.source = (empty($SHELL) ? &shell : $SHELL) . (s:is_win ? ' /c ' : ' ') . s:shellesc(temps.source)
|
||||
endif
|
||||
|
||||
if has_key(dict, 'source')
|
||||
@@ -304,7 +304,7 @@ try
|
||||
elseif type == 3
|
||||
let temps.input = tempname()
|
||||
call writefile(source, temps.input)
|
||||
let prefix = 'cat '.s:shellesc(temps.input).'|'
|
||||
let prefix = (s:is_win ? 'type ' : 'cat ').s:shellesc(temps.input).'|'
|
||||
else
|
||||
throw 'invalid source type'
|
||||
endif
|
||||
@@ -445,7 +445,7 @@ function! s:execute(dict, command, use_height, temps) abort
|
||||
endif
|
||||
let command = printf(fmt, escaped)
|
||||
else
|
||||
let command = escaped
|
||||
let command = a:use_height ? a:command : escaped
|
||||
endif
|
||||
if a:use_height
|
||||
let stdin = has_key(a:dict, 'source') ? '' : '< /dev/tty'
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# Key bindings
|
||||
# ------------
|
||||
__fzf_select__() {
|
||||
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type f -print \
|
||||
-o -type d -print \
|
||||
-o -type l -print 2> /dev/null | cut -b3-"}"
|
||||
@@ -46,8 +46,8 @@ fzf-file-widget() {
|
||||
|
||||
__fzf_cd__() {
|
||||
local cmd dir
|
||||
cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | sed 1d | cut -b3-"}"
|
||||
cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | cut -b3-"}"
|
||||
dir=$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m) && printf 'cd %q' "$dir"
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# ------------
|
||||
function fzf_key_bindings
|
||||
|
||||
# Store last token in $dir as root for the 'find' command
|
||||
# Store current token in $dir as root for the 'find' command
|
||||
function fzf-file-widget -d "List files and folders"
|
||||
set -l dir (commandline -t)
|
||||
# The commandline token might be escaped, we need to unescape it.
|
||||
@@ -16,10 +16,10 @@ function fzf_key_bindings
|
||||
# "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not
|
||||
# $dir itself, even if hidden.
|
||||
set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND "
|
||||
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
-o -type f -print \
|
||||
-o -type d -print \
|
||||
-o -type l -print 2> /dev/null | sed 's#^\./##'"
|
||||
-o -type l -print 2> /dev/null | cut -b3-"
|
||||
|
||||
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
|
||||
begin
|
||||
@@ -54,8 +54,8 @@ function fzf_key_bindings
|
||||
|
||||
function fzf-cd-widget -d "Change directory"
|
||||
set -q FZF_ALT_C_COMMAND; or set -l FZF_ALT_C_COMMAND "
|
||||
command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | sed 1d | cut -b3-"
|
||||
command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | cut -b3-"
|
||||
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
|
||||
begin
|
||||
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS"
|
||||
|
@@ -4,7 +4,7 @@ if [[ $- == *i* ]]; then
|
||||
|
||||
# CTRL-T - Paste the selected file path(s) into the command line
|
||||
__fsel() {
|
||||
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type f -print \
|
||||
-o -type d -print \
|
||||
-o -type l -print 2> /dev/null | cut -b3-"}"
|
||||
@@ -38,10 +38,15 @@ bindkey '^T' fzf-file-widget
|
||||
|
||||
# ALT-C - cd into the selected directory
|
||||
fzf-cd-widget() {
|
||||
local cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | sed 1d | cut -b3-"}"
|
||||
local cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | cut -b3-"}"
|
||||
setopt localoptions pipefail 2> /dev/null
|
||||
cd "${$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m):-.}"
|
||||
local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m)"
|
||||
if [[ -z "$dir" ]]; then
|
||||
zle redisplay
|
||||
return 0
|
||||
fi
|
||||
cd "$dir"
|
||||
local ret=$?
|
||||
zle reset-prompt
|
||||
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
||||
@@ -71,4 +76,3 @@ zle -N fzf-history-widget
|
||||
bindkey '^R' fzf-history-widget
|
||||
|
||||
fi
|
||||
|
||||
|
@@ -1,40 +0,0 @@
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER Junegunn Choi <junegunn.c@gmail.com>
|
||||
|
||||
# apt-get
|
||||
RUN apt-get update && apt-get -y upgrade && \
|
||||
apt-get install -y --force-yes git curl build-essential
|
||||
|
||||
# Install Go 1.4
|
||||
RUN cd / && curl \
|
||||
https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | \
|
||||
tar -xz && mv go go1.4 && \
|
||||
sed -i 's@#define PTHREAD_KEYS_MAX 128@@' /go1.4/src/runtime/cgo/gcc_android_arm.c
|
||||
|
||||
ENV GOROOT /go1.4
|
||||
ENV PATH /go1.4/bin:$PATH
|
||||
|
||||
RUN cd / && \
|
||||
curl -O http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin && \
|
||||
chmod 755 /android-ndk* && /android-ndk-r10e-linux-x86_64.bin && \
|
||||
mv android-ndk-r10e /android-ndk
|
||||
|
||||
RUN cd /android-ndk && bash ./build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=/ndk --arch=arm
|
||||
|
||||
ENV NDK_CC /ndk/bin/arm-linux-androideabi-gcc
|
||||
|
||||
RUN cd $GOROOT/src && \
|
||||
CC_FOR_TARGET=$NDK_CC GOOS=android GOARCH=arm GOARM=7 ./make.bash
|
||||
|
||||
RUN cd / && curl \
|
||||
http://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz | \
|
||||
tar -xz && cd /ncurses-5.9 && \
|
||||
./configure CC=$NDK_CC CFLAGS="-fPIE -march=armv7-a -mfpu=neon -mhard-float -Wl,--no-warn-mismatch" LDFLAGS="-march=armv7-a -Wl,--no-warn-mismatch" --host=arm-linux --enable-overwrite --enable-const --without-cxx-binding --without-shared --without-debug --enable-widec --enable-ext-colors --enable-ext-mouse --enable-pc-files --with-pkg-config-libdir=$PKG_CONFIG_LIBDIR --without-manpages --without-ada --disable-shared --without-tests --prefix=/ndk/sysroot/usr --with-default-terminfo-dirs=/usr/share/terminfo --with-terminfo-dirs=/usr/share/terminfo ac_cv_header_locale_h=n ac_cv_func_getpwent=no ac_cv_func_getpwnam=no ac_cv_func_getpwuid=no && \
|
||||
sed -i 's@#define HAVE_LOCALE_H 1@/* #undef HAVE_LOCALE_H */@' include/ncurses_cfg.h && \
|
||||
make && \
|
||||
sed -i '0,/echo.*/{s/echo.*/exit 0/}' misc/run_tic.sh && \
|
||||
make install && \
|
||||
mv /ndk/sysroot/usr/lib/libncursesw.a /ndk/sysroot/usr/lib/libncurses.a
|
||||
|
||||
# Default CMD
|
||||
CMD cd /fzf/src && /bin/bash
|
@@ -1,24 +0,0 @@
|
||||
FROM base/archlinux:2014.07.03
|
||||
MAINTAINER Junegunn Choi <junegunn.c@gmail.com>
|
||||
|
||||
# apt-get
|
||||
RUN pacman-key --populate archlinux && pacman-key --refresh-keys
|
||||
RUN pacman-db-upgrade && pacman -Syu --noconfirm base-devel git
|
||||
|
||||
# Install Go 1.4
|
||||
RUN cd / && curl \
|
||||
https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | \
|
||||
tar -xz && mv go go1.4
|
||||
|
||||
ENV GOROOT /go1.4
|
||||
ENV PATH /go1.4/bin:$PATH
|
||||
|
||||
# For i386 build
|
||||
RUN echo '[multilib]' >> /etc/pacman.conf && \
|
||||
echo 'Include = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf && \
|
||||
pacman-db-upgrade && yes | pacman -Sy gcc-multilib lib32-ncurses && \
|
||||
cd $GOROOT/src && GOARCH=386 ./make.bash
|
||||
|
||||
# Default CMD
|
||||
CMD cd /fzf/src && /bin/bash
|
||||
|
@@ -1,32 +0,0 @@
|
||||
FROM centos:centos6
|
||||
MAINTAINER Junegunn Choi <junegunn.c@gmail.com>
|
||||
|
||||
# yum
|
||||
RUN yum install -y git gcc make tar glibc-devel glibc-devel.i686 \
|
||||
ncurses-devel ncurses-static ncurses-devel.i686 \
|
||||
gpm-devel gpm-static libgcc.i686
|
||||
|
||||
# Install Go 1.4
|
||||
RUN cd / && curl \
|
||||
https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | \
|
||||
tar -xz && mv go go1.4
|
||||
|
||||
# Install Go 1.7
|
||||
RUN cd / && curl \
|
||||
https://storage.googleapis.com/golang/go1.7.linux-amd64.tar.gz | \
|
||||
tar -xz && mv go go1.7
|
||||
|
||||
# Install RPMs for building static 32-bit binary
|
||||
RUN curl ftp://ftp.pbone.net/mirror/ftp.centos.org/6.8/os/i386/Packages/ncurses-static-5.7-4.20090207.el6.i686.rpm -o rpm && rpm -i rpm && \
|
||||
curl ftp://ftp.pbone.net/mirror/ftp.centos.org/6.8/os/i386/Packages/gpm-static-1.20.6-12.el6.i686.rpm -o rpm && rpm -i rpm
|
||||
|
||||
ENV GOROOT_BOOTSTRAP /go1.4
|
||||
ENV GOROOT /go1.7
|
||||
ENV PATH /go1.7/bin:$PATH
|
||||
|
||||
# For i386 build
|
||||
RUN cd $GOROOT/src && GOARCH=386 ./make.bash
|
||||
|
||||
# Default CMD
|
||||
CMD cd /fzf/src && /bin/bash
|
||||
|
@@ -1,22 +0,0 @@
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER Junegunn Choi <junegunn.c@gmail.com>
|
||||
|
||||
# apt-get
|
||||
RUN apt-get update && apt-get -y upgrade && \
|
||||
apt-get install -y --force-yes git curl build-essential libncurses-dev libgpm-dev
|
||||
|
||||
# Install Go 1.4
|
||||
RUN cd / && curl \
|
||||
https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | \
|
||||
tar -xz && mv go go1.4
|
||||
|
||||
ENV GOROOT /go1.4
|
||||
ENV PATH /go1.4/bin:$PATH
|
||||
|
||||
# For i386 build
|
||||
RUN apt-get install -y lib32ncurses5-dev && \
|
||||
cd $GOROOT/src && GOARCH=386 ./make.bash
|
||||
|
||||
# Default CMD
|
||||
CMD cd /fzf/src && /bin/bash
|
||||
|
49
src/Makefile
49
src/Makefile
@@ -4,6 +4,8 @@ ifeq ($(UNAME_S),Darwin)
|
||||
GOOS := darwin
|
||||
else ifeq ($(UNAME_S),Linux)
|
||||
GOOS := linux
|
||||
else
|
||||
$(error "$$GOOS is not defined.")
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -12,7 +14,6 @@ ROOTDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
BINDIR := $(shell dirname $(ROOTDIR))/bin
|
||||
GOPATH := $(shell dirname $(ROOTDIR))/gopath
|
||||
SRCDIR := $(GOPATH)/src/github.com/junegunn/fzf/src
|
||||
DOCKEROPTS := -i -t -v $(ROOTDIR):/fzf/src
|
||||
BINARY32 := fzf-$(GOOS)_386
|
||||
BINARY64 := fzf-$(GOOS)_amd64
|
||||
BINARYARM5 := fzf-$(GOOS)_arm5
|
||||
@@ -86,12 +87,6 @@ deps: $(SRCDIR) $(SOURCES)
|
||||
cd $(SRCDIR) && go get -tags "$(TAGS)"
|
||||
./deps
|
||||
|
||||
android-build: $(SRCDIR)
|
||||
cd $(SRCDIR) && GOARCH=arm GOARM=7 CGO_ENABLED=1 go get
|
||||
cd $(SRCDIR)/fzf && GOARCH=arm GOARM=7 CGO_ENABLED=1 go build -a -ldflags="-w -extldflags=-pie" -o $(BINARYARM7)
|
||||
cd $(SRCDIR)/fzf && cp $(BINARYARM7) $(RELEASEARM7) && tar -czf $(RELEASEARM7).tgz $(RELEASEARM7) && \
|
||||
rm -f $(RELEASEARM7)
|
||||
|
||||
test: deps
|
||||
SHELL=/bin/sh GOOS= go test -v -tags "$(TAGS)" ./...
|
||||
|
||||
@@ -129,42 +124,4 @@ $(BINDIR)/fzf: fzf/$(BINARY) | $(BINDIR)
|
||||
$(BINDIR):
|
||||
mkdir -p $@
|
||||
|
||||
docker-arch:
|
||||
docker build -t junegunn/arch-sandbox - < Dockerfile.arch
|
||||
|
||||
docker-ubuntu:
|
||||
docker build -t junegunn/ubuntu-sandbox - < Dockerfile.ubuntu
|
||||
|
||||
docker-centos:
|
||||
docker build -t junegunn/centos-sandbox - < Dockerfile.centos
|
||||
|
||||
docker-android:
|
||||
docker build -t junegunn/android-sandbox - < Dockerfile.android
|
||||
|
||||
arch: docker-arch
|
||||
docker run $(DOCKEROPTS) junegunn/$@-sandbox \
|
||||
sh -c 'cd /fzf/src; /bin/bash'
|
||||
|
||||
ubuntu: docker-ubuntu
|
||||
docker run $(DOCKEROPTS) junegunn/$@-sandbox \
|
||||
sh -c 'cd /fzf/src; /bin/bash'
|
||||
|
||||
centos: docker-centos
|
||||
docker run $(DOCKEROPTS) junegunn/$@-sandbox \
|
||||
sh -c 'cd /fzf/src; /bin/bash'
|
||||
|
||||
linux: docker-centos
|
||||
docker run $(DOCKEROPTS) junegunn/centos-sandbox \
|
||||
/bin/bash -ci 'cd /fzf/src; make TAGS=static release'
|
||||
|
||||
ubuntu-android: docker-android
|
||||
docker run $(DOCKEROPTS) junegunn/android-sandbox \
|
||||
sh -c 'cd /fzf/src; /bin/bash'
|
||||
|
||||
android: docker-android
|
||||
docker run $(DOCKEROPTS) junegunn/android-sandbox \
|
||||
/bin/bash -ci 'cd /fzf/src; GOOS=android make android-build'
|
||||
|
||||
.PHONY: all deps release test install uninstall clean \
|
||||
linux arch ubuntu centos docker-arch docker-ubuntu docker-centos \
|
||||
android-build docker-android ubuntu-android android
|
||||
.PHONY: all deps release release-all test install uninstall clean
|
||||
|
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
const (
|
||||
// Current version
|
||||
version = "0.16.4"
|
||||
version = "0.16.5"
|
||||
|
||||
// Core
|
||||
coordinatorDelayMax time.Duration = 100 * time.Millisecond
|
||||
@@ -18,10 +18,9 @@ const (
|
||||
readerBufferSize = 64 * 1024
|
||||
|
||||
// Terminal
|
||||
initialDelay = 20 * time.Millisecond
|
||||
initialDelayTac = 100 * time.Millisecond
|
||||
spinnerDuration = 200 * time.Millisecond
|
||||
maxPatternLength = 100
|
||||
initialDelay = 20 * time.Millisecond
|
||||
initialDelayTac = 100 * time.Millisecond
|
||||
spinnerDuration = 200 * time.Millisecond
|
||||
|
||||
// Matcher
|
||||
numPartitionsMultiplier = 8
|
||||
|
@@ -4,5 +4,5 @@ package fzf
|
||||
|
||||
const (
|
||||
// Reader
|
||||
defaultCommand = `find -L . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//`
|
||||
defaultCommand = `command find -L . -mindepth 1 \( -path '*/\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-`
|
||||
)
|
||||
|
@@ -723,6 +723,8 @@ func parseKeymap(keymap map[int][]action, str string) {
|
||||
appendAction(actNextHistory)
|
||||
case "toggle-preview":
|
||||
appendAction(actTogglePreview)
|
||||
case "toggle-preview-wrap":
|
||||
appendAction(actTogglePreviewWrap)
|
||||
case "toggle-sort":
|
||||
appendAction(actToggleSort)
|
||||
case "preview-up":
|
||||
|
@@ -199,6 +199,7 @@ const (
|
||||
actPrintQuery
|
||||
actToggleSort
|
||||
actTogglePreview
|
||||
actTogglePreviewWrap
|
||||
actPreviewUp
|
||||
actPreviewDown
|
||||
actPreviewPageUp
|
||||
@@ -603,6 +604,7 @@ func (t *Terminal) resizeWindows() {
|
||||
t.window.MoveAndClear(i, 0)
|
||||
}
|
||||
}
|
||||
t.truncateQuery()
|
||||
}
|
||||
|
||||
func (t *Terminal) move(y int, x int, clear bool) {
|
||||
@@ -628,13 +630,19 @@ func (t *Terminal) printPrompt() {
|
||||
}
|
||||
|
||||
func (t *Terminal) printInfo() {
|
||||
pos := 0
|
||||
if t.inlineInfo {
|
||||
t.move(0, t.displayWidth([]rune(t.prompt))+t.displayWidth(t.input)+1, true)
|
||||
pos = t.displayWidth([]rune(t.prompt)) + t.displayWidth(t.input) + 1
|
||||
if pos+len(" < ") > t.window.Width() {
|
||||
return
|
||||
}
|
||||
t.move(0, pos, true)
|
||||
if t.reading {
|
||||
t.window.CPrint(tui.ColSpinner, t.strong, " < ")
|
||||
} else {
|
||||
t.window.CPrint(tui.ColPrompt, t.strong, " < ")
|
||||
}
|
||||
pos += len(" < ")
|
||||
} else {
|
||||
t.move(1, 0, true)
|
||||
if t.reading {
|
||||
@@ -643,6 +651,7 @@ func (t *Terminal) printInfo() {
|
||||
t.window.CPrint(tui.ColSpinner, t.strong, _spinner[idx])
|
||||
}
|
||||
t.move(1, 2, false)
|
||||
pos = 2
|
||||
}
|
||||
|
||||
output := fmt.Sprintf("%d/%d", t.merger.Length(), t.count)
|
||||
@@ -659,7 +668,9 @@ func (t *Terminal) printInfo() {
|
||||
if t.progress > 0 && t.progress < 100 {
|
||||
output += fmt.Sprintf(" (%d%%)", t.progress)
|
||||
}
|
||||
t.window.CPrint(tui.ColInfo, 0, output)
|
||||
if pos+len(output) <= t.window.Width() {
|
||||
t.window.CPrint(tui.ColInfo, 0, output)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Terminal) printHeader() {
|
||||
@@ -1210,6 +1221,12 @@ func (t *Terminal) buildPlusList(template string, forcePlus bool) (bool, []*Item
|
||||
return true, sels
|
||||
}
|
||||
|
||||
func (t *Terminal) truncateQuery() {
|
||||
maxPatternLength := util.Max(1, t.window.Width()-t.displayWidth([]rune(t.prompt))-1)
|
||||
t.input, _ = t.trimRight(t.input, maxPatternLength)
|
||||
t.cx = util.Constrain(t.cx, 0, len(t.input))
|
||||
}
|
||||
|
||||
// Loop is called to start Terminal I/O
|
||||
func (t *Terminal) Loop() {
|
||||
// prof := profile.Start(profile.ProfilePath("/tmp/"))
|
||||
@@ -1443,6 +1460,11 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
req(reqList, reqInfo, reqHeader)
|
||||
}
|
||||
case actTogglePreviewWrap:
|
||||
if t.hasPreviewWindow() {
|
||||
t.preview.wrap = !t.preview.wrap
|
||||
req(reqPreviewRefresh)
|
||||
}
|
||||
case actToggleSort:
|
||||
t.sort = !t.sort
|
||||
t.eventBox.Set(EvtSearchNew, t.sort)
|
||||
@@ -1688,11 +1710,7 @@ func (t *Terminal) Loop() {
|
||||
if !doActions(actions, mapkey) {
|
||||
continue
|
||||
}
|
||||
// Truncate the query if it's too long
|
||||
if len(t.input) > maxPatternLength {
|
||||
t.input = t.input[:maxPatternLength]
|
||||
t.cx = util.Constrain(t.cx, 0, maxPatternLength)
|
||||
}
|
||||
t.truncateQuery()
|
||||
changed = string(previousInput) != string(t.input)
|
||||
} else {
|
||||
if mapkey == tui.Rune {
|
||||
|
@@ -552,6 +552,9 @@ func (r *LightRenderer) Resume() bool {
|
||||
}
|
||||
|
||||
func (r *LightRenderer) Clear() {
|
||||
if r.fullscreen {
|
||||
r.csi("H")
|
||||
}
|
||||
// r.csi("u")
|
||||
r.origin()
|
||||
r.csi("J")
|
||||
@@ -593,7 +596,7 @@ func (r *LightRenderer) MaxY() int {
|
||||
}
|
||||
|
||||
func (r *LightRenderer) DoesAutoWrap() bool {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *LightRenderer) IsOptimized() bool {
|
||||
|
Reference in New Issue
Block a user