weirongxu/coc-explorer

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

Closed this issue ยท 5 comments

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

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

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

coc-settings.json

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

wow! This is awesome, thank you so much

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.