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

Show :tree view of selected directory in second pane #991

Open
Necrom4 opened this issue Apr 10, 2024 · 2 comments
Open

Show :tree view of selected directory in second pane #991

Necrom4 opened this issue Apr 10, 2024 · 2 comments

Comments

@Necrom4
Copy link

Necrom4 commented Apr 10, 2024

Just as you can show a file/directory's information in the second pane using :view, it'd be great to do the same with :tree, which is easier to view due to the icons and others..

I tried doing it my own way but it's surely not the best

" repeated code for hjkl
nnoremap h :view!<CR>:view<CR>h:if filetype('.') != 'dir' | view! | else | :sync %c<CR>:winrun , tree | endif<CR>
@yusufaktepe
Copy link

yusufaktepe commented Apr 11, 2024

You can use eza or lsd to display directory trees with icons:

fileviewer */,.*/,../ eza -A --group-directories-first --no-quotes --color=always --icons=always --tree --level=3 %c

This is how it looks:
ss-selected-2024-04-11_05-51-37

@xaizek
Copy link
Member

xaizek commented Apr 11, 2024

As was noted on Reddit, using :tree as a preview is a weird way to go about it which results in complicated mappings. Making preview of directories look more like a tree-view would be a saner approach.

By the way, you can also try:

:set milleroptions+=rpreview:all,lsize:0 millerview
:only

It doesn't look like a tree, but otherwise formatting is consistent with file views.

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

No branches or pull requests

3 participants