mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-23 16:33:50 -07:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e3e76fa8c5 | ||
|
2553806e79 | ||
|
1bcbc5a353 | ||
|
15d351b0f0 | ||
|
c144c95cda | ||
|
f08f4fd87d | ||
|
f8aaeef218 | ||
|
7915e365b3 | ||
|
1c68f81c37 | ||
|
d4c9db0a27 | ||
|
b5e0e29ec6 | ||
|
569be4c6c9 | ||
|
e7ca237b07 | ||
|
a7d3b72117 | ||
|
3ba7b5cf2d | ||
|
254e9765fe | ||
|
3304f284a5 |
22
BUILD.md
22
BUILD.md
@@ -17,21 +17,19 @@ make
|
|||||||
# Build fzf binary and copy it to bin directory
|
# Build fzf binary and copy it to bin directory
|
||||||
make install
|
make install
|
||||||
|
|
||||||
# Build 32-bit and 64-bit executables and tarballs in target
|
# Build fzf binaries and archives for all platforms using goreleaser
|
||||||
|
make build
|
||||||
|
|
||||||
|
# Publish GitHub release
|
||||||
make release
|
make release
|
||||||
|
|
||||||
# Make release archives for all supported platforms in target
|
|
||||||
make release-all
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using `go get`
|
> :warning: Makefile uses git commands to determine the version and the
|
||||||
|
> revision information for `fzf --version`. So if you're building fzf from an
|
||||||
Alternatively, you can build fzf directly with `go get` command without
|
> environment where its git information is not available, you have to manually
|
||||||
manually cloning the repository.
|
> set `$FZF_VERSION` and `$FZF_REVISION`.
|
||||||
|
>
|
||||||
```sh
|
> e.g. `FZF_VERSION=0.24.0 FZF_REVISION=tarball make`
|
||||||
go get -u github.com/junegunn/fzf
|
|
||||||
```
|
|
||||||
|
|
||||||
Third-party libraries used
|
Third-party libraries used
|
||||||
--------------------------
|
--------------------------
|
||||||
|
@@ -1,6 +1,14 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
0.24.2
|
||||||
|
------
|
||||||
|
- Bug fixes and improvements
|
||||||
|
|
||||||
|
0.24.1
|
||||||
|
------
|
||||||
|
- Fixed broken `--color=[bw|no]` option
|
||||||
|
|
||||||
0.24.0
|
0.24.0
|
||||||
------
|
------
|
||||||
- Real-time rendering of preview window
|
- Real-time rendering of preview window
|
||||||
|
21
Makefile
21
Makefile
@@ -5,11 +5,26 @@ MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))
|
|||||||
ROOT_DIR := $(shell dirname $(MAKEFILE))
|
ROOT_DIR := $(shell dirname $(MAKEFILE))
|
||||||
SOURCES := $(wildcard *.go src/*.go src/*/*.go) $(MAKEFILE)
|
SOURCES := $(wildcard *.go src/*.go src/*/*.go) $(MAKEFILE)
|
||||||
|
|
||||||
VERSION := $(shell git describe --abbrev=0)
|
ifdef FZF_VERSION
|
||||||
|
VERSION := $(FZF_VERSION)
|
||||||
|
else
|
||||||
|
VERSION := $(shell git describe --abbrev=0 2> /dev/null)
|
||||||
|
endif
|
||||||
|
ifeq ($(VERSION),)
|
||||||
|
$(error Not on git repository; cannot determine $$FZF_VERSION)
|
||||||
|
endif
|
||||||
VERSION_TRIM := $(shell sed "s/-.*//" <<< $(VERSION))
|
VERSION_TRIM := $(shell sed "s/-.*//" <<< $(VERSION))
|
||||||
VERSION_REGEX := $(subst .,\.,$(VERSION_TRIM))
|
VERSION_REGEX := $(subst .,\.,$(VERSION_TRIM))
|
||||||
REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES))
|
|
||||||
BUILD_FLAGS := -a -ldflags "-X main.version=$(VERSION) -X main.revision=$(REVISION) -w '-extldflags=$(LDFLAGS)'" -tags "$(TAGS)"
|
ifdef FZF_REVISION
|
||||||
|
REVISION := $(FZF_REVISION)
|
||||||
|
else
|
||||||
|
REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES) 2> /dev/null)
|
||||||
|
endif
|
||||||
|
ifeq ($(REVISION),)
|
||||||
|
$(error Not on git repository; cannot determine $$FZF_REVISION)
|
||||||
|
endif
|
||||||
|
BUILD_FLAGS := -a -ldflags "-s -w -X main.version=$(VERSION) -X main.revision=$(REVISION)" -tags "$(TAGS)"
|
||||||
|
|
||||||
BINARY64 := fzf-$(GOOS)_amd64
|
BINARY64 := fzf-$(GOOS)_amd64
|
||||||
BINARYARM5 := fzf-$(GOOS)_arm5
|
BINARYARM5 := fzf-$(GOOS)_arm5
|
||||||
|
@@ -299,7 +299,7 @@ following options are allowed:
|
|||||||
- `yoffset` [float default 0.5 range [0 ~ 1]]
|
- `yoffset` [float default 0.5 range [0 ~ 1]]
|
||||||
- `xoffset` [float default 0.5 range [0 ~ 1]]
|
- `xoffset` [float default 0.5 range [0 ~ 1]]
|
||||||
- `border` [string default `rounded`]: Border style
|
- `border` [string default `rounded`]: Border style
|
||||||
- `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `none`
|
- `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]`
|
||||||
|
|
||||||
`fzf#wrap`
|
`fzf#wrap`
|
||||||
----------
|
----------
|
||||||
|
4
install
4
install
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
version=0.24.0
|
version=0.24.2
|
||||||
auto_completion=
|
auto_completion=
|
||||||
key_bindings=
|
key_bindings=
|
||||||
update_config=2
|
update_config=2
|
||||||
@@ -197,7 +197,7 @@ if [ -n "$binary_error" ]; then
|
|||||||
export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"
|
export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"
|
||||||
mkdir -p "$GOPATH"
|
mkdir -p "$GOPATH"
|
||||||
fi
|
fi
|
||||||
if go get -u github.com/junegunn/fzf; then
|
if go get -ldflags "-s -w -X main.version=$version -X main.revision=go-get" github.com/junegunn/fzf; then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
cp "$GOPATH/bin/fzf" "$fzf_base/bin/"
|
cp "$GOPATH/bin/fzf" "$fzf_base/bin/"
|
||||||
else
|
else
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
$version="0.24.0"
|
$version="0.24.2"
|
||||||
|
|
||||||
$fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition
|
$fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||||
|
|
||||||
|
4
main.go
4
main.go
@@ -5,8 +5,8 @@ import (
|
|||||||
"github.com/junegunn/fzf/src/protector"
|
"github.com/junegunn/fzf/src/protector"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string
|
var version string = "0.24"
|
||||||
var revision string
|
var revision string = "devel"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
protector.Protect()
|
protector.Protect()
|
||||||
|
@@ -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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
..
|
..
|
||||||
.TH fzf-tmux 1 "Oct 2020" "fzf 0.24.0" "fzf-tmux - open fzf in tmux split pane"
|
.TH fzf-tmux 1 "Nov 2020" "fzf 0.24.2" "fzf-tmux - open fzf in tmux split pane"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fzf-tmux - open fzf in tmux split pane
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
..
|
..
|
||||||
.TH fzf 1 "Oct 2020" "fzf 0.24.0" "fzf - a command-line fuzzy finder"
|
.TH fzf 1 "Nov 2020" "fzf 0.24.2" "fzf - a command-line fuzzy finder"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fzf - a command-line fuzzy finder
|
fzf - a command-line fuzzy finder
|
||||||
|
@@ -189,7 +189,7 @@ function! fzf#exec(...)
|
|||||||
if v:shell_error || empty(output)
|
if v:shell_error || empty(output)
|
||||||
throw printf('Failed to run "%s": %s', command, output)
|
throw printf('Failed to run "%s": %s', command, output)
|
||||||
endif
|
endif
|
||||||
let fzf_version = matchstr(output[0], '[0-9.]\+')
|
let fzf_version = matchstr(output[-1], '[0-9.]\+')
|
||||||
if s:version_requirement(fzf_version, a:1)
|
if s:version_requirement(fzf_version, a:1)
|
||||||
let s:checked[a:1] = 1
|
let s:checked[a:1] = 1
|
||||||
return s:exec
|
return s:exec
|
||||||
@@ -700,7 +700,7 @@ function! s:border_opt(window)
|
|||||||
if !has_key(a:window, 'border') && !get(a:window, 'rounded', 1)
|
if !has_key(a:window, 'border') && !get(a:window, 'rounded', 1)
|
||||||
let style = 'sharp'
|
let style = 'sharp'
|
||||||
endif
|
endif
|
||||||
if style == 'none'
|
if style == 'none' || style == 'no'
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -908,23 +908,16 @@ if has('nvim')
|
|||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
function! s:create_popup(hl, opts) abort
|
function! s:create_popup(hl, opts) abort
|
||||||
let is_frame = has_key(a:opts, 'border')
|
|
||||||
let s:popup_create = {buf -> popup_create(buf, #{
|
let s:popup_create = {buf -> popup_create(buf, #{
|
||||||
\ line: a:opts.row,
|
\ line: a:opts.row,
|
||||||
\ col: a:opts.col,
|
\ col: a:opts.col,
|
||||||
\ minwidth: a:opts.width,
|
\ minwidth: a:opts.width,
|
||||||
|
\ maxwidth: a:opts.width,
|
||||||
\ minheight: a:opts.height,
|
\ minheight: a:opts.height,
|
||||||
\ zindex: 50 - is_frame,
|
\ maxheight: a:opts.height,
|
||||||
|
\ zindex: 1000,
|
||||||
\ })}
|
\ })}
|
||||||
if is_frame
|
autocmd TerminalOpen * ++once call s:popup_create(str2nr(expand('<abuf>')))
|
||||||
let id = s:popup_create('')
|
|
||||||
call setwinvar(id, '&wincolor', a:hl)
|
|
||||||
call setbufline(winbufnr(id), 1, a:opts.border)
|
|
||||||
execute 'autocmd BufWipeout * ++once call popup_close('..id..')'
|
|
||||||
return winbufnr(id)
|
|
||||||
else
|
|
||||||
autocmd TerminalOpen * ++once call s:popup_create(str2nr(expand('<abuf>')))
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@@ -617,7 +617,7 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) *tui.ColorTheme {
|
|||||||
case "16":
|
case "16":
|
||||||
theme = dupeTheme(tui.Default16)
|
theme = dupeTheme(tui.Default16)
|
||||||
case "bw", "no":
|
case "bw", "no":
|
||||||
theme = nil
|
theme = tui.NoColorTheme()
|
||||||
default:
|
default:
|
||||||
fail := func() {
|
fail := func() {
|
||||||
errorExit("invalid color specification: " + str)
|
errorExit("invalid color specification: " + str)
|
||||||
|
@@ -653,7 +653,7 @@ func (t *Terminal) displayWidth(runes []rune) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
minWidth = 16
|
minWidth = 4
|
||||||
minHeight = 4
|
minHeight = 4
|
||||||
|
|
||||||
maxDisplayWidthCalc = 1024
|
maxDisplayWidthCalc = 1024
|
||||||
@@ -801,17 +801,19 @@ func (t *Terminal) resizeWindows() {
|
|||||||
t.pwindow = t.tui.NewWindow(y, x, pwidth, pheight, true, noBorder)
|
t.pwindow = t.tui.NewWindow(y, x, pwidth, pheight, true, noBorder)
|
||||||
}
|
}
|
||||||
verticalPad := 2
|
verticalPad := 2
|
||||||
|
minPreviewHeight := 3
|
||||||
if t.preview.border == tui.BorderNone {
|
if t.preview.border == tui.BorderNone {
|
||||||
verticalPad = 0
|
verticalPad = 0
|
||||||
|
minPreviewHeight = 1
|
||||||
}
|
}
|
||||||
switch t.preview.position {
|
switch t.preview.position {
|
||||||
case posUp:
|
case posUp:
|
||||||
pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad)
|
pheight := calculateSize(height, t.preview.size, minHeight, minPreviewHeight, verticalPad)
|
||||||
t.window = t.tui.NewWindow(
|
t.window = t.tui.NewWindow(
|
||||||
marginInt[0]+pheight, marginInt[3], width, height-pheight, false, noBorder)
|
marginInt[0]+pheight, marginInt[3], width, height-pheight, false, noBorder)
|
||||||
createPreviewWindow(marginInt[0], marginInt[3], width, pheight)
|
createPreviewWindow(marginInt[0], marginInt[3], width, pheight)
|
||||||
case posDown:
|
case posDown:
|
||||||
pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad)
|
pheight := calculateSize(height, t.preview.size, minHeight, minPreviewHeight, verticalPad)
|
||||||
t.window = t.tui.NewWindow(
|
t.window = t.tui.NewWindow(
|
||||||
marginInt[0], marginInt[3], width, height-pheight, false, noBorder)
|
marginInt[0], marginInt[3], width, height-pheight, false, noBorder)
|
||||||
createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight)
|
createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight)
|
||||||
@@ -1254,6 +1256,7 @@ func (t *Terminal) renderPreviewText(unchanged bool) {
|
|||||||
}
|
}
|
||||||
var ansi *ansiState
|
var ansi *ansiState
|
||||||
for _, line := range t.previewer.lines {
|
for _, line := range t.previewer.lines {
|
||||||
|
line = strings.TrimSuffix(line, "\n")
|
||||||
if lineNo >= height || t.pwindow.Y() == height-1 && t.pwindow.X() > 0 {
|
if lineNo >= height || t.pwindow.Y() == height-1 && t.pwindow.X() > 0 {
|
||||||
t.previewed.filled = true
|
t.previewed.filled = true
|
||||||
break
|
break
|
||||||
@@ -1284,6 +1287,7 @@ func (t *Terminal) renderPreviewText(unchanged bool) {
|
|||||||
if unchanged && lineNo == 0 {
|
if unchanged && lineNo == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
t.pwindow.Fill("\n")
|
||||||
}
|
}
|
||||||
lineNo++
|
lineNo++
|
||||||
}
|
}
|
||||||
|
@@ -554,6 +554,9 @@ func initTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool) {
|
|||||||
|
|
||||||
func initPalette(theme *ColorTheme) {
|
func initPalette(theme *ColorTheme) {
|
||||||
pair := func(fg, bg ColorAttr) ColorPair {
|
pair := func(fg, bg ColorAttr) ColorPair {
|
||||||
|
if fg.Color == colDefault && (fg.Attr&Reverse) > 0 {
|
||||||
|
bg.Color = colDefault
|
||||||
|
}
|
||||||
return ColorPair{fg.Color, bg.Color, fg.Attr}
|
return ColorPair{fg.Color, bg.Color, fg.Attr}
|
||||||
}
|
}
|
||||||
blank := theme.Fg
|
blank := theme.Fg
|
||||||
|
Reference in New Issue
Block a user