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

Add file tree #200

Open
gbaranski opened this issue Jun 9, 2021 · 45 comments · May be fixed by #5768
Open

Add file tree #200

gbaranski opened this issue Jun 9, 2021 · 45 comments · May be fixed by #5768
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements S-needs-discussion Status: Needs discussion or design.

Comments

@gbaranski
Copy link
Contributor

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
Copy link
Contributor Author

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

@nrdxp
Copy link
Contributor

nrdxp commented Jun 9, 2021

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

@pickfire pickfire added the C-enhancement Category: Improvements label Jun 9, 2021
@gbaranski
Copy link
Contributor Author

gbaranski commented Jun 10, 2021

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.

@archseer
Copy link
Member

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.

@pickfire pickfire added the A-plugin Area: Plugin system label Jun 10, 2021
@gbaranski
Copy link
Contributor Author

gbaranski commented Jun 10, 2021

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

@pickfire
Copy link
Contributor

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.

@gbaranski
Copy link
Contributor Author

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.

@pickfire
Copy link
Contributor

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.

@archseer
Copy link
Member

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.

@cessen
Copy link
Contributor

cessen commented Jun 26, 2021

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.

@Omnikar
Copy link
Contributor

Omnikar commented Nov 5, 2021

I would love this feature

@archseer archseer mentioned this issue Nov 8, 2021
@UltiRequiem
Copy link

bump

@pickfire pickfire added the E-help-wanted Call for participation: Extra attention is needed label Nov 18, 2021
@alphashuro
Copy link

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

@NNBnh
Copy link
Contributor

NNBnh commented Dec 12, 2021

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.

@Robert-M-Muench
Copy link

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.

@stoeckley
Copy link

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

@UltiRequiem
Copy link

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

@xialvjun
Copy link

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

@ttys3
Copy link
Contributor

ttys3 commented Apr 25, 2022

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.

@univerz
Copy link

univerz commented Apr 26, 2022

@lukepighetti
Copy link

lukepighetti commented Apr 27, 2022

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

@qkzk
Copy link

qkzk commented Apr 27, 2022

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.

@erlangparasu
Copy link

erlangparasu commented Nov 16, 2022

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

@daanvdk
Copy link

daanvdk commented Dec 7, 2022

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.

@rvdende
Copy link

rvdende commented Jan 1, 2023

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

@tristonarmstrong
Copy link

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.

@heyakyra
Copy link
Contributor

heyakyra commented Feb 6, 2023

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

@archseer
Copy link
Member

archseer commented Feb 6, 2023

Okay, but Lapce isn't Helix. This is the Helix issue tracker.

@goyalyashpal
Copy link
Contributor

use nnn or zsh + exa externally to do that type of stuff
- @ archseer at #200 (comment)

can u share screenrecord?

@goyalyashpal
Copy link
Contributor

goyalyashpal commented Feb 9, 2023

With fzf I see all files, even those which I am not working on currently.
- @ gbaranski (author) at #200 (comment)

is this the problem, or if the suggested feature of a separate file tree view exactly what u want??

as in, would it help u if the current fuzzy finder1 itself supports collapsable tree view with indentation for subdir contents?
Edit: this same view is shared by @ cessen at #200 (comment)

Footnotes

  1. that popup which opens when u press Space f for open file picker right?
    Edit: i think fuzzy finder is different - i don't know what it is then

@alphashuro
Copy link

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 can you elaborate on how you do your workflow with nnn? for example, how do you quickly go from a file that you have open in helix to navigating it's directory?

@lukepighetti
Copy link

Anyone know if it's possible to get a program like nnn to make an existing instance of hx open a file? If so, maybe the answer here is to compose our environments in something like zellij

@goyalyashpal
Copy link
Contributor

goyalyashpal commented Feb 19, 2023

if it's possible to ... make an existing instance of hx open a file

looking at the hx -h , i don't think that it's possible.

$ hx -h
helix-term 22.12 (96ff64a8)
Blaž Hrastnik <blaz@mxxn.io>
A post-modern text editor.

USAGE:
    hx [FLAGS] [files]...

ARGS:
    <files>...    Sets the input file to use, position can also be specified via file[:row[:col]]

FLAGS:
    -h, --help                     Prints help information
    --tutor                        Loads the tutorial
    --health [CATEGORY]            Checks for potential errors in editor setup
                                   CATEGORY can be a language or one of 'clipboard', 'languages'
                                   or 'all'. 'all' is the default if not specified.
    -g, --grammar {fetch|build}    Fetches or builds tree-sitter grammars listed in languages.toml
    -c, --config <file>            Specifies a file to use for configuration
    -v                             Increases logging verbosity each use for up to 3 times
    --log                          Specifies a file to use for logging
                                   (default file: C:\Users\Yash Pal Goyal\AppData/Local/helix\helix.log)
    -V, --version                  Prints version information
    --vsplit                       Splits all given files vertically into different windows
    --hsplit                       Splits all given files horizontally into different windows

'sharing the relevant help line regarding opening in existing instance from other softwares below.

$ codium -h
  -n --new-window                            Force to open a new window.
  -r --reuse-window                          Force to open a file or folder in
                                             an already opened window.

$ # doublecmd
-C or --client       If Double Commander is already running, activate it and 
                     pass the path(s) in the command line to that instance.

$ notepad++ --help
-multiinst : Launch another Notepad++ instance

$ freecad --help
  --single-instance         Allow to run a single instance of the application

@lukepighetti
Copy link

I added this enhancement request here: #6054

@thomasgoulet
Copy link

Anyone know if it's possible to get a program like nnn to make an existing instance of hx open a file? If so, maybe the answer here is to compose our environments in something like zellij

You could take a look at this action inside zellij https://zellij.dev/documentation/cli-actions.html#write
But at this point this is more like a hack and would probably break easily.

But I think at this point this is outside the subject of the issue.

@archseer archseer linked a pull request Mar 9, 2023 that will close this issue
@espositofulvio
Copy link

Hello Everyone,
I've just started using Helix and it's the first time I'm actually managing to adapt to modal editing, I find it very intuitive. I've come up with this issue as I'm also interested in this kind of project view, filepicker is awesome but sometimes a tree view fits better. Unfortunately I am not very fluent in rust (just learning) so I'm not to the point I can contribute, but if it can be of help I'm also using gitui which has a crate for a file treeview (https://github.com/extrawurst/gitui/tree/master/filetreelist) available. I'm not sure if Helix will implement this (I do hope so) but maybe it can be at least of inspiration.

@qkzk
Copy link

qkzk commented Mar 16, 2023

Hello !

Is there a way to communicate with a running Helix instance and pass commands from outside ?

RPC, stdin, whatever ?
I know there's no plugins so this option is out.

There's many TUI file managers written in rust, we could simply use another crate and communicate.
It would be much simpler than integrating a new filemanager from scratch in Helix.

Something like this should do the trick:

  1. open Helix
  2. open a terminal with the FM from Helix
  3. select the desired file in the FM
  4. send a command back to Helix from the FM (which requires to modify the FM in some way)
  5. close the term

@goyalyashpal
Copy link
Contributor

goyalyashpal commented Mar 16, 2023

2. open a terminal with the FM from Helix

how to "open a terminal from helix" ?

@qkzk
Copy link

qkzk commented Mar 16, 2023

Yes, ATM you can't:/

@calebebteixeira
Copy link

Oh yeah, I feel like once we have a file tree feature on Helix, it will have a lot of adoption. I feel like this is the only thing that's preventing me from switching from Neovim. Great job guys!

@cpt-n3mo
Copy link

Oh yeah, I feel like once we have a file tree feature on Helix, it will have a lot of adoption. I feel like this is the only thing that's preventing me from switching from Neovim. Great job guys!

I would switch in a hart beat.. loving helix, but really miss a file tree..

@dead10ck
Copy link
Member

Hey guys, I'm just going to reiterate @archseer's point: it is not helpful to make comments like "this is the only thing keeping me from switching". There is already an open PR (#5768). The problem is not that we need convincing that it is important, it is that the maintainers need time to review the PR in our spare time. I'm going to lock the conversation since there isn't really much meaningful discussion left to have around the issue itself.

@helix-editor helix-editor locked as too heated and limited conversation to collaborators Apr 19, 2023
@kirawi kirawi added A-helix-term Area: Helix term improvements S-needs-discussion Status: Needs discussion or design. and removed A-plugin Area: Plugin system labels Nov 2, 2023
@kirawi kirawi removed the E-help-wanted Call for participation: Extra attention is needed label Jan 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements S-needs-discussion Status: Needs discussion or design.
Projects
None yet