Oni: Oni GUI for FZF.vim

Created on 27 Jun 2018  路  11Comments  路  Source: onivim/oni

Oni Version:0.3.6
Neovim Version (Linux only): NVIM v0.3.0
Operating System: mac

Hi, Is it possible to utilize Oni's external UI on plugin like fzf.vim.

I appreciate the external UI on code completion and quick info. Quick open UI looks good but the functionality is missing.

Fzf.vim has support for Commits, Command History, Recent File History, File Search, Ag for find patterns in files and it is super fast even on 100K files! A working example can be tested from my vimrc with key-mapping gf or :History<cr>.

Currently the FZF.vim shows output in a new window split. This is a sample for :Commits

image

Feature-request

Most helpful comment

fzf was strictly designed to be a terminal program with its own interface. Turning it into some sort of library, which is not going to be trivial due to the tight coupling of its filtering mechanism and its interface, is not part of the plan.

I like the idea of having floating windows in Vim by the way. It would be cool to be able to start fzf in a pop-up window at the center of the screen.

All 11 comments

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

I concur. I'd love to see, in general, Oni lean on several packages that are considered "best of" solutions in the community. E.g. Ale, Polyglot.

@Piping thanks for raising the issue I think its a great thing to discuss and think about for oni. I raised a similar issue a little while ago #1000 regarding integrating ALE into oni somehow. My thinking much like yours is that there are a lot of very good very well maintained vim plugins and it would be a shame to re-invent the wheel for every piece of functionality, so oni could focus on other things that weren't already out there.

That being said now that I have a better understanding of the codebase I think the sort of integration would have to be a two way street i.e. the process that most plugins run and how they render their out put is all to be honest quite separate from oni, theres no clear way for us to consume the out put of say ALE etc.

Things I think that could help would be neovim externalisations (giving us control of areas of the ui) like the commandline or the echo msg area or quick fix then we could render those but it still wouldn't be a direct interface.

Re. fzf I briefly had a look at it due to issues like #747 and as prior to @CrossR's change to our filtering logic I was sorely missing it tbh I still use it for things oni doesnt do but from what I can tell fzf is essentially (if I understand how it actually works correctly which I might not) a terminal program it renders its own ui.

Apologies for the wall of text, I personally love this idea, because I think it would be awesome if oni could somehow leverage the already big community of vim plugins, but I think for something like this/any integration to work short of forking a bunch of project and calling methods from oni which would expose output of the plugins but leave the rendering to oni, the plugins would have to expose a way for us to get the information they eventually render.

EDIT: another alternative would be trawling through the plugins code base to see what methods were exposed to the user and seeing if those could somehow be leveraged by oni, but that would be incredibly error prone as the plugin apis could/would change under our feet and things I think would likely break on a fairly constant basis

Upside though Oni is slowly (well not that slowly) basically implementing all of the things that FZF does file search with Rg (#2315), i'm currently working on git integration etc(#2110) etc.

I really appreciate you taking the time to write this up. As a relative new outsider, this was definitely something that kept coming to mind as I used and learned about this project.

鉂わ笍

@Akin909 Thanks for the awesome writeup, I think a popup-window that drops down like quickopen and taken the redirected output from split window to its own would be good enough!

I believe FZF.vim internally use xterm or built-int terminal support from vim to display its result. So the drop-down style popup should also be able to display the internal terminal buffer from neovim.

Most plugins have their own special window names and should be easy to hooked up within Oni. <esc> can be used to cancel the popup window.

I also need to understand the codebase for oni too. Overall Oni is really good at externalized UI from vim and reinventing the functionality that vim/high quality vim-plugin has already(@jherdman) is not interesting. Oni can integrate them well together without changing existing vim's users habit. The 200K+ sources code(neovim) below already contains so many functionalities for text-editing, searching, etc.
One thing really great about Oni is that it helps users from GUI world to understand the vim-way of text-editing, expose vim's functionality, and plus ease of learning curve through interactive tutorials, proper UI feedbacks.

Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                              133          24366          48343         183707
vim script                    1334          27677          36724         167384
PO File                         27          49232          53178         104383
Lua                            377           8451           3445          87628

@Piping whilst I definitely don't speak for everyone, I know @bryphe is v. understandably concerned of having to maintain bunches of vimscript, it'd be interesting to see some sort of integration.

Re.

I think a popup-window that drops down like quickopen and taken the redirected output from split window to its own would be good enough!

I believe FZF.vim internally use xterm or built-int terminal support from vim to display its result. So the drop-down style popup should also be able to display the internal terminal buffer from neovim.

I don't know how this could be implemented I know its possible in vimscript to redirect output of a command into a split but not sure how to redirect output into something oni could then render, or how to keep whatever was rendered dynamic so it could be selectable etc.

If its something you think you could do I personally would be interested in a PR for that (trying to mind read @bryphe I think this is the sort of thing he'd probably like to do outside of oni-core as a plugin etc since it wouldn't be essential core functionality and would have a dependency on the user having fzf)

fzf is built to run in a TTY. fzf depends on having tight control of the UI that it presents. So it's not just a matter of redirecting command output.

OTOH, Oni _could_ present the fzf :terminal window as a "floating window" (https://github.com/neovim/neovim/pull/6619 , https://github.com/neovim/neovim/pull/8221) and perhaps decorate it somehow.

I once asked @junegunn if it made sense to decouple fzf somehow so that its filtering/ranking could be used as a library. I can't find the discussion, but maybe @junegunn can confirm if it's still out-of-scope?

@Akin909 Oni could be more than a GUI front end for vim. It stands for a new modal of text editing, which is built on top of vim. So integrating with vim script is essential anyway.

@justinmk Thanks for the input! It is very helpful!

fzf was strictly designed to be a terminal program with its own interface. Turning it into some sort of library, which is not going to be trivial due to the tight coupling of its filtering mechanism and its interface, is not part of the plan.

I like the idea of having floating windows in Vim by the way. It would be cool to be able to start fzf in a pop-up window at the center of the screen.

Seems like a dedicated FZF.vim integration is not possible as per @junegunn's response.

If someone wants the popup terminal idea to be implemented, create a new issue so that it can be properly discussed there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bryphe picture bryphe  路  22Comments

jordwalke picture jordwalke  路  25Comments

rococode picture rococode  路  20Comments

keforbes picture keforbes  路  19Comments

justinmk picture justinmk  路  22Comments