weirongxu / coc-explorer

📁 Explorer for coc.nvim
MIT License
1.15k stars 45 forks source link

[buffer]: Show relative path to the CWD of file? #586

Closed dminca closed 5 months ago

dminca commented 5 months ago

Hello and thank you for this great plugin! 🙌 I'm trying to wrap my head around the buffer section of the explorer, seems that currently it's showing the relative path to my $HOME.

In my particular use-case, I often got files named in the same way, but reside in different directories and they go quite deep the file tree.

Therefore, I'm trying to potentially shorten the path by making it relative to my opened git repository for instance.

image

Is it possible to achieve this? Having the relative path to the opened git repo instead of starting all the way from $HOME?

Thank you so much

weirongxu commented 5 months ago

Yes, Please check out the explorer.openAction.relativePath on https://github.com/weirongxu/coc-explorer?tab=readme-ov-file#configuration

weirongxu commented 5 months ago

It seems that relative path display is not supported yet. You need to add a relative path column type to the buffer source.

weirongxu commented 5 months ago

coc-settings.json

{
  "explorer.buffer.child.template": "[git | 2] [selection | 1] [bufnr] [name][modified][readonly] [relativePath]",
}
dminca commented 5 months ago

wow! This is awesome, thank you so much

weirongxu commented 5 months ago

coc-settings.json

{
  "explorer.buffer.child.template": "[git | 2] [selection | 1] [bufnr] [name][modified][readonly] [relativePath]",
}

I will use this setting as the default template, but this patch hasn't been released to npm yet, I'll do it later.