vim-dirvish icon indicating copy to clipboard operation
vim-dirvish copied to clipboard

Tree style listing

Open lithammer opened this issue 8 years ago • 18 comments

Would it be possible to display the files in a tree style structure, similar to let g:netrw_liststyle = 3. That's what I'm missing the most from netrw.

screen shot 2017-01-12 at 09 57 41

lithammer avatar Jan 12 '17 08:01 lithammer

Definitely want this, and plan to add it after 1.0 release.

justinmk avatar Jan 17 '17 14:01 justinmk

It would be nice to have, but probably I would not be one of the user of that. I like the way how dirvish works now and for traversing project directory I use FZF instead. Dirvish is for simple file management and jumping to files that I know that are near.

hauleth avatar Jan 17 '17 18:01 hauleth

@hauleth My vague plan was to just add whitespace in front of the nested files. So the buffer will still be "just a list of paths".

justinmk avatar Jan 17 '17 19:01 justinmk

That'd be great. Subscribing to this thread.

viniarck avatar Mar 02 '17 22:03 viniarck

Indeed that would be nice! I imagine two things should be done:

  1. ignoring spaces at the beginning of lines (that should be easy when each line begins with the root; maybe it is an acceptable issue to not support at the same time the tree-view and using relative paths when the beginning of the path is a sequence of spaces… (which should be rare anyway))
  2. picking the right way to explore the tree (filtering files, or defining easy ways to filter files, is not that easy anymore, is it?).

I just tried how it would look like using find to populate a dirvish buffer and fixing just the "conceal" syntax rule. I think that solving just (1) would allow to suggest in the documentation a few cheap ways to get a working tree-like view.

shym avatar May 27 '17 22:05 shym

subbing to thread. Would love to see this added!

adamki avatar Jun 02 '17 06:06 adamki

My vague plan was to just add whitespace in front of the nested files.

I think the pipes improve readability.

Larivact avatar Jun 20 '17 15:06 Larivact

perhaps you could use vim folds?

cyansprite avatar Sep 07 '17 21:09 cyansprite

any news regarding this? :)

bbtdev avatar Jul 24 '18 14:07 bbtdev

also interested!

kovasap avatar May 14 '19 17:05 kovasap

I would definitely use it.

astier avatar Jul 14 '19 11:07 astier

I think the pipes improve readability.

This can be done with conceal. Sort of like https://github.com/nathanaelkane/vim-indent-guides

somini avatar Jul 14 '19 22:07 somini

Definitely want this, and plan to add it after 1.0 release.

@justinmk Is there any place where we can see what is missing for the 1.0 release?

That message was posted two years ago, is this still a desired feature, or did it lost priority?

GabeDuarteM avatar Sep 18 '19 13:09 GabeDuarteM

It's desired but I won't have time to work on it soon.

justinmk avatar Sep 18 '19 19:09 justinmk

I'd also love this feature, but I respect that you don't have the time now.

In the meantime, I've been using the following in my vimrc, which is sufficient for me and might be useful to others. Screenshot:

image

It changes the behaviour of the p key (preview) to show the subdirectories of a dirvish entry in the same buffer. It can be repeated on the subdirectory.

        augroup dirvish_config
            autocmd!
            autocmd FileType dirvish
                        \ nnoremap <silent><buffer> p ddO<Esc>:let @"=substitute(@", '\n', '', 'g')<CR>:r ! find "<C-R>"" -maxdepth 1 -print0 \| xargs -0 ls -Fd<CR>:silent! keeppatterns %s/\/\//\//g<CR>:silent! keeppatterns %s/[^a-zA-Z0-9\/]$//g<CR>:silent! keeppatterns g/^$/d<CR>:noh<CR>
        augroup END

I know it's gnarly. I've tested it in WSL in Windows, as well as iterm2 on a mac. Works with both vim and neovim.

It relies on the find and xargs unix commands.

yogeshdhamija avatar May 10 '20 01:05 yogeshdhamija

@ydhamija96 that's cool, I love seeing hacks like that. Maybe send a PR that adds that in :h dirvish-faq

justinmk avatar May 10 '20 06:05 justinmk

Cool! I've opened a PR.

PR #176

yogeshdhamija avatar May 10 '20 15:05 yogeshdhamija

Any news on this?

paniash avatar Jul 30 '21 08:07 paniash