helix icon indicating copy to clipboard operation
helix copied to clipboard

Add file tree

Open gbaranski opened this issue 4 years ago • 29 comments

What do you think about that? It's quite useful when you know visually where a file is, but not name of the file.

Same feature in neovim using nvim-tree.lua

image

gbaranski avatar Jun 09 '21 16:06 gbaranski

If you're interested in having this feature, I can try to implement this and open a pull request.

gbaranski avatar Jun 09 '21 16:06 gbaranski

I prefer the fuzzy searcher myself, if you know some of the subdirs, you can still find it fairly easily

nrdxp avatar Jun 09 '21 16:06 nrdxp

I prefer the fuzzy searcher myself, if you know some of the subdirs, you can still find it fairly easily

I like making a lot of files and folders, that makes it easier to navigate with file tree, and I can open folders that I'm currently working on, without being distracted by other folders that I'm not currently interested in. With fzf I see all files, even those which I am not working on currently.

gbaranski avatar Jun 10 '21 09:06 gbaranski

I think this would be best suited as a plugin, though it can probably start as a subcrate until the framework is in place, that way it can at least be compiled separately and disabled via a flag. It's quite a lot of extra UI work though.

Personally I also use a fuzzy searcher or use nnn or zsh + exa externally to do that type of stuff. I did admire vim-dirvish for doing it with text buffers as a different approach.

archseer avatar Jun 10 '21 09:06 archseer

In my opinion it would be better as a built-in feature, just like Vim has netrw, vscode/atom/intellij has built-in file tree

gbaranski avatar Jun 10 '21 15:06 gbaranski

I wouldn't use it personally but if someone could come up with a good idea based on existing file tree like netrw or dired in emacs which could be better than them I don't see why we can't bundle it.

One issue with file tree or these kind of stuff is that I can never remember the key, with the kakoune popup help box at the bottom right maybe we can get this right.

pickfire avatar Jun 10 '21 17:06 pickfire

I wouldn't use it personally but if someone could come up with a good idea based on existing file tree like netrw or dired in emacs which could be better than them I don't see why we can't bundle it.

One issue with file tree or these kind of stuff is that I can never remember the key, with the kakoune popup help box at the bottom right maybe we can get this right.

In Vim I use C-t for toggling the file tree. AFAIK helix doesn't have buffers and navigation, so the question is how to implement moving cursor between file tree and main buffer? C-t could toggle file tree if it's not opened yet and cursor is in main buffer, if it's already open it can just move cursor to it. And if cursor is inside file tree C-t would move cursor to the main buffer.

gbaranski avatar Jun 10 '21 17:06 gbaranski

I think helix have something similar to buffer since you can pick and open another file but maybe we don't have buffer yet. We probably need to create another issue for this.

pickfire avatar Jun 10 '21 17:06 pickfire

AFAIK helix doesn't have buffers

We do have buffers (and views/splits), <space>b opens a "open buffers" list. There's currently no way to close a buffer though, :q only closes the split.

archseer avatar Jun 11 '21 02:06 archseer

Just tossing in my two cents. This is what I said on matrix:

[...] personally I'd rather keep a side-panel tree view out of Helix. But I think the use-case it solves is important to address, so maybe there are other ways to tackle it.

One possibility would be an alternative file finder to the one currently on f, where it acts as a tree-based file navigator. That way it comes up on demand when you're looking for a file, rather than being a persistent element of the UI.

And a little later:

But I do miss having a tree-based navigation system. Not as a replacement for fuzzy search, but as a supplement. It's really useful for e.g. exploring an unfamiliar code base, especially.

cessen avatar Jun 26 '21 19:06 cessen

I would love this feature

Omnikar avatar Nov 05 '21 10:11 Omnikar

bump

UltiRequiem avatar Nov 08 '21 16:11 UltiRequiem

Out of curiosity, what are you all using in the meantime?

alphashuro avatar Dec 12 '21 14:12 alphashuro

Out of curiosity, what are you all using in the meantime?

I once looking at Taupiqueur's dotfiles and found him using sidetree.

I personally just open up a terminal to the side and cd/ls around, not even using a file manager.

NNBnh avatar Dec 12 '21 16:12 NNBnh

https://github.com/Canop/broot might be a good inspiration, or even using the code base.

I would prefer such a feature as built into HX, and not configured separately. Makes things much simpler to install.

Robert-M-Muench avatar Jan 08 '22 17:01 Robert-M-Muench

I like nerd tree in vim, and have it bound to a simple keystroke that pops it open along the side, and the same keystroke to hide it. It’s great for jumping back-and-forth, opening, viewing folder structure and finding files. It’s a fundamental part of how I approach editing and understanding any project, and the vim implementation does not get in the way.

I started using helix today, and read through the documentation twice looking for this feature, as it is a basic tool that any editor should have - I’ve never used an IDE without one easily available either natively or as a plug-in. I will admit I was very surprised to discover there is no such feature. I add my vote that it’s a fundamental IDE tool.

https://github.com/preservim/nerdtree

stoeckley avatar Jan 18 '22 17:01 stoeckley

I like nerd tree in vim, and have it bound to a simple keystroke that pops it open along the side, and the same keystroke to hide it. It’s great for jumping back-and-forth, opening, viewing folder structure and finding files. It’s a fundamental part of how I approach editing and understanding any project, and the vim implementation does not get in the way.

I started using helix today, and read through the documentation twice looking for this feature, as it is a basic tool that any editor should have - I’ve never used an IDE without one easily available either natively or as a plug-in. I will admit I was very surprised to discover there is no such feature. I add my vote that it’s a fundamental IDE tool.

https://github.com/preservim/nerdtree

Most of the people uses nvim-tree.lua instead of nerdtree nowadays

https://github.com/kyazdani42/nvim-tree.lua

UltiRequiem avatar Jan 18 '22 19:01 UltiRequiem

I just want to mention that maybe we should use alphabetical order rather than last access time order in file tree.

xialvjun avatar Feb 24 '22 02:02 xialvjun

Out of curiosity, what are you all using in the meantime?

I once looking at Taupiqueur's dotfiles and found him using sidetree.

I personally just open up a terminal to the side and cd/ls around, not even using a file manager.

I like the idea sidetree work with kakoune, let other program commuicate with the editor, not write all code by the edtior itsefl.

ttys3 avatar Apr 25 '22 13:04 ttys3

https://github.com/cossonfork/helix/tree/tree_explore

univerz avatar Apr 26 '22 05:04 univerz

I am looking for this feature, but perhaps we could consider this as a general tree display / navigation / search feature. A file explorer could be the first implementation of this.

Trees show up in all types of development, for example, the Flutter tooling allows you to dump the widget tree for display in an IDE (or perhaps in a general solution helix tree viewing tool). These IDE tools are notoriously slow to load, and very difficult to traverse... but if we could find a nice way to traverse complex trees in a way that is fast and handles large trees, especially with search and ID based markers, that would be immensely useful even outside of showing files.

You can see it here on the left: https://docs.flutter.dev/development/tools/devtools/inspector#flex-layouts These trees often get massive and I have yet to see a tool handle it well.

Possible operations:

  • fuzzy find item in tree by name
  • add item to buffers/jumplist
  • open item in split
  • go to parent
  • go to last selected child (or first)
  • go to next item tagged with diagnostic
  • expand/collapse item
  • expand/collapse all children recursively

lukepighetti avatar Apr 27 '22 00:04 lukepighetti

The lack of this feature is what prevents me from switching from neovim + a ton of plugins to helix. I'd rather have a bloated config as fast as it's buggy than not being able to explore the tree directly from the editor.

qkzk avatar Apr 27 '22 08:04 qkzk

The lack of this feature is what prevents me from switching from neovim + a ton of plugins to helix. I'd rather have a bloated config as fast as it's buggy than not being able to explore the tree directly from the editor.

These types of comments aren't any more constructive than "+1" comments. If you'd like to see a feature implemented, the best way to do so is to implement it yourself and open a PR.

I personally have no interest in this so I won't be putting any work in it any time soon but it does look like @cossonleo is working on it here: https://github.com/cossonfork/helix/tree/tree_explore

archseer avatar Apr 27 '22 09:04 archseer

instead of merely a file tree... i prefer it has extra feature like favorite folder at top of the "tree panel".. which allow you to add the folder as favorite working folder, so when you switch to the "tree panel" you would mostly browsing through the favorites section instead of the regular file tree.

thienpow avatar May 02 '22 04:05 thienpow

Fuzzy finding is great for navigating code that one knows exists and wants to quickly jump to. A file tree is essential for exploring code one is not familiar with, i.e. when one doesn't know which files and folders exist. The latter happens for example when working on other people's code, in very large codebases, or in monorepos. I therefore think a file tree makes sense as a built-in core feature of Helix, the same way that fuzzy finding makes sense as a core feature.

kevgo avatar Nov 01 '22 20:11 kevgo

i hope Helix implements built-in file explorer like vscode (File Explorer, Search, and Git too) 🙏

erlangparasu avatar Nov 16 '22 05:11 erlangparasu

Another use case of a file explorer that I do not see mentioned yet in this discussion is that it is also a neat place to do other file operations than just opening files (compared to fuzzy finding) like creating/deleting/renaming/moving files. This is what I mainly use https://github.com/nvim-telescope/telescope-file-browser.nvim for opposed to fuzzy finding in my current neovim setup.

daanvdk avatar Dec 07 '22 11:12 daanvdk

Just a note here for future noobs like I was. There is a built in file picker (not quite like the file tree, but it works). Press space f

rvdende avatar Jan 01 '23 17:01 rvdende

the fuzzy search doesn't work well for me unfortunately, due to the fact that i, for the life of me, cannot remember every directory/filename. With hundreds of files i think thats pretty reasonable.. I relied on the :E command in neovim... Im probably just garbage, but yuh know.

tristonarmstrong avatar Jan 13 '23 13:01 tristonarmstrong

Lapce is apparently the spiritual successor to Xi editor, has this feature, and has a puplar ticket for Helix-style controls: https://github.com/lapce/lapce/issues/281

heyakyra avatar Feb 06 '23 01:02 heyakyra