lambdalisue / vim-fern

🌿 General purpose asynchronous tree viewer written in Pure Vim script
MIT License
1.29k stars 49 forks source link

[Style enhancement]: User set directory open & closed symbols, similar to vimfiler & NERDTree #125

Closed bluz71 closed 4 years ago

bluz71 commented 4 years ago

Hello,

I am experimenting with fern.vim and it looks very promising, especially with regard to performance. Well done.

I was a long time NERDTree user, but its performance issues lead me transfer over to vimfiler. vimfiler works well, but it is now end-of-life AND its performance is not as good as fern.

One minor but very nice stylistic detail that both NERDTree & vimfiler provide is the ability to set a symbol for directory open and closed states, as noted:

let g:NERDTreeDirArrowExpandable = "▷"
let g:NERDTreeDirArrowCollapsible = "◢"

let g:vimfiler_tree_closed_icon = '▷'
let g:vimfiler_tree_opened_icon = "◢"

Currently fern uses plain | and +, which are reasonable defaults. Ideally I would also like to set | outline marker to nothing or maybe a box-drawing character such as `▏'.

A possible API could be:

let g:fern_closed_symbol = '▷'
let g:fern_opened_symbol = "◢"
let g:fern_outline_symbol = '▏'

The defaults should probably stay as they are, but provide a easy option to override?

Such symbols also warrant their own highlight group, say FernSymbol, allowing Vim theme authors such as myself, to set a unique color for those symbols, different from the FernBranch color.

I am aware that there is a fern + nerdfont plugin available; but I don't like nerdfonts, I prefer something simpler, just directory symbols.

Here is an example of my vimfiler style that I would like to replicate in fern:

vimfiler

Hopefully this proves interesting, if not, that is fine as well. Many thanks for a cool project. Best regards.

lambdalisue commented 4 years ago

It's not documented (mean that the feature may be removed) while I'm not really satisfied with but you can configure the symbol by using variables defined at https://github.com/lambdalisue/fern.vim/blob/master/autoload/fern/renderer/default.vim#L84-L92

like

let g:fern#renderer#default#leaf_symbol = '|  '
let g:fern#renderer#default#collapsed_symbol = '|> '
let g:fern#renderer#default#expanded_symbol = '|v '

Or create your own renderer. See :help fern-develop-renderer

bluz71 commented 4 years ago

@lambdalisue,

Thanks, a couple of choice to explore. Good information.

I will have a play tomorrow and see how things go. I will send feedback here.

My ideal is to replicate my existing vimfiler style and behaviour but with fern performance.

lambdalisue commented 4 years ago

I made that info public https://github.com/lambdalisue/fern.vim/blob/master/doc/fern.txt#L226-L277

bluz71 commented 4 years ago

@lambdalisue,

Thank you very much, the options you note work very well.

Case closed.