Skip to content
Myr

Merge branch 'devel' into master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parents c691d52, eaa413c · Browse files · 23 files+377 added−274 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

23 files+377 added−274 removed

  • other:+377 added−274 removed

23 files+377 added−274 removed

modified:man/man1/fzf-tmux.1+1 added-1 removed
19 unmodified lines
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22THE SOFTWARE.23..24.TH fzf-tmux 1 "Oct 2020" "fzf 0.23.1" "fzf-tmux - open fzf in tmux split pane"24.TH fzf-tmux 1 "Oct 2020" "fzf 0.24.0" "fzf-tmux - open fzf in tmux split pane"2526.SH NAME27fzf-tmux - open fzf in tmux split pane28
40 unmodified lines
modified:man/man1/fzf.1+11 added-1 removed
19 unmodified lines
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22THE SOFTWARE.23..24.TH fzf 1 "Oct 2020" "fzf 0.23.1" "fzf - a command-line fuzzy finder"24.TH fzf 1 "Oct 2020" "fzf 0.24.0" "fzf - a command-line fuzzy finder"2526.SH NAME27fzf - a command-line fuzzy finder28
162 unmodified lines
191.BR sharp " Border with sharp corners"192.br193.BR horizontal " Horizontal lines above and below the finder"194.br195.BR vertical " Vertical lines on each side of the finder"196.br197.BR top198.br199.BR bottom200.br201.BR left202.br203.BR right204.br205206.TP207.B "--no-unicode"208Use ASCII characters instead of Unicode box drawing characters to draw border
678 unmodified lines
modified:plugin/fzf.vim+62 added-42 removed
152 unmodified lines
153 throw 'Failed to download fzf: '.script154 endif155endfunction156157function! s:version_requirement(val, min)158 let val = split(a:val, '\.')159 let min = split(a:min, '\.')160 for idx in range(0, len(min) - 1)161 let v = get(val, idx, 0)162 if v < min[idx] | return 0163 elseif v > min[idx] | return 1164 endif165 endfor166 return 1167endfunction168169let s:checked = {}157function! fzf#exec()170function! fzf#exec(...)171 if !exists('s:exec')172 if executable(s:fzf_go)173 let s:exec = s:fzf_go174 elseif executable('fzf')
6 unmodified lines
181 redraw182 throw 'fzf executable not found'183 endif184 endif185186 if a:0 && !has_key(s:checked, a:1)187 let command = s:exec . ' --version'188 let output = systemlist(command)189 if v:shell_error || empty(output)190 throw printf('Failed to run "%s": %s', command, output)191 endif192 let fzf_version = matchstr(output[0], '[0-9.]\+')193 if s:version_requirement(fzf_version, a:1)194 let s:checked[a:1] = 1195 return s:exec196 elseif a:0 < 2 && input(printf('You need fzf %s or above. Found: %s. Download binary? (y/n) ', a:1, fzf_version)) =~? '^y'197 redraw198 call fzf#install()199 return fzf#exec(a:1, 1)200 else201 throw printf('You need to upgrade fzf (required: %s or above)', a:1)202 endif203 endif204205 return s:exec206endfunction207208function! s:tmux_enabled()
255 unmodified lines
464 let optstr .= ' --height='.height465 elseif use_term466 let optstr .= ' --no-height'467 endif468 let optstr .= s:border_opt(get(dict, 'window', 0))469 let command = prefix.(use_tmux ? s:fzf_tmux(dict) : fzf_exec).' '.optstr.' > '.temps.result470471 if use_term472 return s:execute_term(dict, command, temps)
216 unmodified lines
689function! s:getpos()690 return {'tab': tabpagenr(), 'win': winnr(), 'winid': win_getid(), 'cnt': winnr('$'), 'tcnt': tabpagenr('$')}691endfunction692693function! s:border_opt(window)694 if type(a:window) != type({})695 return ''696 endif697698 " Border style699 let style = tolower(get(a:window, 'border', 'rounded'))700 if !has_key(a:window, 'border') && !get(a:window, 'rounded', 1)701 let style = 'sharp'702 endif703 if style == 'none'704 return ''705 endif706707 " For --border styles, we need fzf 0.24.0 or above708 call fzf#exec('0.24.0')709 let opt = ' --border=' . style710 if has_key(a:window, 'highlight')711 let color = s:get_color('fg', a:window.highlight)712 if len(color)713 let opt .= ' --color=border:' . color714 endif715 endif716 return opt717endfunction718719function! s:split(dict)720 let directions = {721 \ 'up': ['topleft', 'resize', &lines],722 \ 'down': ['botright', 'resize', &lines],
205 unmodified lines
928 endfunction929endif930931function! s:popup(opts) abort872 " Support ambiwidth == 'double'873 let ambidouble = &ambiwidth == 'double' ? 2 : 1874932 " Size and position933 let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(&columns * a:opts.width)]), &columns])877 let width += width % ambidouble934 let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(&lines * a:opts.height)]), &lines - has('nvim')])935 let row = float2nr(get(a:opts, 'yoffset', 0.5) * (&lines - height))936 let col = float2nr(get(a:opts, 'xoffset', 0.5) * (&columns - width))937
2 unmodified lines
940 let col = min([max([0, col]), &columns - width])941 let row += !has('nvim')942 let col += !has('nvim')943888 " Border style889 let style = tolower(get(a:opts, 'border', 'rounded'))890 if !has_key(a:opts, 'border') && !get(a:opts, 'rounded', 1)891 let style = 'sharp'892 endif893894 if style =~ 'vertical\|left\|right'895 let mid = style == 'vertical' ? '│' .. repeat(' ', width - 2 * ambidouble) .. '│' :896 \ style == 'left' ? '│' .. repeat(' ', width - 1 * ambidouble)897 \ : repeat(' ', width - 1 * ambidouble) .. '│'898 let border = repeat([mid], height)899 let shift = { 'row': 0, 'col': style == 'right' ? 0 : 2, 'width': style == 'vertical' ? -4 : -2, 'height': 0 }900 elseif style =~ 'horizontal\|top\|bottom'901 let hor = repeat('─', width / ambidouble)902 let mid = repeat(' ', width)903 let border = style == 'horizontal' ? [hor] + repeat([mid], height - 2) + [hor] :904 \ style == 'top' ? [hor] + repeat([mid], height - 1)905 \ : repeat([mid], height - 1) + [hor]906 let shift = { 'row': style == 'bottom' ? 0 : 1, 'col': 0, 'width': 0, 'height': style == 'horizontal' ? -2 : -1 }907 else908 let edges = style == 'sharp' ? ['┌', '┐', '└', '┘'] : ['╭', '╮', '╰', '╯']909 let bar = repeat('─', width / ambidouble - 2)910 let top = edges[0] .. bar .. edges[1]911 let mid = '│' .. repeat(' ', width - 2 * ambidouble) .. '│'912 let bot = edges[2] .. bar .. edges[3]913 let border = [top] + repeat([mid], height - 2) + [bot]914 let shift = { 'row': 1, 'col': 2, 'width': -4, 'height': -2 }915 endif916917 let highlight = get(a:opts, 'highlight', 'Comment')918 let frame = s:create_popup(highlight, {919 \ 'row': row, 'col': col, 'width': width, 'height': height, 'border': border920 \ })944 call s:create_popup('Normal', {922 \ 'row': row + shift.row, 'col': col + shift.col, 'width': width + shift.width, 'height': height + shift.height945 \ 'row': row, 'col': col, 'width': width, 'height': height946 \ })924 if has('nvim')925 execute 'autocmd BufWipeout <buffer> bwipeout '..frame926 endif947endfunction948949let s:default_action = {950 \ 'ctrl-t': 'tab split',
34 unmodified lines
modified:src/tui/light.go+37 added-6 removed
651 unmodified lines
652 switch w.border.shape {653 case BorderRounded, BorderSharp:654 w.drawBorderAround()655 case BorderHorizontal:656 w.drawBorderHorizontal()656 w.drawBorderHorizontal(true, true)657 case BorderVertical:658 w.drawBorderVertical(true, true)659 case BorderTop:660 w.drawBorderHorizontal(true, false)661 case BorderBottom:662 w.drawBorderHorizontal(false, true)663 case BorderLeft:664 w.drawBorderVertical(true, false)665 case BorderRight:666 w.drawBorderVertical(false, true)667 }668}669660func (w *LightWindow) drawBorderHorizontal() {661 w.Move(0, 0)662 w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))663 w.Move(w.height-1, 0)664 w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))670func (w *LightWindow) drawBorderHorizontal(top, bottom bool) {671 if top {672 w.Move(0, 0)673 w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))674 }675 if bottom {676 w.Move(w.height-1, 0)677 w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))678 }679}680681func (w *LightWindow) drawBorderVertical(left, right bool) {682 width := w.width - 2683 if !left || !right {684 width++685 }686 for y := 0; y < w.height; y++ {687 w.Move(y, 0)688 if left {689 w.CPrint(ColBorder, string(w.border.vertical))690 }691 w.CPrint(ColBorder, repeat(' ', width))692 if right {693 w.CPrint(ColBorder, string(w.border.vertical))694 }695 }696}697698func (w *LightWindow) drawBorderAround() {699 w.Move(0, 0)700 color := ColBorder701 if w.preview {
244 unmodified lines
modified:src/tui/tcell.go+23 added-7 removed
581 unmodified lines
582 return w.fillString(str, NewColorPair(fg, bg, a))583}584585func (w *TcellWindow) drawBorder() {586 shape := w.borderStyle.shape586 if w.borderStyle.shape == BorderNone {587 if shape == BorderNone {588 return589 }590591 left := w.left
11 unmodified lines
603 } else {604 style = w.normal.style()605 }606607 switch shape {608 case BorderRounded, BorderSharp, BorderHorizontal, BorderTop:606 for x := left; x < right; x++ {607 _screen.SetContent(x, top, w.borderStyle.horizontal, nil, style)608 _screen.SetContent(x, bot-1, w.borderStyle.horizontal, nil, style)609 for x := left; x < right; x++ {610 _screen.SetContent(x, top, w.borderStyle.horizontal, nil, style)611 }612 }610611 if w.borderStyle.shape != BorderHorizontal {613 switch shape {614 case BorderRounded, BorderSharp, BorderHorizontal, BorderBottom:615 for x := left; x < right; x++ {616 _screen.SetContent(x, bot-1, w.borderStyle.horizontal, nil, style)617 }618 }619 switch shape {620 case BorderRounded, BorderSharp, BorderVertical, BorderLeft:621 for y := top; y < bot; y++ {622 _screen.SetContent(left, y, w.borderStyle.vertical, nil, style)623 }624 }625 switch shape {626 case BorderRounded, BorderSharp, BorderVertical, BorderRight:627 for y := top; y < bot; y++ {628 _screen.SetContent(right-1, y, w.borderStyle.vertical, nil, style)629 }616630 }631 switch shape {632 case BorderRounded, BorderSharp:633 _screen.SetContent(left, top, w.borderStyle.topLeft, nil, style)634 _screen.SetContent(right-1, top, w.borderStyle.topRight, nil, style)635 _screen.SetContent(left, bot-1, w.borderStyle.bottomLeft, nil, style)636 _screen.SetContent(right-1, bot-1, w.borderStyle.bottomRight, nil, style)
2 unmodified lines
modified:src/tui/tui.go+5 added
257 unmodified lines
258 BorderNone BorderShape = iota259 BorderRounded260 BorderSharp261 BorderHorizontal262 BorderVertical263 BorderTop264 BorderBottom265 BorderLeft266 BorderRight267)268269type BorderStyle struct {270 shape BorderShape
311 unmodified lines
modified:src/constants.go-3 removed
7 unmodified lines
8 "github.com/junegunn/fzf/src/util"9)1011const (12 // Current version13 version = "0.23.1"1412 // Core13 coordinatorDelayMax time.Duration = 100 * time.Millisecond14 coordinatorDelayStep time.Duration = 10 * time.Millisecond15
69 unmodified lines
modified:src/core.go+1 added-1 removed
41 unmodified lines
42Matcher -> EvtHeader -> Terminal (update header)43*/4445// Run starts fzf46func Run(opts *Options, revision string) {46func Run(opts *Options, version string, revision string) {47 sort := opts.Sort > 048 sortCriteria = opts.Criteria4950 if opts.Version {
294 unmodified lines
modified:src/options.go+13 added-2 removed
56 unmodified lines
57 --min-height=HEIGHT Minimum height when --height is given in percent58 (default: 10)59 --layout=LAYOUT Choose layout: [default|reverse|reverse-list]60 --border[=STYLE] Draw border around the finder61 [rounded|sharp|horizontal] (default: rounded)61 [rounded|sharp|horizontal|vertical|62 top|bottom|left|right] (default: rounded)63 --margin=MARGIN Screen margin (TRBL / TB,RL / T,RL,B / T,R,B,L)64 --info=STYLE Finder info style [default|inline|hidden]65 --prompt=STR Input prompt (default: '> ')66 --pointer=STR Pointer to the current line (default: '>')
354 unmodified lines
421 case "sharp":422 return tui.BorderSharp423 case "horizontal":424 return tui.BorderHorizontal425 case "vertical":426 return tui.BorderVertical427 case "top":428 return tui.BorderTop429 case "bottom":430 return tui.BorderBottom431 case "left":432 return tui.BorderLeft433 case "right":434 return tui.BorderRight435 default:436 if optional && str == "" {437 return tui.BorderRounded438 }428 errorExit("invalid border style (expected: rounded|sharp|horizontal)")439 errorExit("invalid border style (expected: rounded|sharp|horizontal|vertical|top|bottom|left|right)")440 }441 return tui.BorderNone442}443
1104 unmodified lines
modified:src/terminal.go+79 added-45 removed
668 unmodified lines
669670func (t *Terminal) resizeWindows() {671 screenWidth := t.tui.MaxX()672 screenHeight := t.tui.MaxY()673 marginInt := [4]int{}673 marginInt := [4]int{} // TRBL674 t.prevLines = make([]itemLine, screenHeight)675 for idx, sizeSpec := range t.margin {676 if sizeSpec.percent {677 var max float64
8 unmodified lines
686 }687 switch t.borderShape {688 case tui.BorderHorizontal:689 marginInt[idx] += 1 - idx%2690 case tui.BorderVertical:691 marginInt[idx] += 2 * (idx % 2)692 case tui.BorderTop:693 if idx == 0 {694 marginInt[idx]++695 }696 case tui.BorderRight:697 if idx == 1 {698 marginInt[idx] += 2699 }700 case tui.BorderBottom:701 if idx == 2 {702 marginInt[idx]++703 }704 case tui.BorderLeft:705 if idx == 3 {706 marginInt[idx] += 2707 }708 case tui.BorderRounded, tui.BorderSharp:709 marginInt[idx] += 1 + idx%2710 }711 }
40 unmodified lines
752 height := screenHeight - marginInt[0] - marginInt[2]753 switch t.borderShape {754 case tui.BorderHorizontal:755 t.border = t.tui.NewWindow(738 marginInt[0]-1,739 marginInt[3],740 width,741 height+2,756 marginInt[0]-1, marginInt[3], width, height+2,757 false, tui.MakeBorderStyle(tui.BorderHorizontal, t.unicode))758 case tui.BorderVertical:759 t.border = t.tui.NewWindow(760 marginInt[0], marginInt[3]-2, width+4, height,761 false, tui.MakeBorderStyle(tui.BorderVertical, t.unicode))762 case tui.BorderTop:763 t.border = t.tui.NewWindow(764 marginInt[0]-1, marginInt[3], width, height+1,765 false, tui.MakeBorderStyle(tui.BorderTop, t.unicode))766 case tui.BorderBottom:767 t.border = t.tui.NewWindow(768 marginInt[0], marginInt[3], width, height+1,769 false, tui.MakeBorderStyle(tui.BorderBottom, t.unicode))770 case tui.BorderLeft:771 t.border = t.tui.NewWindow(772 marginInt[0], marginInt[3]-2, width+2, height,773 false, tui.MakeBorderStyle(tui.BorderLeft, t.unicode))774 case tui.BorderRight:775 t.border = t.tui.NewWindow(776 marginInt[0], marginInt[3], width+2, height,777 false, tui.MakeBorderStyle(tui.BorderRight, t.unicode))778 case tui.BorderRounded, tui.BorderSharp:779 t.border = t.tui.NewWindow(745 marginInt[0]-1,746 marginInt[3]-2,747 width+4,748 height+2,780 marginInt[0]-1, marginInt[3]-2, width+4, height+2,781 false, tui.MakeBorderStyle(t.borderShape, t.unicode))782 }783 noBorder := tui.MakeBorderStyle(tui.BorderNone, t.unicode)784 if previewVisible {
1069 unmodified lines
1854 cmd.Stderr = cmd.Stdout1855 reader := bufio.NewReader(out)1856 eofChan := make(chan bool)1857 finishChan := make(chan bool, 1)1826 reapChan := make(chan bool)1858 err := cmd.Start()1828 reaps := 01829 if err != nil {1830 t.reqBox.Set(reqPreviewDisplay, previewResult{version, []string{err.Error()}, 0, ""})1831 } else {1832 reaps = 21859 if err == nil {1860 reapChan := make(chan bool)1861 lineChan := make(chan eachLine)1862 // Goroutine 1 reads process output1863 go func() {1864 for {
4 unmodified lines
1869 }1870 }1871 eofChan <- true1872 }()18731874 // Goroutine 2 periodically requests rendering1875 go func(version int64) {1876 lines := []string{}1877 spinner := makeSpinner(t.unicode)
33 unmodified lines
1911 }1912 ticker.Stop()1913 reapChan <- true1914 }(version)1886 }1887 // Goroutine 3 is responsible for cancelling running preview command1888 go func(version int64) {1889 timer := time.NewTimer(previewDelayed)1890 Loop:1891 for {1892 select {1893 case <-timer.C:1894 t.reqBox.Set(reqPreviewDelayed, version)1895 case code := <-t.killChan:1896 if code != exitCancel {1897 util.KillCommand(cmd)1898 os.Exit(code)1899 } else {1900 timer := time.NewTimer(previewCancelWait)1901 select {1902 case <-timer.C:19151916 // Goroutine 3 is responsible for cancelling running preview command1917 go func(version int64) {1918 timer := time.NewTimer(previewDelayed)1919 Loop:1920 for {1921 select {1922 case <-timer.C:1923 t.reqBox.Set(reqPreviewDelayed, version)1924 case code := <-t.killChan:1925 if code != exitCancel {1926 util.KillCommand(cmd)1927 os.Exit(code)1928 } else {1929 timer := time.NewTimer(previewCancelWait)1930 select {1931 case <-timer.C:1932 util.KillCommand(cmd)1904 case <-finishChan:1933 case <-finishChan:1934 }1935 timer.Stop()1936 }1906 timer.Stop()1937 break Loop1938 case <-finishChan:1939 break Loop1940 }1908 break Loop1909 case <-finishChan:1910 break Loop1941 }1912 }1913 timer.Stop()1914 reapChan <- true1915 }(version)1916 <-eofChan1917 cmd.Wait() // NOTE: We should not call Wait before EOF1918 finishChan <- true1919 for i := 0; i < reaps; i++ {1942 timer.Stop()1943 reapChan <- true1944 }(version)19451946 <-eofChan // Goroutine 1 finished1947 cmd.Wait() // NOTE: We should not call Wait before EOF1948 finishChan <- true // Tell Goroutine 3 to stop1949 <-reapChan // Goroutine 2 and 3 finished1950 <-reapChan1951 } else {1952 // Failed to start the command. Report the error immediately.1953 t.reqBox.Set(reqPreviewDisplay, previewResult{version, []string{err.Error()}, 0, ""})1954 }19551956 cleanTemporaryFiles()1957 } else {1958 t.reqBox.Set(reqPreviewDisplay, previewResult{version, nil, 0, ""})1959 }
627 unmodified lines
deleted:src/update_assets.rb-47 removed
1#!/usr/bin/env ruby2# frozen_string_literal: true34# http://www.rubydoc.info/github/rest-client/rest-client/RestClient5require 'rest_client'6require 'json'78if ARGV.length < 39 puts "usage: #{$PROGRAM_NAME} <token> <version> <files...>"10 exit 111end1213token, version, *files = ARGV14base = 'https://api.github.com/repos/junegunn/fzf-bin/releases'1516# List releases17rels = JSON.parse(RestClient.get(base, authorization: "token #{token}"))18rel = rels.find { |r| r['tag_name'] == version }19unless rel20 puts "#{version} not found"21 exit 122end2324# List assets25assets = Hash[rel['assets'].map { |a| a.values_at('name', 'id') }]2627files.select { |f| File.exist?(f) }.map do |file|28 Thread.new do29 name = File.basename(file)3031 if asset_id = assets[name] # rubocop:todo Lint/AssignmentInCondition32 puts "#{name} found. Deleting asset id #{asset_id}."33 RestClient.delete("#{base}/assets/#{asset_id}",34 authorization: "token #{token}")35 else36 puts "#{name} not found"37 end3839 puts "Uploading #{name}"40 RestClient.post(41 "#{base.sub('api', 'uploads')}/#{rel['id']}/assets?name=#{name}",42 File.read(file),43 authorization: "token #{token}",44 content_type: 'application/octet-stream'45 )46 end47end.each(&:join)
modified:.gitignore+3 added
1bin/fzf2bin/fzf.exe3dist4target5pkg6Gemfile.lock7.DS_Store
1 unmodified line
9vendor10gopath11*.zwc12fzf13tmp14*.patch
added:.gon.hcl+11 added
1source = ["./dist/fzf-macos_darwin_amd64/fzf"]2bundle_id = "kr.junegunn.fzf"34apple_id {5 username = "junegunn.c@gmail.com"6 password = "@env:AC_PASSWORD"7}89sign {10 application_identity = "Apple Development: junegunn.c@gmail.com"11}
added:.goreleaser.yml+69 added
1---2project_name: fzf34before:5 hooks:6 - go mod download78builds:9 - id: fzf-macos10 binary: fzf11 goos:12 - darwin13 goarch:14 - amd6415 ldflags:16 - "-s -w -X main.version={{ .Version }} -X main.revision={{ .ShortCommit }}"17 hooks:18 post: gon .gon.hcl1920 - goos:21 - linux22 - windows23 - freebsd24 - openbsd25 goarch:26 - amd6427 - arm28 - arm6429 goarm:30 - 531 - 632 - 733 ldflags:34 - "-s -w -X main.version={{ .Version }} -X main.revision={{ .ShortCommit }}"35 ignore:36 - goos: freebsd37 goarch: arm38 - goos: openbsd39 goarch: arm40 - goos: freebsd41 goarch: arm6442 - goos: openbsd43 goarch: arm644445archives:46 - name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"47 format: tar.gz48 format_overrides:49 - goos: windows50 format: zip51 files:52 - non-existent*5354release:55 github:56 owner: junegunn57 name: fzf58 prerelease: auto59 name_template: '{{ .Tag }}'6061snapshot:62 name_template: "{{ .Tag }}-devel"6364changelog:65 sort: asc66 filters:67 exclude:68 - README69 - test
modified:CHANGELOG.md+3 added-1 removed
21 unmodified lines
22 # * Multiple style attributes can be combined23 # * Italic style may not be supported by some terminals24 rg --line-number --no-heading --color=always "" |25 fzf --ansi --prompt "Rg: " \26 --color fg+:italic,hl:underline:-1,hl+:underline:reverse:-1 \26 --color fg+:italic,hl:underline:-1,hl+:italic:underline:reverse:-1 \27 --color pointer:reverse,prompt:reverse,input:159 \28 --pointer ' '29 ```30- More `--border` options31 - `vertical`, `top`, `bottom`, `left`, `right`32- To indicate if `--multi` mode is enabled, fzf will print the number of33 selected items even when no item is selected34 ```sh35 seq 100 | fzf
951 unmodified lines
modified:go.mod+6 added-6 removed
1module github.com/junegunn/fzf23require (4 github.com/gdamore/tcell v1.4.05 github.com/lucasb-eyer/go-colorful v1.0.3 // indirect5 github.com/mattn/go-isatty v0.0.126 github.com/mattn/go-runewidth v0.0.98 github.com/mattn/go-shellwords v1.0.99 github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e10 golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d11 golang.org/x/sys v0.0.0-20200202164722-d101bd2416d512 golang.org/x/text v0.3.2 // indirect7 github.com/mattn/go-shellwords v1.0.108 github.com/saracen/walker v0.1.19 golang.org/x/crypto v0.0.0-20201016220609-9e8e0b39089710 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect11 golang.org/x/sys v0.0.0-20201026173827-119d4633e4d112 golang.org/x/text v0.3.3 // indirect13)1415go 1.13
modified:go.sum+13 added-25 removed
1github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=1github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=2github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=3github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU=4github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0=6github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4=7github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=5github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=6github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=7github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=8github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=12github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=13github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=9github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=15github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=16github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=10github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=11github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=19github.com/mattn/go-shellwords v1.0.9 h1:eaB5JspOwiKKcHdqcjbfe5lA9cNn/4NRRtddXJCimqk=20github.com/mattn/go-shellwords v1.0.9/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=21github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e h1:NO86zOn5ScSKW8wRbMaSIcjDZUFpWdCQQnexRqZ9h9A=22github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e/go.mod h1:G0Z6yVPru183i2MuRJx1DcR4dgIZtLcTdaaE/pC1BJU=12github.com/mattn/go-shellwords v1.0.10 h1:Y7Xqm8piKOO3v10Thp7Z36h4FYFjt5xB//6XvOrs2Gw=13github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=14github.com/saracen/walker v0.1.1 h1:Ou2QIKTWqo0QxhtuHVmtObbmhjMCEUyJ82xp0uV+MGI=15github.com/saracen/walker v0.1.1/go.mod h1:0oKYMsKVhSJ+ful4p/XbjvXbMgLEkLITZaxozsl4CGE=16golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=17golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=25golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d h1:9FCpayM9Egr1baVnV1SX0H87m+XB0B8S0hAMi99X/3U=26golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=18golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=19golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=20golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=28golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=29golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=30golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=31golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=32golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=21golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=22golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=23golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=24golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=25golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=26golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10=27golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=28golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=38golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=39golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=29golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1 h1:/DtoiOYKoQCcIFXQjz07RnWNPRCbqmSXSpgEzhC9ZHM=30golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=31golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=32golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=42golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=43golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=33golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=34golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=35golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=45golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e h1:1o2bDs9pCd2xFhdwqJTrCIswAeEsn4h/PCNelWpfcsI=46golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=47golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
modified:install+22 added-27 removed
1#!/usr/bin/env bash23set -u45version=0.23.15version=0.24.0-rc16auto_completion=7key_bindings=8update_config=29binary_arch=9shells="bash zsh fish"10prefix='~/.fzf'11prefix_expand=~/.fzf12fish_dir=${XDG_CONFIG_HOME:-$HOME/.config}/fish
100 unmodified lines
113}114115try_curl() {116 command -v curl > /dev/null &&118 if [[ $1 =~ tgz$ ]]; then117 if [[ $1 =~ tar.gz$ ]]; then118 curl -fL $1 | tar -xzf -119 else120 local temp=${TMPDIR:-/tmp}/fzf.zip121 curl -fLo "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
1 unmodified line
123}124125try_wget() {126 command -v wget > /dev/null &&128 if [[ $1 =~ tgz$ ]]; then127 if [[ $1 =~ tar.gz$ ]]; then128 wget -O - $1 | tar -xzf -129 else130 local temp=${TMPDIR:-/tmp}/fzf.zip131 wget -O "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
1 unmodified line
133}134135download() {136 echo "Downloading bin/fzf ..."138 if [[ ! "$version" =~ alpha ]]; then139 if [ -x "$fzf_base"/bin/fzf ]; then140 echo " - Already exists"141 check_binary && return137 if [ -x "$fzf_base"/bin/fzf ]; then138 echo " - Already exists"139 check_binary && return142 fi143 link_fzf_in_path && return140 fi141 link_fzf_in_path && return142 mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin143 if [ $? -ne 0 ]; then144 binary_error="Failed to create bin directory"145 return146 fi147148 local url152 [[ "$version" =~ alpha ]] &&153 url=https://github.com/junegunn/fzf-bin/releases/download/alpha/${1} ||154 url=https://github.com/junegunn/fzf-bin/releases/download/$version/${1}149 url=https://github.com/junegunn/fzf/releases/download/$version/${1}150 set -o pipefail151 if ! (try_curl $url || try_wget $url); then152 set +o pipefail153 binary_error="Failed to download with curl and wget"
13 unmodified lines
167archi=$(uname -sm)168binary_available=1169binary_error=""170case "$archi" in176 Darwin\ *64) download fzf-$version-darwin_${binary_arch:-amd64}.tgz ;;177 Linux\ armv5*) download fzf-$version-linux_${binary_arch:-arm5}.tgz ;;178 Linux\ armv6*) download fzf-$version-linux_${binary_arch:-arm6}.tgz ;;179 Linux\ armv7*) download fzf-$version-linux_${binary_arch:-arm7}.tgz ;;180 Linux\ armv8*) download fzf-$version-linux_${binary_arch:-arm8}.tgz ;;181 Linux\ aarch64*) download fzf-$version-linux_${binary_arch:-arm8}.tgz ;;182 Linux\ *64) download fzf-$version-linux_${binary_arch:-amd64}.tgz ;;183 FreeBSD\ *64) download fzf-$version-freebsd_${binary_arch:-amd64}.tgz ;;184 OpenBSD\ *64) download fzf-$version-openbsd_${binary_arch:-amd64}.tgz ;;185 CYGWIN*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;186 MINGW*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;187 MSYS*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;188 Windows*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;189 *) binary_available=0 binary_error=1 ;;171 Darwin\ *64) download fzf-$version-darwin_amd64.tar.gz ;;172 Linux\ armv5*) download fzf-$version-linux_armv5.tar.gz ;;173 Linux\ armv6*) download fzf-$version-linux_armv6.tar.gz ;;174 Linux\ armv7*) download fzf-$version-linux_armv7.tar.gz ;;175 Linux\ armv8*) download fzf-$version-linux_arm64.tar.gz ;;176 Linux\ aarch64*) download fzf-$version-linux_arm64.tar.gz ;;177 Linux\ *64) download fzf-$version-linux_amd64.tar.gz ;;178 FreeBSD\ *64) download fzf-$version-freebsd_amd64.tar.gz ;;179 OpenBSD\ *64) download fzf-$version-openbsd_amd64.tar.gz ;;180 CYGWIN*\ *64) download fzf-$version-windows_amd64.zip ;;181 MINGW*\ *64) download fzf-$version-windows_amd64.zip ;;182 MSYS*\ *64) download fzf-$version-windows_amd64.zip ;;183 Windows*\ *64) download fzf-$version-windows_amd64.zip ;;184 *) binary_available=0 binary_error=1 ;;185esac186187cd "$fzf_base"188if [ -n "$binary_error" ]; then
193 unmodified lines
modified:install.ps1+7 added-19 removed
1$version="0.23.1"1$version="0.24.0-rc1"23if ([Environment]::Is64BitProcess) {4 $binary_arch="amd64"5} else {6 $binary_arch="386"7}83$fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition45function check_binary () {6 Write-Host " - Checking fzf executable ... " -NoNewline
18 unmodified lines
2526function download {27 param($file)28 Write-Host "Downloading bin/fzf ..."35 if ("$version" -ne "alpha") {36 if (Test-Path "$fzf_base\bin\fzf.exe") {37 Write-Host " - Already exists"38 if (check_binary) {39 return29 if (Test-Path "$fzf_base\bin\fzf.exe") {30 Write-Host " - Already exists"31 if (check_binary) {32 return40 }33 }34 }35 if (-not (Test-Path "$fzf_base\bin")) {36 md "$fzf_base\bin"
2 unmodified lines
39 $binary_error="Failed to create bin directory"40 return41 }42 cd "$fzf_base\bin"51 if ("$version" -eq "alpha") {52 $url="https://github.com/junegunn/fzf-bin/releases/download/alpha/$file"53 } else {54 $url="https://github.com/junegunn/fzf-bin/releases/download/$version/$file"43 $url="https://github.com/junegunn/fzf/releases/download/$version/$file"55 }44 $temp=$env:TMP + "\fzf.zip"45 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls1246 (New-Object Net.WebClient).DownloadFile($url, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$temp"))47 if ($?) {
7 unmodified lines
55 }56 check_binary >$null57}5871download "fzf-$version-windows_$binary_arch.zip"59download "fzf-$version-windows_amd64.zip"6061Write-Host 'For more information, see: https://github.com/junegunn/fzf'
modified:main.go+2 added-1 removed
3 unmodified lines
4 "github.com/junegunn/fzf/src"5 "github.com/junegunn/fzf/src/protector"6)78var version string9var revision string1011func main() {12 protector.Protect()12 fzf.Run(fzf.ParseOptions(), revision)13 fzf.Run(fzf.ParseOptions(), version, revision)14}
modified:Makefile+7 added-38 removed
3 unmodified lines
4MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))5ROOT_DIR := $(shell dirname $(MAKEFILE))6SOURCES := $(wildcard *.go src/*.go src/*/*.go) $(MAKEFILE)78VERSION := $(shell git describe --abbrev=0)9REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES))9BUILD_FLAGS := -a -ldflags "-X main.revision=$(REVISION) -w '-extldflags=$(LDFLAGS)'" -tags "$(TAGS)"10BUILD_FLAGS := -a -ldflags "-X main.version=$(VERSION) -X main.revision=$(REVISION) -w '-extldflags=$(LDFLAGS)'" -tags "$(TAGS)"1112BINARY64 := fzf-$(GOOS)_amd6413BINARYARM5 := fzf-$(GOOS)_arm514BINARYARM6 := fzf-$(GOOS)_arm615BINARYARM7 := fzf-$(GOOS)_arm716BINARYARM8 := fzf-$(GOOS)_arm817BINARYPPC64LE := fzf-$(GOOS)_ppc64le18VERSION := $(shell awk -F= '/version =/ {print $$2}' src/constants.go | tr -d "\" ")18RELEASE64 := fzf-$(VERSION)-$(GOOS)_amd6419RELEASEARM5 := fzf-$(VERSION)-$(GOOS)_arm520RELEASEARM6 := fzf-$(VERSION)-$(GOOS)_arm621RELEASEARM7 := fzf-$(VERSION)-$(GOOS)_arm722RELEASEARM8 := fzf-$(VERSION)-$(GOOS)_arm823RELEASEPPC64LE := fzf-$(VERSION)-$(GOOS)_ppc64le1920# https://en.wikipedia.org/wiki/Uname21UNAME_M := $(shell uname -m)22ifeq ($(UNAME_M),x86_64)
17 unmodified lines
40endif4142all: target/$(BINARY)4349target:50 mkdir -p $@5152ifeq ($(GOOS),windows)53release: target/$(BINARY64)54 cd target && cp -f $(BINARY64) fzf.exe && zip $(RELEASE64).zip fzf.exe55 cd target && rm -f fzf.exe56else ifeq ($(GOOS),linux)57release: target/$(BINARY64) target/$(BINARYARM5) target/$(BINARYARM6) target/$(BINARYARM7) target/$(BINARYARM8) target/$(BINARYPPC64LE)58 cd target && cp -f $(BINARY64) fzf && tar -czf $(RELEASE64).tgz fzf59 cd target && cp -f $(BINARYARM5) fzf && tar -czf $(RELEASEARM5).tgz fzf60 cd target && cp -f $(BINARYARM6) fzf && tar -czf $(RELEASEARM6).tgz fzf61 cd target && cp -f $(BINARYARM7) fzf && tar -czf $(RELEASEARM7).tgz fzf62 cd target && cp -f $(BINARYARM8) fzf && tar -czf $(RELEASEARM8).tgz fzf63 cd target && cp -f $(BINARYPPC64LE) fzf && tar -czf $(RELEASEPPC64LE).tgz fzf64 cd target && rm -f fzf65else66release: target/$(BINARY64)67 cd target && cp -f $(BINARY64) fzf && tar -czf $(RELEASE64).tgz fzf68 cd target && rm -f fzf69endif7071release-all: clean test72 GOOS=darwin make release73 GOOS=linux make release74 GOOS=freebsd make release75 GOOS=openbsd make release76 GOOS=windows make release7744test: $(SOURCES)45 SHELL=/bin/sh GOOS= $(GO) test -v -tags "$(TAGS)" \46 github.com/junegunn/fzf/src \47 github.com/junegunn/fzf/src/algo \
1 unmodified line
49 github.com/junegunn/fzf/src/util5051install: bin/fzf5253release:54 goreleaser --rm-dist --snapshot5556clean:88 $(RM) -r target57 $(RM) -r dist target5859target/$(BINARY64): $(SOURCES)60 GOARCH=amd64 $(GO) build $(BUILD_FLAGS) -o $@61
27 unmodified lines
89update:90 $(GO) get -u91 $(GO) mod tidy92124.PHONY: all release release-all test install clean docker docker-test update93.PHONY: all release test install clean docker docker-test update
modified:README-VIM.md+1 added-1 removed
298 unmodified lines
299 - `yoffset` [float default 0.5 range [0 ~ 1]]300 - `xoffset` [float default 0.5 range [0 ~ 1]]301 - `highlight` [string default `'Comment'`]: Highlight group for border302 - `border` [string default `rounded`]: Border style303 - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right`303 - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `none`304305`fzf#wrap`306----------307
143 unmodified lines
modified:README.md+1 added-1 removed
80 unmodified lines
8182You can [download fzf executable][bin] alone if you don't need the extra83stuff.8485[bin]: https://github.com/junegunn/fzf-bin/releases85[bin]: https://github.com/junegunn/fzf/releases8687### Using Homebrew or Linuxbrew8889You can use [Homebrew](http://brew.sh/) or [Linuxbrew](http://linuxbrew.sh/)
612 unmodified lines