Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support (go) #147

Closed
junegunn opened this issue Mar 18, 2015 · 21 comments
Closed

Windows support (go) #147

junegunn opened this issue Mar 18, 2015 · 21 comments

Comments

@junegunn
Copy link
Owner

Why?

😮

Parts that are not Windows-friendly

  • ncurses
    • alternatives: termbox, pdcurses
    • Last time I checked, termbox wasn't as stable/feature-complete/performant as ncurses
  • #include <unistd.h>
  • Default command using find
    • Disallow stdin as tty?
  • Use of sh -c to start default command set by $FZF_DEFAULT_COMMAND
    • Should work on cygwin or msys, but on Windows prompt?
  • Build automation
@junegunn junegunn changed the title Windows support Windows support (go) Mar 18, 2015
@junegunn junegunn added this to the 0.9.5 milestone Mar 19, 2015
@untitaker
Copy link

appveyor can be used for the builds. You'd have to install Go manually though.

@junegunn
Copy link
Owner Author

@untitaker Thanks, I'll look into it.

@junegunn junegunn removed this from the 0.9.5 milestone Mar 22, 2015
@junegunn
Copy link
Owner Author

I managed to compile ncurses on Windows using mingw-w64 on msys, but that alone didn't help much. It looks like there are many more issues to be handled 😕 Since I don't think I'll be able to find enough time to continue working on Windows support, I'll just leave this issue open.

Please let me know if anyone's interested in contributing.

@simnalamburt
Copy link

Currently I'm trying to get through this problem but there's so many hard-coded junegunn/fzf URL in the codes. I just forked this project and I'm replacing all those junegunn/fzf to mine. Is there any good way to handle these URLs nicely?

@simnalamburt
Copy link

I somehow built the fzf but I recieved below:

zsh$ ./fzf-tmux
panic: Failed to open /dev/tty

goroutine 8 [running]:
panic(0x5592e0, 0xc082002570)
        C:/Go/src/runtime/panic.go:464 +0x3f4
github.com/simnalamburt/fzf-mingw-w64/src/curses.Init(0xc082004880, 0x470100)
        C:/msys64/home/simna/.go/src/github.com/simnalamburt/fzf-mingw-w64/src/curses/curses.go:261 +0xcc
github.com/simnalamburt/fzf-mingw-w64/src.NewTerminal.func1()
        C:/msys64/home/simna/.go/src/github.com/simnalamburt/fzf-mingw-w64/src/terminal.go:242 +0x43
github.com/simnalamburt/fzf-mingw-w64/src.(*Terminal).Loop(0xc082070000)
        C:/msys64/home/simna/.go/src/github.com/simnalamburt/fzf-mingw-w64/src/terminal.go:751 +0x2f7
created by github.com/simnalamburt/fzf-mingw-w64/src.Run
        C:/msys64/home/simna/.go/src/github.com/simnalamburt/fzf-mingw-w64/src/core.go:210 +0xf0a
Reference

@junegunn
Copy link
Owner Author

@simnalamburt Unfortunately, that is how go projects are laid out.

I myself am not sure which would be the best way to handle this. You might want to take a look at the answers here:
http://stackoverflow.com/questions/14323872/using-forked-package-import-in-go

@jmlucjav
Copy link

jmlucjav commented Apr 18, 2016

no idea if this is helpful, but just in case: https://github.com/gdamore/tcell is a go alternative to termbox, seems like a new project

@junegunn
Copy link
Owner Author

junegunn/fzf.vim#186

@jfun reported that fzf runs on linux subsystem of Windows 10. I haven't had a chance to try it, but it sounds promising.

@Swoorup
Copy link

Swoorup commented Sep 12, 2016

WSL is only limited to windows 10 though. :(

@kelleyma49
Copy link
Contributor

I have an alpha version of fzf for Windows available here: https://github.com/kelleyma49/fzf/tree/WindowsTermbox . Make sure to checkout the WindowsTermbox branch.

fzfwindows

This version uses termbox-go instead of ncurses, and it doesn't need cygwin. Run go build in fzf\src\fzf, which should build a .exe that you can play with.

@simnalamburt
Copy link

@kelleyma49 Thank you for you awesome work! This is exactly what I was looking for.

@junegunn How do you think of this branch? Is it seems to be able to be merged?

@gaving
Copy link

gaving commented Oct 22, 2016

@kelleyma49 Awesome. This is a game changer for me on Windows, hope to see it incorporated!

@justinmk
Copy link
Contributor

@kelleyma49 Is curses needed on any platform, with that branch? Why not use termbox for all platforms?

@junegunn
Copy link
Owner Author

junegunn commented Oct 22, 2016

@simnalamburt It looks promising but it isn't ready to be merged. Some features are commented out. I see it more as a proof-of-concept implementation as for now. But if you just need the basic features, this might be already usable.

@kelleyma49 Cool, thanks! Did you have any issues while porting the code to termbox? I considered using termbox before I started on rewriting fzf in Go (late 2014), but it lacked some features fzf needed such as the support for 256 color terminal and mouse. I guess things have changed over the time? (https://github.com/nsf/termbox/releases)

If we can implement everything ncurses provides using termbox, it does make sense to migrate to termbox completely like @justinmk suggested. But I wouldn't go that far at this stage. If it ain't broke, why fix it? I have much trust in battle-tested ncurses and I expect things to be less stable with its much younger alternative.

Implementation-wise, I think we should do some refactoring of extracting non-portable parts of the code first, to minimize code duplication I see in your branch. Then we can rebase your work on it. Also I would make it possible to build fzf with termbox even on non-Windows platform using build tags. I'll let you know of the progress.

@kelleyma49
Copy link
Contributor

@junegunn - I agree, it isn't ready to be merged. It's not feature parity yet (for example, preview window doesn't work.)

You've abstracted the curses enough that I don't think it would be a problem to keep ncurses and the termbox-go implementations around until you're satisfied that termbox-go (or another solution) matches the features and performance of the ncurses. Let me cleanup the code and test some more before I attempt a pull request.

@junegunn
Copy link
Owner Author

@kelleyma49 I noticed that your branch is behind a few versions (0.15.1 vs 0.15.5) and doesn't compile on non-Windows platform, and I felt there's more code we can refactor out. So I did some base work last night to make it easier to add termbox support. I'll push it to a new branch and request that you rebase your work on it.

@junegunn
Copy link
Owner Author

junegunn commented Oct 24, 2016

@kelleyma49 Please take a look at: https://github.com/junegunn/fzf/commits/termbox. It will build with termbox on Windows or when termbox tag is provided (TAGS=termbox make or go build -tags termbox). Termbox build compiles but it doesn't draw anything on the screen yet. I believe now you'll just have to fill in empty functions in tui/termbox.go

(GOOS=windows make also works.)

@kelleyma49
Copy link
Contributor

Thanks @junegunn . I submitted a pull request to you: #714

@Swoorup
Copy link

Swoorup commented Oct 24, 2016

And the crowd cheers in support 👯‍♂️

@junegunn
Copy link
Owner Author

junegunn commented Nov 8, 2016

Windows binaries are now available. Thanks @kelleyma49.

https://github.com/junegunn/fzf-bin/releases

Unfortunately fzf still doesn't run on cygwin or msys since neither termbox nor tcell supports the platform.

@junegunn junegunn closed this as completed Nov 8, 2016
@kelleyma49
Copy link
Contributor

If you use PowerShell, feel free to try out my module that wraps fzf: https://github.com/kelleyma49/PSFzf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants