onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 299 forks source link

Add 'Open Folder' option to Oni #566

Closed bryphe closed 7 years ago

bryphe commented 7 years ago

Splitting this out from #506 - there should be a way in Oni to easily open a folder. This is pretty common functionality in other editors, like VSCode. It'd be helpful to have an Open Folder menu option in the File menu for Oni.

As far as I know, Vim/Neovim don't have a concept of opening a folder, so we'd have to define what that means for Oni.

Right now, this would do the following:

In addition, this could hook up with some other integrations:

cyansprite commented 7 years ago

Perhaps when this happens we could set off an async task to gather up the files (git ignore in mind) and cache these files, I'm working on a neovim plugin for searching, replacing and destroying, I can look into how to integrate that with Oni (is there a way to integrate python and typescript? I can try converting it), and the maybe add some kind of caching system after I figure out the open folder thing. I was planning on taking some common code and make an indexing system which is closely related to "opening a folder" and caching.

Thanks for listening I will try to get some coding in tonight! One step at a time just some ideas...

bryphe commented 7 years ago

Perhaps when this happens we could set off an async task to gather up the files (git ignore in mind) and cache these files,

Sounds reasonable! As a side benefit, this would also help significantly with QuickOpen performance - if we could cache those results instead of having to ask git or the tool of choice everytime.

I'm working on a neovim plugin for searching, replacing and destroying, I can look into how to integrate that with Oni (is there a way to integrate python and typescript? I can try converting it), and the maybe add some kind of caching system after I figure out the open folder thing.

VSCode actually has something similiar... Their search functionality is powered by a tool called RipGrep, which they package via npm as: https://www.npmjs.com/package/vscode-ripgrep . It's actually built in Rust but you could use this strategy for any language that can compile cross-platform.

The problem with Python is it's not always guaranteed there's a python runtime (at least on Windows machines), so I've been avoiding writing core functionality in Python.

It might make sense to create a standalone binary (at least if it fits the scenario you're looking at) - that way it can be leveraged between Oni, Neovim, or even other editors like Atom/VSCode. Otherwise of course any web language would work!

I'll try and send out a PR of the 'Open Folder' option to change the working directory, so that we have an entry point in which we can build out some of this additional functionality.

A good experience around searching, replacing, and destroying would be great - that's something I always struggled with in vim/neovim!

bryphe commented 7 years ago

Created a PR to add the open folder option (#570) - it just changes the working directory at the moment.

I think one additional item that might be useful is that, since there is now the buffer/tab bar, it might be more useful for the statusline to show the current working directory, instead of the current file.

cyansprite commented 7 years ago

I think cwd makes more sense as well in status bar and have tabs to show files and we might implement breadcrumbs from the cwd for the tabbar.

I will look into creating a binary once done.

cyansprite commented 7 years ago

Also I will look into converting to typescript.

bryphe commented 7 years ago

Also I will look into converting to typescript.

That would be awesome! The statusbar plugin would be much easier to work with (especially around the JSX elements) with typescript.

I added a change to show the working directory instead of the full path, and hooked up the click handler to bring up the open folder dialog in #570

bryphe commented 7 years ago

This was added by #570